Guest User

Xen Demo Load Variable in Css

a guest
Mar 13th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2. class Sedo_LoadCssVariable_Listener
  3. {
  4.     public static $loaderOjb;
  5.    
  6.     public static function initDependencies(XenForo_Dependencies_Abstract $dependencies, array $data)
  7.     {
  8.         XenForo_Template_Helper_Core::$helperCallbacks['variable_css'] = array('Sedo_LoadCssVariable_Listener', 'getCssVariable');
  9.     }
  10.  
  11.     public static function getCssVariable($methodName, array $options = array())
  12.     {
  13.         if(!self::$loaderOjb)
  14.         {
  15.             self::$loaderOjb = new Sedo_LoadCssVariable_Loader($methodName, $options);
  16.         }
  17.         else
  18.         {
  19.             self::$loaderOjb->loadNewOptions($methodName, $options);
  20.         }
  21.        
  22.         return self::$loaderOjb->$methodName();
  23.     }
  24. }
  25.  
  26. class Sedo_LoadCssVariable_Loader
  27. {
  28.     protected $_currentMethodCalled;
  29.     protected $_options;
  30.  
  31.     public function __construct($methodName, array $options = array())
  32.     {
  33.         $this->_currentMethodCalled = $methodName;
  34.         $this->_options[$methodName] = $options;
  35.     }
  36.  
  37.     public function loadNewOptions($methodName, array $options = array())
  38.     {
  39.         $this->_currentMethodCalled = $methodName;
  40.         $this->_options[$methodName] = $options;
  41.     }
  42.  
  43.     public function getcurrentOptions()
  44.     {
  45.         if(isset($this->_options[$this->_currentMethodCalled]))
  46.         {
  47.             return $this->_options[$this->_currentMethodCalled];
  48.         }
  49.        
  50.         return array();
  51.     }
  52.  
  53.     public function __call($name, $arguments)
  54.     {
  55.             return 'Unknown method';
  56.     }  
  57.  
  58.     /**
  59.     * Custom functions
  60.     */ 
  61.  
  62.     public function getBlackColor()
  63.     {
  64.         return 'black';
  65.     }
  66.  
  67.     public function getCustomProperties()
  68.     {
  69.         return array('color'=>'blue', 'background-color'=>'red', 'border-color' => 'yellow');
  70.     }  
  71. }
  72. //Zend_Debug::dump($abc);
Advertisement
Add Comment
Please, Sign In to add comment