本文整理汇总了PHP中Convert::raw2htmlname方法的典型用法代码示例。如果您正苦于以下问题:PHP Convert::raw2htmlname方法的具体用法?PHP Convert::raw2htmlname怎么用?PHP Convert::raw2htmlname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::raw2htmlname方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRaw2HtmlName
public function testRaw2HtmlName()
{
$val1 = 'test test 123';
$this->assertEquals('testtest123', Convert::raw2htmlname($val1));
}
示例2: get_menu_items
/**
* Get all menu entries.
*
* @return array
*/
public static function get_menu_items()
{
$menuItems = array();
// Set up default menu items
if (!self::$menu_is_cleared) {
$cmsClasses = self::get_cms_classes();
foreach ($cmsClasses as $cmsClass) {
$menuItem = self::menuitem_for_controller($cmsClass);
if ($menuItem) {
$menuItems[Convert::raw2htmlname(str_replace('\\', '-', $cmsClass))] = $menuItem;
}
}
}
// Apply changes
foreach (self::$menu_item_changes as $change) {
switch ($change['type']) {
case 'add':
$menuItems[$change['code']] = $change['item'];
break;
case 'remove':
unset($menuItems[$change['code']]);
break;
default:
user_error("Bad menu item change type {$change[type]}", E_USER_WARNING);
}
}
// Sort menu items according to priority, then title asc
$menuPriority = array();
$menuTitle = array();
foreach ($menuItems as $key => $menuItem) {
$menuPriority[$key] = is_numeric($menuItem->priority) ? $menuItem->priority : 0;
$menuTitle[$key] = $menuItem->title;
}
array_multisort($menuPriority, SORT_DESC, $menuTitle, SORT_ASC, $menuItems);
return $menuItems;
}
示例3: get_menu_code
/**
* Get menu code for class
*
* @param string $cmsClass Controller class name
* @return string
*/
public static function get_menu_code($cmsClass)
{
return Convert::raw2htmlname(str_replace('\\', '-', $cmsClass));
}
示例4: menu_icon_for_class
/**
* Return styling for the menu icon, if a custom icon is set for this class
*
* Example: static $menu-icon = '/path/to/image/';
* @param type $class
* @return string
*/
public static function menu_icon_for_class($class)
{
$icon = Config::inst()->get($class, 'menu_icon', Config::FIRST_SET);
if (!empty($icon)) {
$class = strtolower(Convert::raw2htmlname(str_replace('\\', '-', $class)));
return ".icon.icon-16.icon-{$class} { background: url('{$icon}'); } ";
}
return '';
}
示例5: getFormField
public function getFormField()
{
// Build label and css classes
$label = '';
$classes = $this->ExtraClass;
if (empty($this->Title) || $this->HideLabel) {
$classes .= " nolabel";
} else {
$label = "<label class='left'>{$this->EscapedTitle}</label>";
}
$field = new LiteralField("LiteralField[{$this->ID}]", sprintf("<div id='%s' class='field text%s'>\n\t\t\t\t\t%s\n\t\t\t\t\t<div class='middleColumn literalFieldArea'>%s</div>" . "</div>", Convert::raw2htmlname($this->Name), Convert::raw2att($classes), $label, $this->Content));
// When dealing with literal fields there is no further customisation that can be added at this point
return $field;
}