*/ defined('_JEXEC') or die('Restricted access'); $cParams = JComponentHelper::getParams('com_jmap'); if ($cParams->get('resources_limit_management', 1)) { ini_set('memory_limit', '-1'); ini_set('max_execution_time', 0); ini_set('pcre.backtrack_limit', -1); } if (!$cParams->get('enable_debug', 0)) { ini_set('display_errors', 0); ini_set('error_reporting', E_ERROR); } // Auto loader setup // Register autoloader prefix require_once JPATH_COMPONENT_ADMINISTRATOR . '/framework/loader.php'; JMapLoader::setup(); JMapLoader::registerPrefix('JMap', JPATH_COMPONENT_ADMINISTRATOR . '/framework'); // Main application object $app = JFactory::getApplication(); // Manage partial language translations $jLang = JFactory::getLanguage(); $jLang->load('com_jmap', JPATH_COMPONENT, 'en-GB', true, true); if ($jLang->getTag() != 'en-GB') { $jLang->load('com_jmap', JPATH_SITE, null, true, false); $jLang->load('com_jmap', JPATH_COMPONENT, null, true, false); } /* * All SMVC logic is based on controller.task correcting the wrong Joomla concept * of base execute on view names. * When task is not specified because Joomla force view query string such as menu * the view value is equals to controller and viewname = controller.display
/** * Hook for the auto Pingomatic third party extensions that have not its own * route helper and work with the universal JSitemap route helper framework * * @access private * @return boolean */ public function onAfterRoute() { $this->app = JFactory::getApplication(); // Avoid operations if plugin is executed in frontend if (!$this->app->getClientId()) { return; } // Get component params $this->cParams = JComponentHelper::getParams('com_jmap'); if (!$this->cParams->get('default_autoping', 0) && !$this->cParams->get('autoping', 0)) { return; } // Retrieve more informations as much as possible from the current POST array $option = $this->app->input->get('option'); $view = $this->app->input->get('view'); $controller = $this->app->input->get('controller'); $task = $this->app->input->get('task'); $id = $this->app->input->getInt('id'); $catid = $this->app->input->get('cid', null, 'array'); $language = $this->app->input->get('language'); $name = $this->app->input->getString('name'); if (is_array($catid)) { $catid = $catid[0]; } // Valid execution mapping $arrayExecution = array('com_zoo' => array('controller' => 'item', 'task' => array('apply', 'save', 'save2new', 'save2copy'))); // Test against valid execution, discard all invalid extensions operations if (array_key_exists($option, $arrayExecution)) { $testIfExecute = $arrayExecution[$option]; foreach ($testIfExecute as $property => $value) { $evaluated = ${$property}; if (is_array($value)) { if (!in_array($evaluated, $value)) { return; } } else { if ($evaluated != $value) { return; } } } } else { return; } // Valid execution success! Go on to route the request to the content plugin, mimic the native Joomla onContentAfterSave // Auto loader setup // Register autoloader prefix require_once JPATH_ROOT . '/administrator/components/com_jmap/framework/loader.php'; JMapLoader::setup(); JMapLoader::registerPrefix('JMap', JPATH_ROOT . '/administrator/components/com_jmap/framework'); JPluginHelper::importPlugin('content', 'pingomatic'); // Simulate the jsitemap_category_id object for the JSitemap route helper $elm = new stdClass(); $elm->jsitemap_category_id = (int) $catid; // Simulate the $article Joomla object passed to the content observers $itemObject = new stdClass(); $itemObject->id = $id; $itemObject->catid = $elm; $itemObject->option = $option; $itemObject->view = $view ? $view : $controller; $itemObject->language = $language; $itemObject->title = $name; // Trigger the content plugin event $this->_subject->trigger('onContentAfterSave', array('com_zoo.item', $itemObject, false)); }