本文整理汇总了PHP中TextHelper::urlize方法的典型用法代码示例。如果您正苦于以下问题:PHP TextHelper::urlize方法的具体用法?PHP TextHelper::urlize怎么用?PHP TextHelper::urlize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextHelper
的用法示例。
在下文中一共展示了TextHelper::urlize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValue
function getValue($filtered = true)
{
$values = explode($this->separator, $this->_value);
$tags = array();
foreach ($values as &$value) {
$value = trim($value);
if ($value != '') {
if ($this->_filter && $filtered) {
$value = call_user_func($this->_filter, $value, $this->getName());
}
$tags[] = $value;
}
}
$ids = array();
foreach ($tags as $tag) {
$ds = new TableReader('blog_tag');
$id = $ds->select('blog_tag_id')->where('tag', $tag)->fetchScalar();
if (!$id) {
$writer = new TableWriter('blog_tag');
$id = $writer->insert(array('tag' => $tag, 'url_tag' => TextHelper::urlize($tag)));
}
$ids[] = $id;
}
return $ids;
}
示例2: parse
static function parse($path, $replacements = array(), &$substitutions = array())
{
$path = self::replaceUploadsDir($path);
$matches1 = array();
preg_match_all('/{(appd|uploads|public|random|date|root)(?:\\[([0-9a-zA-Z-_]+)\\])?}/', $path, $matches1, PREG_SET_ORDER);
$matches2 = array();
$expression = implode('|', array_keys($replacements));
preg_match_all('/{(' . $expression . ')(?:\\[([0-9a-zA-Z-_]+)\\])?}/', $path, $matches2, PREG_SET_ORDER);
$matches = array_merge($matches1, $matches2);
foreach ($matches as $match) {
if (isset($replacements[$match[1]])) {
$substitutions[$match[0]] = $replacements[$match[1]];
if (isset($match[2])) {
if (is_numeric($match[2])) {
$substitutions[$match[0]] = substr($substitutions[$match[0]], 0, $match[2]);
} elseif (is_callable($match[2])) {
$substitutions[$match[0]] = call_user_func($match[2], $substitutions[$match[0]]);
} elseif ($match[2] == 'url') {
$substitutions[$match[0]] = TextHelper::urlize($substitutions[$match[0]]);
}
}
} else {
$param = isset($match[2]) ? $match[2] : null;
$substitutions[$match[0]] = self::replace($match[1], $param);
}
}
return str_replace(array_keys($substitutions), array_values($substitutions), $path);
}
示例3: _putUrlEntry
function _putUrlEntry($values)
{
foreach ($values['cms_page_meta'] as $i => $cms_page_meta) {
$title = $values['cms_nav_item_name'][$i][0]['name'];
$this->db->into('cms_page_meta')->where('language_id', $cms_page_meta[0]['language_id'])->where('page_id', $cms_page_meta[0]['page_id'])->update(array('url_entry' => TextHelper::urlize($title), 'title' => $title));
}
}