public function UpdateAddon($addon) { if (!function_exists('OnTextChange')) { return; } \gp\tool\Plugins::SetDataFolder($addon); OnTextChange(); \gp\tool\Plugins::ClearDataFolder(); }
/** * Setup SPL Autoloading * */ public static function Autoload($class) { global $config, $dataDir; $parts = explode('\\', $class); $part_0 = array_shift($parts); if (!$parts) { return; } //gp namespace if ($part_0 === 'gp') { $path = $dataDir . '/include/' . implode('/', $parts) . '.php'; if (file_exists($path)) { include_once $path; } else { trigger_error('Autoload for gp namespace failed. Class: ' . $class . ' path: ' . $path); } return; } //look for addon namespace if ($part_0 === 'Addon') { $namespace = array_shift($parts); if (!$parts) { return; } foreach ($config['addons'] as $addon_key => $addon) { if (isset($addon['Namespace']) && $addon['Namespace'] == $namespace) { \gp\tool\Plugins::SetDataFolder($addon_key); $path = \gp\tool\Plugins::$current['code_folder_full'] . '/' . implode('/', $parts) . '.php'; if (file_exists($path)) { include_once $path; } \gp\tool\Plugins::ClearDataFolder(); } } return; } //thirdparty $path = $dataDir . '/include/thirdparty/' . str_replace('\\', '/', $class) . '.php'; if (file_exists($path)) { include_once $path; } }
/** * Execute a set of directives for theme areas, hooks and special pages * */ public static function ExecInfo($info, $args = array()) { global $addonFolderName, $installed_addon, $page; $args += array('page' => $page); //addonDir is deprecated as of 2.0b3 $addon = false; if (isset($info['addonDir'])) { $addon = $info['addonDir']; } elseif (isset($info['addon'])) { $addon = $info['addon']; } if ($addon !== false) { if (gp_safe_mode) { return $args; } \gp\tool\Plugins::SetDataFolder($addon); } //if addon was just installed if ($installed_addon && $installed_addon === $addonFolderName) { \gp\tool\Plugins::ClearDataFolder(); return $args; } // check for fatal errors if (self::FatalNotice('exec', $info)) { return $args; } $args = self::_ExecInfo($info, $args); if ($addon !== false) { \gp\tool\Plugins::ClearDataFolder(); } self::PopCatchable(); return $args; }