代码转换Joomla 1.5到Joomla 1.7 / 2.5

时间:2012-03-23 23:49:05

标签: php joomla joomla-extensions joomla1.7

我正在尝试将此插件转换为Joomla 1.7,因为我对PHP没有广泛的了解,但我无处可去。任何形式的帮助表示赞赏。

插件的网址:http://extensions.joomla.org/extensions/content-sharing/mailing-a-newsletter-bridges/10400

<?php
    // no direct access
    defined( '_JEXEC' ) or die( 'Restricted access' );

    jimport( 'joomla.plugin.plugin' );

    class plgSystemAutoresponder extends JPlugin{

        function onUserAfterSave($user, $isnew, $succes, $msg){
            //$mainframe->redirect("index.php?option=com_contact");//Put your new page URL here
            global $mainframe;

            // convert the user parameters passed to the event
            // to a format the external application
            $args = array();
            $args['username']   = $user['username'];
            $args['email']      = $user['email'];
            $args['fullname']   = $user['name'];
            $args['password']   = $user['password'];

            $email1 = $user['email'];
            $name1 = $args['username'];
            $email = $args['email'];
            $name = $args['username'];

            //load plugin parameters
            $plugin=&JPluginHelper::getPlugin('autoresponder');
            $pluginParams = new JParameter( $plugin->params );

            $responderUrl         = $this->params->get( 'responder_url' );
            $MetaWebFormId        = $this->params->get( 'meta_web_form_id');
            $MetaSplitId          = $this->params->get( 'meta_split_id' );
            $Unit                 = $this->params->get( 'unit' );
            $Redirect             = $this->params->get( 'redirect' );
            $MetaRedirectOnlist   = $this->params->get( 'meta_redirect_onlist' );
            $MetaAdtracking       = $this->params->get( 'meta_adtracking' );
            $MetaMessage          = $this->params->get( 'meta_message' );
            $MetaRequired         = $this->params->get( 'meta_required' );
            $MetaForwardVars      = $this->params->get( 'meta_forward_vars' );

            $mainframe->redirect($responderUrl."?from=".$email."&name=".$name."&meta_web_form_id=".$MetaWebFormId."&meta_split_id="."&unit=".$Unit."&redirect=".$Redirect."&meta_redirect_onlist=".$MetaRedirectOnlist."&meta_adtracking=".$MetaAdtracking."&meta_message=".$MetaMessage."&meta_required=".$MetaRequired."&meta_forward_vars=".$MetaForwardVars);

        }
    }
?>

我已将XML更新为Joomla 1.7。但是Joomla 1.7给出的错误是第38行和第54行

Line 38:  `$pluginParams = new JParameter( $plugin->params );`
Line 54:  ` $mainframe->redirect($responderUrl."?from=".$email."&name=".$name."&meta_web_form_id=".$MetaWebFormId."&meta_split_id="."&unit=".$Unit."&redirect=".$Redirect."&meta_redirect_onlist=".$MetaRedirectOnlist."&meta_adtracking=".$MetaAdtracking."&meta_message=".$MetaMessage."&meta_required=".$MetaRequired."&meta_forward_vars=".$MetaForwardVars);`

2 个答案:

答案 0 :(得分:2)

看看http://docs.joomla.org/Adapting_a_Joomla_1.5_extension_to_Joomla_1.6 ...它表示扩展,但它也包含了对插件的操作。

答案 1 :(得分:0)

另外 - 看看这里,非常详细的来源和变化的例子:

http://www.theartofjoomla.com/topics/upgrading.html
http://www.theartofjoomla.com/converting-old-extensions.html
http://www.theartofjoomla.com/home/9-developer/112-upgrading-a-plugin-to-joomla-16.html
http://www.theartofjoomla.com/home/41-extensions/132-more-on-upgrading-plugins-to-joomla-16.html
http://www.theartofjoomla.com/home/9-developer/135-database-upgrades-in-joomla-16.html