本文整理汇总了PHP中Sh404sefHelperGeneral::stripTrackingVarsFromSef方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefHelperGeneral::stripTrackingVarsFromSef方法的具体用法?PHP Sh404sefHelperGeneral::stripTrackingVarsFromSef怎么用?PHP Sh404sefHelperGeneral::stripTrackingVarsFromSef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sh404sefHelperGeneral
的用法示例。
在下文中一共展示了Sh404sefHelperGeneral::stripTrackingVarsFromSef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shInsertOpenGraphData
function shInsertOpenGraphData(&$buffer)
{
// get sh404sef config
$sefConfig =& Sh404sefFactory::getConfig();
$pageInfo =& Sh404sefFactory::getPageInfo();
if (empty($sefConfig->shMetaManagementActivated) || !isset($sefConfig) || empty($pageInfo->currentNonSefUrl) || !empty($pageInfo->httpStatus) && $pageInfo->httpStatus == 404) {
return;
}
$nonSef = shGetCurrentNonSef();
$customData = shGetCustomMetaData($nonSef);
// user can disable per url
if ($customData->og_enable == SH404SEF_OPTION_VALUE_NO || empty($sefConfig->enableOpenGraphData) && $customData->og_enable == SH404SEF_OPTION_VALUE_USE_DEFAULT) {
return;
}
$openGraphData = '';
$ogNameSpace = '';
$fbNameSpace = '';
// add locale - FB use underscore in language tags
$locale = str_replace('-', '_', JFactory::getLanguage()->getTag());
$openGraphData .= "\n" . ' <meta property="og:locale" content="' . $locale . '" />';
// insert title
if (!empty($pageInfo->pageTitle)) {
$openGraphData .= "\n" . ' <meta property="og:title" content="' . $pageInfo->pageTitle . '" />';
}
// insert description
if (($sefConfig->ogEnableDescription && $customData->og_enable_description == SH404SEF_OPTION_VALUE_USE_DEFAULT || $customData->og_enable_description == SH404SEF_OPTION_VALUE_YES) && !empty($pageInfo->pageDescription)) {
$openGraphData .= "\n" . ' <meta property="og:description" content="' . $pageInfo->pageDescription . '" />';
}
// insert type
$content = $customData->og_type == SH404SEF_OPTION_VALUE_USE_DEFAULT ? $sefConfig->ogType : $customData->og_type;
if (!empty($content)) {
$openGraphData .= "\n" . ' <meta property="og:type" content="' . $content . '" />';
}
// insert url. If any, we insert the canonical url rather than current, to consolidate
$content = empty($pageInfo->pageCanonicalUrl) ? $pageInfo->currentSefUrl : $pageInfo->pageCanonicalUrl;
$content = Sh404sefHelperGeneral::stripTrackingVarsFromSef($content);
$openGraphData .= "\n" . ' <meta property="og:url" content="' . htmlspecialchars($content, ENT_COMPAT, 'UTF-8') . '" />';
// insert image
$content = empty($customData->og_image) ? $sefConfig->ogImage : $customData->og_image;
if (!empty($content)) {
$content = JURI::root(false, '') . JString::ltrim($content, '/');
$openGraphData .= "\n" . ' <meta property="og:image" content="' . $content . '" />';
}
// insert site name
if ($sefConfig->ogEnableSiteName && $customData->og_enable_site_name == SH404SEF_OPTION_VALUE_USE_DEFAULT || $customData->og_enable_site_name == SH404SEF_OPTION_VALUE_YES) {
$content = empty($customData->og_site_name) ? $sefConfig->ogSiteName : $customData->og_site_name;
$content = empty($content) ? JFactory::getApplication()->getCfg('sitename') : $content;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:site_name" content="' . $content . '" />';
}
}
// insert location
// disabled: Facebook removed all of that after reducing number of object types to bare minimum
if (false && ($sefConfig->ogEnableLocation && $customData->og_enable_location == SH404SEF_OPTION_VALUE_USE_DEFAULT || $customData->og_enable_location == SH404SEF_OPTION_VALUE_YES)) {
$content = empty($customData->og_latitude) ? $sefConfig->ogLatitude : $customData->og_latitude;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:latitude" content="' . $content . '" />';
}
$content = empty($customData->og_longitude) ? $sefConfig->ogLongitude : $customData->og_longitude;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:longitude" content="' . $content . '" />';
}
$content = empty($customData->og_street_address) ? $sefConfig->ogStreetAddress : $customData->og_street_address;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:street-address" content="' . $content . '" />';
}
$content = empty($customData->og_locality) ? $sefConfig->ogLocality : $customData->og_locality;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:locality" content="' . $content . '" />';
}
$content = empty($customData->og_postal_code) ? $sefConfig->ogPostalCode : $customData->og_postal_code;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:postal-code" content="' . $content . '" />';
}
$content = empty($customData->og_region) ? $sefConfig->ogRegion : $customData->og_region;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:region" content="' . $content . '" />';
}
$content = empty($customData->og_country_name) ? $sefConfig->ogCountryName : $customData->og_country_name;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:country-name" content="' . $content . '" />';
}
}
// insert contact
// disabled: Facebook removed all of that after reducing number of object types to bare minimum
if (false && ($sefConfig->ogEnableContact && $customData->og_enable_contact == SH404SEF_OPTION_VALUE_USE_DEFAULT || $customData->og_enable_contact == SH404SEF_OPTION_VALUE_YES)) {
$content = empty($customData->og_email) ? $sefConfig->ogEmail : $customData->og_email;
if (!empty($content)) {
$content = htmlspecialchars(shCleanUpDesc($content), ENT_COMPAT, 'UTF-8');
$openGraphData .= "\n" . ' <meta property="og:email" content="' . $content . '" />';
}
$content = empty($customData->og_phone_number) ? $sefConfig->ogPhoneNumber : $customData->og_phone_number;
//.........这里部分代码省略.........