本文整理汇总了PHP中Sh404sefFactory::getExtensionPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefFactory::getExtensionPlugin方法的具体用法?PHP Sh404sefFactory::getExtensionPlugin怎么用?PHP Sh404sefFactory::getExtensionPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sh404sefFactory
的用法示例。
在下文中一共展示了Sh404sefFactory::getExtensionPlugin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shIncludeMetaPlugin
function shIncludeMetaPlugin()
{
$option = JRequest::getCmd('option');
// get extension plugin
$extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
// which plugin file are we supposed to use?
$extPluginPath = $extPlugin->getMetaPluginPath(Sh404sefFactory::getPageInfo()->currentNonSefUrl);
if (!empty($extPluginPath)) {
include $extPluginPath;
}
}
示例2: shSefRelToAbs
//.........这里部分代码省略.........
// warning : must add &lang=xx (only if it does not exists already), so as to be able to recognize the SefURL in the db if it's there
if (!strpos($string, 'lang=')) {
$shSepString = JString::substr($string, -9) == 'index.php' ? '?' : '&';
$anchorTable = explode('#', $string);
// V 1.2.4.m remove anchor before adding language
$string = $anchorTable[0];
$string .= $shSepString . 'lang=' . shGetIsoCodeFromName($shLanguage) . (!empty($anchorTable[1]) ? '#' . $anchorTable[1] : '');
// V 1.2.4.m then stitch back anchor
}
$URI = new sh_Net_URL($string);
// V 1.2.4.l need to save unsorted URL
if (count($URI->querystring) > 0) {
// Import new vars here.
$option = null;
$task = null;
//$sid = null; V 1.2.4.s
// sort GET parameters to avoid some issues when same URL is produced with options not
// in the same order, ie index.php?option=com_virtuemart&category_id=3&Itemid=2&lang=fr
// Vs index.php?category_id=3&option=com_virtuemart&Itemid=2&lang=fr
ksort($URI->querystring);
// sort URL array
$string = shSortUrl($string);
// now we are ready to extract vars
$shGETVars = $URI->querystring;
extract($URI->querystring, EXTR_REFS);
}
if (empty($option)) {
// V 1.2.4.r protect against empty $option : we won't know what to do
$shMosConfig_locale = $shOrigLang;
_log('Returning shSefRelToAbs 3 with ' . $shOrigString);
return $shOrigString;
}
// get plugin associated with the extension
$extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
// get component type
$shComponentType = $extPlugin->getComponentType();
$shOption = str_replace('com_', '', $option);
//list of extension we always skip
$alwaysSkip = array('jce', 'akeeba');
if (in_array($shOption, $alwaysSkip)) {
$shComponentType = Sh404sefClassBaseextplugin::TYPE_SKIP;
}
// V 1.2.4.s : fallback to to JoomlaSEF if no extension available
// V 1.2.4.t : this is too early ; it prevents manual custom redirect to be checked agains the requested non-sef URL
_log('Component type = ' . $shComponentType);
// is there a named anchor attached to $string? If so, strip it off, we'll put it back later.
if ($URI->anchor) {
$string = str_replace('#' . $URI->anchor, '', $string);
}
// V 1.2.4.m
// shumisha special homepage processing (in other than default language)
if (shIsHomePage($string) || $string == 'index.php') {
$sefstring = '';
$urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
// still use it so we need it both ways
if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) {
$urlType = shGetSefURLFromCacheOrDB(shCleanUpPag($string), $sefstring);
// V 1.2.4.t check also without page info
//to be able to add pagination on custom
//redirection or multi-page homepage
if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) {
$sefstring = shAddPaginationInfo(@$limit, @$limitstart, @showall, 1, $string, $sefstring, null);
// a special case : com_content does not calculate pagination right
// for frontpage and blog, they include links shown at the bottom in the calculation of number of items
// For instance, with joomla sample data, the frontpage has only 5 articles
// but the view sets $limit to 9 !!!
示例3: create
function create($string, &$vars, &$shAppendString, $shLanguage, $shSaveString = '', &$originalUri)
{
$sefConfig =& shRouter::shGetConfig();
// get DB
$database =& JFactory::getDBO();
_log('Calling sef404 create function with ' . $string);
if ($sefConfig->shInsertGlobalItemidIfNone && !empty($GLOBALS['Itemid'])) {
// V 1.2.4.t
$shCurrentItemid = $GLOBALS['Itemid'];
} else {
$shCurrentItemid = null;
}
_log('CurrentItemid = ' . $shCurrentItemid);
$index = str_replace($GLOBALS['shConfigLiveSite'], '', $_SERVER['PHP_SELF']);
$base = dirname($index);
$base .= $base == '/' ? '' : '/';
_log('Extracting $vars:', $vars);
extract($vars);
if (isset($title)) {
// V 1.2.4.r : protect against components using 'title' as GET vars (com_jim for instance)
$sh404SEF_title = $title;
}
// means that $sh404SEF_title has to be used in plugins or extensions
$title = array();
// V 1.2.4.r
// get extension plugin
$extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
// which plugin file are we supposed to use?
$extPluginPath = $extPlugin->getSefPluginPath($vars);
$pluginType = $extPlugin->getPluginType();
// use Joomla router.php file in extension dir
switch ($pluginType) {
case Sh404sefClassBaseextplugin::TYPE_JOOMLA_ROUTER:
// Load the plug-in file.
_log('Loading component own router.php file');
$functionName = ucfirst(str_replace('com_', '', $option)) . 'BuildRoute';
if (!function_exists($functionName)) {
include JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php';
}
$originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
$title = $functionName($originalVars);
//$title = shRemoveSlugs( $title, $removeWhat = 'removeId');
global $mainframe;
$router =& $mainframe->getRouter();
$title = $router->_encodeSegments($title);
// manage GET var lists ourselves, as Joomla router.php does not do it
if (!empty($vars)) {
// there are some unused GET vars, we must transfer them to our mechanism, so
// that they are eventually appended to the sef url
foreach ($vars as $k => $v) {
switch ($k) {
case 'option':
case 'Itemid':
shRemoveFromGETVarsList($k);
break;
default:
// if variable has not been used in sef url, add it to list of variables to be
// appended to the url as query string elements
if (array_key_exists($k, $originalVars)) {
shAddToGETVarsList($k, $v);
} else {
shRemoveFromGETVarsList($k);
}
break;
}
}
}
// special case for search component, as router.php encode the search word in the url
// wa can't do that, as we are storing each url in the db
if (isset($originalVars['option']) && $originalVars['option'] == 'com_search' && !empty($vars['searchword'])) {
// router.php has encoded that in the url, we need to undo
$title = array();
$originalVars['searchword'] = $vars['searchword'];
shAddToGETVarsList('searchword', $vars['searchword']);
if (!empty($vars['view'])) {
$vars['view'] = $vars['view'];
shAddToGETVarsList('view', $vars['view']);
}
}
// handle menu items, having only a single Itemid in the url
// (router.php will return an empty array in that case, even if we have restored
// the full non-sef url, as we already did)
/*
* Build the application route
*/
$tmp = '';
if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
$menu =& shRouter::shGetMenu();
$item = $menu->getItem($vars['Itemid']);
if (is_object($item) && $vars['option'] == $item->component) {
$title[] = $item->route;
}
}
if (empty($title)) {
//$title[] = 'comp';
$title[] = substr($vars['option'], 4);
}
// add user defined prefix
$prefix = shGetComponentPrefix($option);
if (!empty($prefix)) {
//.........这里部分代码省略.........
示例4: shIncludeMetaPlugin
function shIncludeMetaPlugin()
{
$option = JRequest::getCmd('option');
// get extension plugin
$extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
// which plugin file are we supposed to use?
$shPageInfo =& shRouter::shPageInfo();
$extPluginPath = $extPlugin->getMetaPluginPath($shPageInfo->shCurrentPageNonSef);
if (!empty($extPluginPath)) {
include $extPluginPath;
}
}