本文整理汇总了PHP中SEFTools::clipDesc方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::clipDesc方法的具体用法?PHP SEFTools::clipDesc怎么用?PHP SEFTools::clipDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::clipDesc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMetaTags
/**
* Get metatags.
* If they do not exist, generate new.
*
* @return array
*/
function getMetaTags()
{
$sefConfig = SEFConfig::getConfig();
// clean source of meta description
if (!empty($this->metadesc)) {
$cleanDesc = SEFTools::cleanDesc($this->metadesc);
} else {
$cleanDesc = '';
}
// clean source of meta keywords
if (!empty($this->metakeySource)) {
$cleanKeySource = SEFTools::cleanDesc($this->metakeySource);
} else {
$cleanKeySource = $cleanDesc;
}
// generate own meta description if set to by extension and global configuration
if ($this->params->get('meta_desc', '1') && ($sefConfig->metadata_auto == _COM_SEF_META_GEN_ALWAYS || $sefConfig->metadata_auto == _COM_SEF_META_GEN_EMPTY && strlen($this->origmetadesc) == 0)) {
// get generation params
$maxLen = $this->params->get('desc_len', '250');
// generate description
$this->metatags['metadesc'] = SEFTools::clipDesc($cleanDesc, $maxLen);
} else {
$this->metatags['metadesc'] = $this->origmetadesc;
}
// generate own meta keywords if set to by extension and global configuration
if ($this->params->get('meta_keys', '1') && ($sefConfig->metadata_auto == _COM_SEF_META_GEN_ALWAYS || $sefConfig->metadata_auto == _COM_SEF_META_GEN_EMPTY && strlen($this->origmetakey) == 0)) {
// get generation params
$minLen = $this->params->get('keys_minlen', '3');
$count = $this->params->get('keys_count', '8');
$blacklist = $this->params->get('blacklist', null);
// generate keywords
$this->metatags['metakey'] = SEFTools::generateKeywords($cleanKeySource, $blacklist, $count, $minLen);
} else {
$this->metatags['metakey'] = $this->origmetakey;
}
return $this->metatags;
}
示例2: getMetaTags
function getMetaTags()
{
$metatags = array();
if (!empty($this->metadesc)) {
$cleanDesc = SEFTools::cleanDesc($this->metadesc);
}
if ($this->params->get('meta_desc', '1') && isset($cleanDesc)) {
$maxLen = $this->params->get('desc_len', '250');
$metatags['metadesc'] = SEFTools::clipDesc($cleanDesc, $maxLen);
}
if ($this->params->get('meta_keys', '1') && isset($cleanDesc)) {
$minLen = $this->params->get('keys_minlen', '3');
$count = $this->params->get('keys_count', '15');
$blacklist = $this->params->get('blacklist', null);
$metatags['metakey'] = SEFTools::generateKeywords($cleanDesc, $blacklist, $count, $minLen);
}
return $metatags;
}