Esempio n. 1
0
 /**
  *
  * @see Waindigo_Listener_Template::run()
  */
 public function run()
 {
     $hooks = $this->_getHooks();
     foreach ($hooks as $hookName) {
         if ($hookName == $this->_hookName) {
             $callback = $this->_getHookCallbackFromHookName($hookName);
             $this->_runHookCallback($callback);
         }
     }
     $hookCallbacks = $this->_getHookCallbacks();
     foreach ($hookCallbacks as $hookName => $callback) {
         if ($hookName == $this->_hookName) {
             $this->_runHookCallback($callback);
         }
     }
     return parent::run();
 }
Esempio n. 2
0
 public function __construct($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
 {
     $this->_templateName = $templateName;
     $this->_containerData = $containerData;
     parent::__construct($content, $template);
 }
Esempio n. 3
0
 /**
  *
  * @see Waindigo_Listener_Template::run()
  */
 public function run()
 {
     switch ($this->_hookName) {
         case 'page_container_breadcrumb_bottom':
             if (!self::$_copyrightNotice) {
                 $this->_copyrightNotice();
             }
             break;
     }
     $hooks = $this->_getHooks();
     foreach ($hooks as $hookName) {
         if ($hookName == $this->_hookName) {
             $callback = $this->_getHookCallbackFromHookName($hookName);
             $this->_runHookCallback($callback);
         }
     }
     $hookCallbacks = $this->_getHookCallbacks();
     foreach ($hookCallbacks as $hookName => $callback) {
         if ($hookName == $this->_hookName) {
             $this->_runHookCallback($callback);
         }
     }
     return parent::run();
 }
Esempio n. 4
0
 /**
  * This is to ensure copyright notices don't display on every page if all
  * add-ons are newer than 15 September 2012 (unless explicitly set).
  *
  * This code is redundant if all add-ons are newer than 25 June 2013.
  */
 protected function _removeUnwantedCopyrightNotice()
 {
     $thListeners = XenForo_CodeEvent::getEventListeners('template_hook');
     $tprListeners = XenForo_CodeEvent::getEventListeners('template_post_render');
     if (!empty($thListeners) || !empty($tprListeners)) {
         $this->_getLibraryListenerFileVersion('Template');
         if (!empty($thListeners)) {
             $templateHookVersion = $this->_getLibraryListenerFileVersion('TemplateHook');
         }
         if (!empty($tprListeners)) {
             $templatePostRenderVersion = $this->_getLibraryListenerFileVersion('TemplatePostRender');
         }
     }
     $tcListeners = XenForo_CodeEvent::getEventListeners('template_create');
     if (!empty($tcListeners)) {
         $this->_getLibraryListenerFileVersion('TemplateCreate');
     }
     $lccListeners = XenForo_CodeEvent::getEventListeners('load_class_controller');
     if (!empty($lccListeners)) {
         $loadClassVersion = $this->_getLibraryListenerFileVersion('LoadClass', false);
     }
     if (defined(Waindigo_Listener_InitDependencies::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY) && !XenForo_Application::getSimpleCacheData(self::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY)) {
         return;
     }
     if (XenForo_Application::$versionId < 1020000 && self::$_showCopyright) {
         return;
     }
     $className = get_class(self::$_controller);
     if (XenForo_Application::$versionId < 1020000 && strpos($className, 'Waindigo') === 0) {
         return;
     }
     if (XenForo_Application::get('options')->waindigo_loadClassHints) {
         $controllers = XenForo_Application::get('options')->waindigo_loadClassHints;
     } else {
         $controllers = array('XenForo_ControllerPublic_Misc' => array());
     }
     $addOns = array();
     if (XenForo_Application::$versionId < 1020000 || !array_key_exists($className, $controllers)) {
         if (XenForo_Application::$versionId >= 1020000) {
             if (!empty($thListeners['_'])) {
                 $thListeners = $thListeners['_'];
             } else {
                 $thListeners = array();
             }
         }
         if (!empty($thListeners)) {
             foreach ($thListeners as $templateHook) {
                 if (strlen($templateHook[0]) > strlen('Waindigo_') && substr($templateHook[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
                     if ($templateHookVersion < '20120715') {
                         return;
                     }
                     $addOns[] = substr($templateHook[0], 0, strlen($templateHook[0]) - strlen('_Listener_TemplateHook'));
                 }
             }
         }
         if (XenForo_Application::$versionId >= 1020000) {
             if (!empty($tprListeners['_'])) {
                 $tprListeners = $tprListeners['_'];
             } else {
                 $tprListeners = array();
             }
         }
         if (!empty($tprListeners)) {
             foreach ($tprListeners as $templatePostRender) {
                 if (strlen($templatePostRender[0]) > strlen('Waindigo_') && substr($templatePostRender[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
                     $addOnId = substr($templatePostRender[0], 0, strlen($templatePostRender[0]) - strlen('_Listener_TemplatePostRender'));
                     if (in_array($addOnId, $addOns)) {
                         continue;
                     }
                     if ($templatePostRenderVersion < '20120715') {
                         return;
                     }
                     $addOns[] = $addOnId;
                 }
             }
         }
         if (XenForo_Application::$versionId >= 1020000) {
             if (!empty($lccListeners['_'])) {
                 $lccListeners = $lccListeners['_'];
             } else {
                 $lccListeners = array();
             }
         }
         if (!empty($lccListeners)) {
             foreach ($lccListeners as $loadClassController) {
                 if (strlen($loadClassController[0]) > strlen('Waindigo_') && substr($loadClassController[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
                     if (strpos($loadClassController[0], '_Listener_LoadClassController') > 0) {
                         $addOnId = substr($loadClassController[0], 0, strlen($loadClassController[0]) - strlen('_Listener_LoadClassController'));
                     } else {
                         $addOnId = substr($loadClassController[0], 0, strlen($loadClassController[0]) - strlen('_Listener_LoadClass'));
                     }
                     if ($loadClassVersion >= '20121018') {
                         $loadClassController = Waindigo_Listener_LoadClass::create($loadClassController[0]);
                         if (method_exists($loadClassController, 'getExtendedClass')) {
                             $extendedClasses = $loadClassController->getExtendedClasses();
                             if (in_array(get_class(self::$_controller), $extendedClasses)) {
                                 return;
                             }
                         }
                     }
                     if (!in_array($addOnId, $addOns)) {
                         $addOns[] = $addOnId;
                     }
                 }
             }
         }
         if (!empty($addOns) && XenForo_Application::$versionId >= 1020000) {
             $enabledAddOns = XenForo_Application::get('addOns');
             foreach ($enabledAddOns as $addOnId => $addOn) {
                 if ($addOn > 1372118400) {
                     $addOnKey = array_search($addOnId, $addOns);
                     if ($addOnKey !== FALSE) {
                         unset($addOns[$addOnKey]);
                     }
                 }
             }
         }
         if (!empty($addOns)) {
             $cpdListeners = XenForo_CodeEvent::getEventListeners('controller_pre_dispatch');
             if (XenForo_Application::$versionId >= 1020000) {
                 $cpdListeners = $cpdListeners['_'];
             }
             foreach ($cpdListeners as $controllerPreDispatch) {
                 if (strlen($controllerPreDispatch[0]) > strlen('Waindigo_') && substr($controllerPreDispatch[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
                     if ($controllerPreDispatch[0] != 'Waindigo_Listener_ControllerPreDispatch') {
                         $addOnId = substr($controllerPreDispatch[0], 0, strlen($controllerPreDispatch[0]) - strlen('_Listener_ControllerPreDispatch'));
                         $addOnKey = array_search($addOnId, $addOns);
                         if ($addOnKey !== FALSE) {
                             unset($addOns[$addOnKey]);
                         }
                     }
                 }
             }
         }
     }
     if (self::$_showCopyright && !array_key_exists($className, $controllers) && strpos($className, 'Waindigo') !== 0) {
         return;
     }
     if (empty($addOns) && (!empty($thListeners) || !empty($tprListeners))) {
         if (class_exists('Waindigo_Listener_Template')) {
             if (method_exists('Waindigo_Listener_Template', 'setCopyrightNotice')) {
                 Waindigo_Listener_Template::setCopyrightNotice(true);
             } else {
                 $addOnId = reset($addOns);
                 eval('
                     class ' . $addOnId . '_Listener_Template extends Waindigo_Listener_Template
                     {
                     	public static function setCopyrightNotice($copyrightNotice)
                     	{
                     		self::$_copyrightNotice = $copyrightNotice;
                     	}
                     }');
                 call_user_func(array($addOnId . '_Listener_Template', 'setCopyrightNotice'), true);
             }
         }
     }
 }
Esempio n. 5
0
 /**
  *
  * @param string $contents
  * @param XenForo_Template_Abstract $template
  */
 public function __construct(&$contents, XenForo_Template_Abstract $template = null)
 {
     $this->_template = $this;
     parent::__construct($contents, null);
 }
Esempio n. 6
0
 /**
  *
  * @param XenForo_FrontController $fc
  * @param string $contents
  */
 public function __construct(XenForo_FrontController $fc, &$contents)
 {
     $this->_fc = $fc;
     $this->_routePath = $this->_fetchRoutePath();
     parent::__construct($contents, null);
 }