本文整理汇总了PHP中shFinalizePlugin函数的典型用法代码示例。如果您正苦于以下问题:PHP shFinalizePlugin函数的具体用法?PHP shFinalizePlugin怎么用?PHP shFinalizePlugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shFinalizePlugin函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// according to language
// only if you have defined the
if (!empty($sampleId)) {
// fetch some data about the content
try {
// using shLib database helper is J2.x/J3.x safe
$sampleTitle = ShlDbHelper::selectObject('#__sample_names', array('id', 'title'), array('id' => $sampleId));
} catch (Exception $e) {
ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
}
if ($sampleTitle) {
// if we found a title for this element
$title[] = $sampleTitle->title;
// insert it in URL array
shRemoveFromGETVarsList('sampleId');
// remove sampleId var from GET vars list
// as we have found a text equivalent
shMustCreatePageId('set', true);
// NEW: ask sh404sef to create a short URL for this SEF URL (pageId)
}
}
shRemoveFromGETVarsList('task');
// also remove task, as it is not needed
// because we can revert the SEF URL without
// it
}
// ------------------ standard plugin finalize function - don't change ---------------------------
if ($dosef) {
$string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null);
}
// ------------------ standard plugin finalize function - don't change ---------------------------
示例2: create
//.........这里部分代码省略.........
// 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)) {
array_unshift($title, $prefix);
}
// now process the resulting title string
$string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
break;
// use sh404sef plugins, either in ext. dir or in sh404sef dir
// use sh404sef plugins, either in ext. dir or in sh404sef dir
case Sh404sefClassBaseextplugin::TYPE_SH404SEF_ROUTER:
_log('Loading sh404SEF plugin in ' . $extPluginPath);
include $extPluginPath;
break;
case Sh404sefClassBaseextplugin::TYPE_JOOMSEF_ROUTER:
Sh404sefHelperExtplugins::loadJoomsefCompatLibs();
include_once $extPluginPath;
$className = 'SefExt_' . $option;
$plugin = new $className();
if (!shIsHomepage($string)) {
// make sure the plugin does not try to calculate pagination
$params =& SEFTools::GetExtParams('com_content');
$params->set('pagination', '1');
// ask plugin to build url
$plugin->beforeCreate($originalUri);
$result = $plugin->create($originalUri);
$title = empty($result['title']) ? array() : $result['title'];
$plugin->afterCreate($originalUri);
// make sure we have a url
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;
}
}
$prefix = shGetComponentPrefix($option);
if (!empty($prefix)) {
array_unshift($title, $prefix);
示例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;
}
$index = str_replace($GLOBALS['shConfigLiveSite'], '', $_SERVER['PHP_SELF']);
$base = dirname($index);
$base .= $base == '/' ? '' : '/';
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
// Plug-in system.
$shDoNotOverride = in_array(str_replace('com_', '', $option), $sefConfig->shDoNotOverrideOwnSef);
// look first in component owndir for a joomla sef router.php file
if (shFileExists(JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php') && ($shDoNotOverride || !$shDoNotOverride && !shFileExists(sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php') && !shFileExists(JPATH_ROOT . DS . 'components/' . $option . '/sef_ext/' . $option . '.php'))) {
// but we don't have a plugin
// 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)) {
array_unshift($title, $prefix);
}
// now process the resulting title string
$string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
} else {
//.........这里部分代码省略.........
示例4: empty
}
$title = empty($title) ? $title : $pageInfo->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':
case 'lang':
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;
}
}
}
// ------------------ standard plugin finalize function - don't change ---------------------------
if ($dosef) {
$string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, isset($limit) ? $limit : null, isset($limitstart) ? $limitstart : null, isset($shLangName) ? $shLangName : null, isset($showall) ? $showall : null, $suppressPagination = true);
}
// ------------------ standard plugin finalize function - don't change ---------------------------
示例5: shRemoveFromGETVarsList
// system plugins may cause pdf and rss to break if they call JFactory::getDocument() in the onAfterInitialize event handler
// because at this time SEF url are not decoded yet.
if (isset($format) && (!sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR || (sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR && $format == 'html')))
shRemoveFromGETVarsList('format');
if (isset($type))
shRemoveFromGETVarsList('type');
if (!empty($catid))
shRemoveFromGETVarsList('catid'); // V 1.2.4.m
if (isset($showall))
shRemoveFromGETVarsList('showall');
if (empty($page)) // remove page if not set or 0
shRemoveFromGETVarsList('page');
if (isset($print))
shRemoveFromGETVarsList('print');
if (isset($tmpl) && $tmpl == 'component') // remove if 'component', show otherwise as querystring
shRemoveFromGETVarsList('tmpl');
// ------------------ standard plugin finalize function - don't change ---------------------------
if ($dosef){
$string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,
(isset($limit) ? $limit : null), (isset($limitstart) ? $limitstart : null),
(isset($shLangName) ? $shLangName : null), (isset($showall) ? $showall : null));
}
// ------------------ standard plugin finalize function - don't change ---------------------------
} else { // this is multipage homepage
$title[] = '/';
$string = sef_404::sefGetLocation( $string, $title, null, (isset($limit) ? $limit : null),
(isset($limitstart) ? $limitstart : null), (isset($shLangName) ? $shLangName : null),
(isset($showall) ? $showall : null));
}