当前位置: 首页>>代码示例>>PHP>>正文


PHP AkInflector::urlize方法代码示例

本文整理汇总了PHP中AkInflector::urlize方法的典型用法代码示例。如果您正苦于以下问题:PHP AkInflector::urlize方法的具体用法?PHP AkInflector::urlize怎么用?PHP AkInflector::urlize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AkInflector的用法示例。


在下文中一共展示了AkInflector::urlize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processIndex

 public function processIndex($string, $current_level = 3, $counters = array(1))
 {
     if (!is_array($string)) {
         $s = explode("\n", $string);
     } else {
         $s = $string;
     }
     $level_array = array();
     while (!empty($s)) {
         $line = array_shift($s);
         if (preg_match('/^h([0-9])\\.(.+)$/', $line, $matches)) {
             $title = $matches[2];
             $level = intval($matches[1]);
             if ($level < $current_level) {
                 return $level_array;
             } elseif ($level == $current_level) {
                 $index = join('.', $counters);
                 $bookmark = preg_replace('/^a-z0-9-/', '', str_replace('_', '-', AkInflector::urlize($title)));
                 $this->_result = str_replace($matches[0], "h{$level}(#{$bookmark}). {$index}{$title}", $this->_result);
                 if (count($counters) <= 2) {
                     $this->toc[$counters[0]][] = array('title' => $title, 'id' => $bookmark, 'index' => $index);
                 }
                 $counters[] = 1;
                 $level_array[] = $this->processIndex($s, $current_level + 1, $counters);
                 array_pop($counters);
                 // Increment the current level
                 $last = array_pop($counters);
                 $counters[] = $last + 1;
             }
         }
     }
     return $level_array;
 }
开发者ID:bermi,项目名称:akelos,代码行数:33,代码来源:docs_helper.php

示例2: _render_menu

    function _render_menu($type)
    {
        $controller =& $this->_controller;
        $current_controller = AkInflector::urlize($controller->getControllerName());
        $current_action = !empty($controller->params['action'])?$controller->params['action']:'';
        $menu_options = $this->_getMenuOptions($type);
        $result = '';
        $i = 0;
        foreach ($menu_options as $k=>$menu_option) {
            $i++;

            $is_active = (@$controller->{"{$type}_selected_tab"} == $k || $current_controller == $menu_option['url']['controller'] && (
            $type == 'admin' || (
            empty($menu_option['url']['action']) || $current_action == $menu_option['url']['action'])
            ) ? true : false);

            //$is_active ? $controller->capture_helper->_addVarToView("{$type}_selected_tab", $k) : null;

            if(!empty($menu_option['url'])){
                $list_item_options = array(
                'id' => $menu_option['id'].'_link',
                'class' => 'tab'.($is_active?' active':'')
                );
            }else{
                trigger_error($this->t('You need to provide a valid URL for the menu tab.', E_USER_ERROR));
            }


            $show_tab = false;
            if(is_string($menu_option['url'])){
                $show_tab = $this->can($k.' ('.$menu_option['url'].')', 'Admin Menu Tabs');
            }elseif(empty($menu_option['url']['action'])){
                $show_tab = $this->can($k.' ('.$menu_option['url']['controller'].' controller)', 'Admin Menu Tabs');
            }else{
                $show_tab = $this->can($k.' ('.$menu_option['url']['controller'].' controller, '.$menu_option['url']['action'].' action)', 'Admin Menu Tabs');
            }

            if(empty($show_tab)){
                continue;
            }

            $link_options = (array)@$menu_option['link_options'];
            if($type == 'controller' && !isset($link_options['accesskey'])){
                $link_options['accesskey'] = $i;
            }

            $access_key_info = isset($link_options['accesskey']) ? ' '.$this->t('(Access key: %key)', array('%key'=>$link_options['accesskey'])) : '';

            isset($link_options['title']) ? $link_options['title'] = $this->t($link_options['title']).$access_key_info : null;
            !empty($access_key_info) && empty($link_options['title']) ? $link_options['title'] = trim($access_key_info,"() ") : null;

            $result .= $controller->tag_helper->content_tag('li',
            $controller->url_helper->link_to($this->t($k), $menu_option['url'], $link_options), $list_item_options);
        }
        return empty($result) ? '' : '<ul id="'.$type.'_menu">'.$result.'</ul>';
    }
开发者ID:joeymetal,项目名称:v1,代码行数:56,代码来源:admin_helper.php

示例3: slugize

 static function slugize($text)
 {
     return str_replace('_', '-', AkInflector::urlize($text));
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:inflector.php

示例4: urlize

 function urlize($text)
 {
     return AkInflector::urlize($text);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:layout_helper.php


注:本文中的AkInflector::urlize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。