Topic: Jquery plugin with xajax0.5b4

I tried to test the following Jquery plugin found in the wiki with xajax 0.5b4

<?php
require ('xajax_core/xajax.inc.php');
$xajax = new xajax(); 
class jquery extends xajaxResponsePlugin {
    var $validBaseMethods = array('addclass','append','prepend','background','after','removeClass','hide','show','slideToggle','toggle');

    function generateClientScript() {
      echo '<script type="text/javascript" src="./jquery.js"></script>'.PHP_EOL;
    }

    function buildArgs($iArgs) {
      $args = false;
      // Skip the first arg it is always the jquery expression
      $count = sizeof($iArgs);
      for($i = 1; $i < $count; $i++) {
        if($args) {
          $args .= ',';
        }
        $args .= '"'.$value[$i].'"';
      }
      return $args;
    }

    function __call($method, $args) {
      if(!in_array($method, $this->validBaseMethods)) {
        error_log($method.' method has not been tested with jquery to work!');
      }
        $exp = $args[0];
        $args = $this->buildArgs($args);
        $this->objResponse->script('$("'.$exp.'").'.$method.'('.$args.')');
    }
    
}    

$pluginManager =& xajaxPluginManager::getInstance();
$pluginManager->registerResponsePlugin(new jquery());  //line 36

I always get the following error: Fatal error: Call to undefined method xajaxPluginManager::registerResponsePlugin() in E:\wamp\www\xajax_0.5_beta_4b_Minimal\demo.php on line 36

What 's wrong in my code ?

Re: Jquery plugin with xajax0.5b4

One of the changes that was made in the xajax core was the name of the registration function for plugins:

$objPluginManager->registerPlugin(new testPlugin());

Sorry for the confusion!

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: Jquery plugin with xajax0.5b4

Thanks !! I've replaced the line36 by the following :

$pluginManager->registerPlugin(new jquery());

And now all works fine !!

Thanks again !