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


PHP AkInflector::toControllerFilename方法代码示例

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


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

示例1: cast

 function cast()
 {
     $this->model_name = AkInflector::camelize($this->model_name);
     $this->model_file_path = AkInflector::toModelFilename($this->model_name);
     if (empty($this->actions) && !empty($this->controller_name) && strstr($this->controller_name, ',')) {
         $this->controller_name = '';
     }
     $this->controller_name = empty($this->controller_name) ? AkInflector::pluralize($this->model_name) : AkInflector::camelize($this->controller_name);
     $this->controller_file_path = AkInflector::toControllerFilename($this->controller_name);
     $this->controller_class_name = str_replace(array('/', '::'), '_', $this->controller_name . 'Controller');
     $this->controller_name = AkInflector::demodulize($this->controller_name);
     $this->controller_human_name = AkInflector::humanize($this->controller_name);
     $this->helper_name = (AkInflector::is_plural($this->controller_name) ? AkInflector::singularize($this->controller_name) : $this->controller_name) . 'Helper';
     $this->helper_var_name = '$' . AkInflector::underscore($this->helper_name);
     $this->singular_name = AkInflector::underscore($this->model_name);
     $this->plural_name = AkInflector::pluralize($this->singular_name);
     $this->singular_controller_name = AkInflector::underscore($this->controller_name);
     $this->module_preffix = AkInflector::underscore(substr($this->controller_class_name, 0, strrpos($this->controller_class_name, '_')));
     $this->module_preffix = empty($this->module_preffix) ? '' : DS . $this->module_preffix;
     $this->files = array('controller.php' => $this->controller_file_path, 'helper.php' => AK_HELPERS_DIR . $this->module_preffix . DS . trim($this->helper_var_name, '$') . '.php', 'layout' => AK_VIEWS_DIR . DS . 'layouts' . DS . $this->singular_controller_name . '.tpl', 'view_add' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'add.tpl', 'view_destroy' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'destroy.tpl', 'view_edit' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'edit.tpl', 'view_listing' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'listing.tpl', 'view_show' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'show.tpl', 'form' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . '_form.tpl');
     $this->user_actions = array();
     foreach ((array) @$this->actions as $action) {
         $this->user_actions[$action] = AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . $action . '.tpl';
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:25,代码来源:scaffold_generator.php

示例2: cast

    function cast()
    {
        $this->model_name = AkInflector::camelize($this->model_name);
        $this->model_file_path = AkInflector::toModelFilename($this->model_name);
        $this->controller_name = empty($this->controller_name) ? $this->model_name : (AkInflector::camelize($this->controller_name));
        $this->controller_file_path = AkInflector::toControllerFilename($this->controller_name);
        $this->controller_class_name = $this->controller_name.'Controller';
        $this->controller_human_name = AkInflector::humanize($this->controller_name);
        $this->helper_var_name = '$'.AkInflector::underscore($this->controller_name).'_helper';

        $this->singular_name = AkInflector::underscore($this->model_name);
        $this->plural_name = AkInflector::pluralize($this->singular_name);
        $this->singular_controller_name = AkInflector::underscore($this->controller_name);

        $this->files = array(
        'controller.php' => $this->controller_file_path,
        /**
         * @todo Implement generic functional tests
         */
        // 'functional_test.php' => AK_TEST_DIR.DS.'functional'.DS.'test_'.$this->controller_class_name.'.php',
        'helper.php' => AK_HELPERS_DIR.DS.trim($this->helper_var_name,'$').'.php',
        'layout' => AK_VIEWS_DIR.DS.'layouts'.DS.$this->singular_controller_name.'.tpl',
        'view_add' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'add.tpl',
        'view_destroy' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'destroy.tpl',
        'view_edit' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'edit.tpl',
        'view_listing' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'listing.tpl',
        'view_show' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'show.tpl',
        'form' => AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.'_form.tpl',
        );

        $this->user_actions = array();
        foreach ((array)@$this->actions as $action){
            $this->user_actions[$action] = AK_VIEWS_DIR.DS.$this->singular_controller_name.DS.$action.'.tpl';
        }
    }
开发者ID:joeymetal,项目名称:v1,代码行数:35,代码来源:scaffold_generator.php

示例3: menu_for_controllers

 function menu_for_controllers($menu_options = array())
 {
     $menu_options = empty($menu_options) ? $this->_get_default_full_menu() : $menu_options;
     $menu = '';
     foreach ($menu_options as $controller => $actions) {
         $controller_name = AkInflector::classify($controller);
         $current_controller_name = $this->_controller->getControllerName();
         $current_action_name = $this->_controller->Request->getAction();
         $controller_class_name = $controller_name . 'Controller';
         $controller_human_name = AkInflector::humanize($controller);
         $controller_file_name = AkInflector::toControllerFilename($controller);
         if (file_exists($controller_file_name)) {
             include_once $controller_file_name;
             if (class_exists($controller_class_name)) {
                 $menu_header = TagHelper::content_tag('h2', TagHelper::content_tag('a', $controller_human_name, array('href' => $this->_controller->urlFor(array('controller' => $controller)))), array('class' => $current_controller_name == $controller_name ? 'current' : ''));
                 $submenu = '';
                 foreach ((array) $actions as $action) {
                     if ($action[0] == '_') {
                         continue;
                     }
                     $submenu .= TagHelper::content_tag('li', TagHelper::content_tag('a', AkInflector::humanize($action), array('href' => $this->_controller->urlFor(array('controller' => $controller, 'action' => $action)))), array('class' => $current_controller_name == $controller_name && $current_action_name == $action ? 'current' : ''));
                 }
                 $menu .= !empty($submenu) ? TagHelper::content_tag('ul', TagHelper::content_tag('li', $menu_header . TagHelper::content_tag('ul', $submenu))) : '';
             }
         }
     }
     return TagHelper::content_tag('div', $menu, array('id' => 'menu'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:28,代码来源:menu_helper.php

示例4: _setupCloner

 function _setupCloner()
 {
     $this->clone_setup_done = true;
     $this->class_to_clone = AkInflector::underscore($this->class_to_clone);
     $this->class_name = AkInflector::underscore($this->class_name);
     $this->clone_replacements = array(AkInflector::camelize($this->class_to_clone) . 'Controller' => AkInflector::camelize($this->class_name) . 'Controller', AkInflector::humanize(AkInflector::pluralize($this->class_to_clone)) => AkInflector::humanize(AkInflector::pluralize($this->class_name)), AkInflector::titleize(AkInflector::pluralize($this->class_to_clone)) => AkInflector::titleize(AkInflector::pluralize($this->class_name)), AkInflector::humanize($this->class_to_clone) => AkInflector::humanize($this->class_name), AkInflector::titleize($this->class_to_clone) => AkInflector::titleize($this->class_name), AkInflector::camelize(AkInflector::pluralize($this->class_to_clone)) => AkInflector::camelize(AkInflector::pluralize($this->class_name)), AkInflector::pluralize($this->class_to_clone) => AkInflector::pluralize($this->class_name), AkInflector::camelize($this->class_to_clone) => AkInflector::camelize($this->class_name), $this->class_to_clone => $this->class_name);
     //AK_VIEWS_DIR.DS.AkInflector::underscore($this->class_name).DS.$action.'.tpl'
     $this->files_to_clone = array(AkInflector::toModelFilename($this->class_to_clone) => AkInflector::toModelFilename($this->class_name), AK_TEST_DIR . DS . 'unit' . DS . 'test_' . $this->class_to_clone . '.php' => AK_TEST_DIR . DS . 'unit' . DS . 'test_' . $this->class_name . '.php', AK_TEST_DIR . DS . 'fixtures' . DS . AkInflector::tableize($this->class_to_clone) . '.yml' => AK_TEST_DIR . DS . 'fixtures' . DS . AkInflector::tableize($this->class_name) . '.yml', AkInflector::toControllerFilename($this->class_to_clone) => AkInflector::toControllerFilename($this->class_name), AK_TEST_DIR . DS . 'functional' . DS . 'test_' . AkInflector::camelize($this->class_to_clone . '_controller') . '.php' => AK_TEST_DIR . DS . 'functional' . DS . 'test_' . AkInflector::camelize($this->class_name . '_controller') . '.php', AK_HELPERS_DIR . DS . AkInflector::underscore("{$this->class_to_clone}_helper") . '.php' => AK_HELPERS_DIR . DS . AkInflector::underscore("{$this->class_name}_helper") . '.php');
     foreach ($this->_getControllerViews() as $view_file) {
         $this->files_to_clone[AK_VIEWS_DIR . DS . $this->class_to_clone . DS . $view_file . '.tpl'] = AK_VIEWS_DIR . DS . $this->class_name . DS . $view_file . '.tpl';
     }
     $this->files_to_clone[AK_VIEWS_DIR . DS . 'layouts' . DS . $this->class_to_clone . '.tpl'] = AK_VIEWS_DIR . DS . 'layouts' . DS . $this->class_name . '.tpl';
     foreach (Ak::dir(AK_APP_DIR . DS . 'locales' . DS . $this->class_to_clone, array('dirs' => false)) as $locale_file) {
         $this->files_to_clone[AK_APP_DIR . DS . 'locales' . DS . $this->class_to_clone . DS . $locale_file] = AK_APP_DIR . DS . 'locales' . DS . $this->class_name . DS . $locale_file;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:16,代码来源:clone_generator.php

示例5: _setDefaults

 private function _setDefaults()
 {
     $this->class_name = AkInflector::camelize($this->class_name);
     $this->table_name = AkInflector::tableize($this->class_name);
     $this->file_name = AkInflector::underscore($this->class_name);
     $this->controller_class_name = AkInflector::pluralize($this->class_name);
     $this->controller_file_name = AkInflector::toControllerFilename($this->controller_class_name);
     $this->table_columns = trim(join(' ', (array) @$this->table_columns));
     $this->assignVarToTemplate('attributes', $this->_getModelAttributesForViews());
     $this->assignVarToTemplate('class_name', $this->class_name);
     $this->assignVarToTemplate('table_name', $this->table_name);
     $this->assignVarToTemplate('plural_name', $this->table_name);
     $this->assignVarToTemplate('singular_name', AkInflector::singularize($this->table_name));
     $this->assignVarToTemplate('file_name', $this->file_name);
     $this->assignVarToTemplate('table_columns', $this->table_columns);
     $this->assignVarToTemplate('controller_class_name', $this->controller_class_name);
 }
开发者ID:bermi,项目名称:akelos,代码行数:17,代码来源:scaffold_controller_generator.php

示例6: menu_for_controllers

 /**
  * Returns a menu for all or several actions in all or several controllers.
  *
  * Let +menu_options+ defaults and this will generate a menu with all actions in all controllers.
  * Set +menu_options+ to an array with keys as controller name and values as actions names.
  *
  * <?php echo $menu_helper->menu_for_controllers(array('advertiser' => array('buy', 'partial_in_template'))); ?>
  * will generate something like :
  * <div id="menu">
  *  <ul>
  *   <li>
  *    <h2><a href="/advertiser">Advertiser</a></h2>
  *    <ul>
  *     <li><a href="/advertiser/buy">Buy</a></li>
  *     <li><a href="/advertiser/partial_in_template">Partial in template</a></li>
  *    </ul>
  *   </li>
  *  </ul>
  * </div>
  *
  * +div_menu_id+: the id of the main div (default is "menu")
  * +current_class+: the class name of the current controller or the current action (default is "current")
  * +title_tag+: the tag that will contain the controller name link (default is "h2"). If it's empty, it won't be present
  */
 public function menu_for_controllers($menu_options = array(), $div_menu_id = 'menu', $current_class = 'current', $title_tag = 'h2')
 {
     $menu_options = empty($menu_options) ? $this->_get_default_full_menu() : $menu_options;
     $menu = '';
     foreach ($menu_options as $controller => $actions) {
         $controller_name = AkInflector::classify($controller);
         $current_controller_name = $this->_controller->getControllerName();
         $current_action_name = $this->_controller->Request->getAction();
         $controller_class_name = $controller_name . 'Controller';
         $controller_human_name = AkInflector::humanize($controller);
         $controller_file_name = AkInflector::toControllerFilename($controller);
         if (file_exists($controller_file_name)) {
             include_once $controller_file_name;
             if (class_exists($controller_class_name)) {
                 $class = $current_controller_name == $controller_name ? array('class' => $current_class) : array();
                 $href = array('href' => $this->_controller->urlFor(array('controller' => $controller)));
                 if (empty($title_tag)) {
                     $_title_tag = 'a';
                     $content = $controller_human_name;
                     $options = array_merge($class, $href);
                 } else {
                     $content = AkTagHelper::content_tag('a', $controller_human_name, $href);
                     $options = $class;
                     $_title_tag = $title_tag;
                 }
                 $menu_header = AkTagHelper::content_tag($_title_tag, $content, $options);
                 $submenu = '';
                 foreach ((array) $actions as $action) {
                     if ($action[0] == '_') {
                         continue;
                     }
                     $submenu .= AkTagHelper::content_tag('li', AkTagHelper::content_tag('a', AkInflector::humanize($action), array('href' => $this->_controller->urlFor(array('controller' => $controller, 'action' => $action)))), $current_controller_name == $controller_name && $current_action_name == $action ? array('class' => $current_class) : array());
                 }
                 $menu .= !empty($submenu) ? AkTagHelper::content_tag('ul', AkTagHelper::content_tag('li', $menu_header . AkTagHelper::content_tag('ul', $submenu))) : '';
             }
         }
     }
     return AkTagHelper::content_tag('div', $menu, array('id' => $div_menu_id));
 }
开发者ID:bermi,项目名称:akelos,代码行数:63,代码来源:ak_menu_helper.php

示例7: test_should_get_controller_file_name

 function test_should_get_controller_file_name()
 {
     $this->assertEqual(AkInflector::toControllerFilename('admin'), AK_CONTROLLERS_DIR . DS . 'admin_controller.php');
     $this->assertEqual(AkInflector::toControllerFilename('user_authentication'), AK_CONTROLLERS_DIR . DS . 'user_authentication_controller.php');
     $this->assertEqual(AkInflector::toControllerFilename('admin/users'), AK_CONTROLLERS_DIR . DS . 'admin' . DS . 'users_controller.php');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:6,代码来源:AkInflector.php

示例8: test_should_get_controller_file_name

 public function test_should_get_controller_file_name()
 {
     $this->assertEqual(AkInflector::toControllerFilename('admin'), AkConfig::getDir('controllers') . DS . 'admin_controller.php');
     $this->assertEqual(AkInflector::toControllerFilename('user_authentication'), AkConfig::getDir('controllers') . DS . 'user_authentication_controller.php');
     $this->assertEqual(AkInflector::toControllerFilename('admin/users'), AkConfig::getDir('controllers') . DS . 'admin' . DS . 'users_controller.php');
 }
开发者ID:bermi,项目名称:akelos,代码行数:6,代码来源:inflector.php

示例9: akelos_autoload

function akelos_autoload($name, $path = null)
{
    static $paths = array(), $lib_paths = array(), $app_paths = array();
    if (!empty($path)) {
        $paths[$name] = $path;
        return;
    }
    if (empty($app_paths)) {
        $app_paths = array('BaseActionController' => 'controllers/base_action_controller.php', 'BaseActiveRecord' => 'models/base_active_record.php', 'ApplicationController' => 'controllers/application_controller.php', 'ActiveRecord' => 'models/active_record.php');
    }
    if (empty($lib_paths)) {
        $lib_paths = array('AkActionMailer' => 'action_mailer/base.php', 'AkMailComposer' => 'action_mailer/composer.php', 'AkMailEncoding' => 'action_mailer/encoding.php', 'AkMailBase' => 'action_mailer/mail_base.php', 'AkMailMessage' => 'action_mailer/message.php', 'AkMailParser' => 'action_mailer/parser.php', 'AkMailPart' => 'action_mailer/part.php', 'AkActionMailerQuoting' => 'action_mailer/quoting.php', 'AkActionController' => 'action_pack/action_controller.php', 'AkExceptionDispatcher' => 'action_pack/exception_dispatcher.php', 'AkActionView' => 'action_pack/action_view.php', 'AkBaseHelper' => 'action_pack/base_helper.php', 'AkActionViewHelper' => 'action_pack/base_helper.php', 'AkCacheHandler' => 'action_pack/cache_handler.php', 'AkCacheSweeper' => 'action_pack/cache_sweeper.php', 'AkActionControllerTest' => 'action_pack/testing.php', 'AkHelperTest' => 'action_pack/testing.php', 'AkDbSession' => 'action_pack/db_session.php', 'AkCookieStore' => 'action_pack/cookie_store.php', 'AkDispatcher' => 'action_pack/dispatcher.php', 'AkActiveRecordHelper' => 'action_pack/helpers/ak_active_record_helper.php', 'AkAssetTagHelper' => 'action_pack/helpers/ak_asset_tag_helper.php', 'AkFormHelperBuilder' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelperInstanceTag' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelper' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelperOptionsInstanceTag' => 'action_pack/helpers/ak_form_options_helper.php', 'AkFormTagHelper' => 'action_pack/helpers/ak_form_tag_helper.php', 'AkJavascriptHelper' => 'action_pack/helpers/ak_javascript_helper.php', 'AkJavascriptMacrosHelper' => 'action_pack/helpers/ak_javascript_macros_helper.php', 'AkMailHelper' => 'action_pack/helpers/ak_mail_helper.php', 'AkMenuHelper' => 'action_pack/helpers/ak_menu_helper.php', 'AkNumberHelper' => 'action_pack/helpers/ak_number_helper.php', 'AkPaginationHelper' => 'action_pack/helpers/ak_pagination_helper.php', 'AkPrototypeHelper' => 'action_pack/helpers/ak_prototype_helper.php', 'AkScriptaculousHelper' => 'action_pack/helpers/ak_scriptaculous_helper.php', 'AkTextHelper' => 'action_pack/helpers/ak_text_helper.php', 'AkUrlHelper' => 'action_pack/helpers/ak_url_helper.php', 'AkXmlHelper' => 'action_pack/helpers/ak_xml_helper.php', 'AkHelperLoader' => 'action_pack/helper_loader.php', 'AkPaginator' => 'action_pack/pagination.php', 'AkPhpCodeSanitizer' => 'action_pack/php_code_sanitizer.php', 'AkPhpTemplateHandler' => 'action_pack/php_template_handler.php', 'AkRequest' => 'action_pack/request.php', 'AkResponse' => 'action_pack/response.php', 'AkRouter' => 'action_pack/router/base.php', 'AkDynamicSegment' => 'action_pack/router/dynamic_segment.php', 'AkLangSegment' => 'action_pack/router/lang_segment.php', 'AkRoute' => 'action_pack/router/route.php', 'AkRouterConfig' => 'action_pack/router/router_config.php', 'AkRouterHelper' => 'action_pack/router/router_helper.php', 'AkSegment' => 'action_pack/router/segment.php', 'AkStaticSegment' => 'action_pack/router/static_segment.php', 'AkUrl' => 'action_pack/router/url.php', 'AkUrlWriter' => 'action_pack/router/url_writer.php', 'AkVariableSegment' => 'action_pack/router/variable_segment.php', 'AkWildcardSegment' => 'action_pack/router/wildcard_segment.php', 'AkResource' => 'action_pack/router/resources.php', 'AkResources' => 'action_pack/router/resources.php', 'AkSingletonResource' => 'action_pack/router/resources.php', 'AkSession' => 'action_pack/session.php', 'AkStream' => 'action_pack/stream.php', 'AkSintags' => 'action_pack/template_engines/sintags/base.php', 'AkSintagsLexer' => 'action_pack/template_engines/sintags/lexer.php', 'AkSintagsParser' => 'action_pack/template_engines/sintags/parser.php', 'AkXhtmlValidator' => 'action_pack/xhtml_validator.php', 'AkActionWebService' => 'action_pack/action_web_service.php', 'AkActionWebserviceApi' => 'action_pack/action_web_service/api.php', 'AkActionWebServiceClient' => 'action_pack/action_web_service/client.php', 'AkActionWebServiceServer' => 'action_pack/action_web_service/server.php', 'AkActiveRecord' => 'active_record/base.php', 'AkDbAdapter' => 'active_record/adapters/base.php', 'AkAssociatedActiveRecord' => 'active_record/associated_active_record.php', 'AkAssociation' => 'active_record/associations/base.php', 'AkBelongsTo' => 'active_record/associations/belongs_to.php', 'AkHasAndBelongsToMany' => 'active_record/associations/has_and_belongs_to_many.php', 'AkHasMany' => 'active_record/associations/has_many.php', 'AkHasOne' => 'active_record/associations/has_one.php', 'AkDbSchemaCache' => 'active_record/database_schema_cache.php', 'AkActiveRecordMock' => 'active_record/mock.php', 'AkObserver' => 'active_record/observer.php', 'AkHttpClient' => 'active_resource/http_client.php', 'AkAdodbCache' => 'active_support/cache/adodb.php', 'AkCache' => 'active_support/cache/base.php', 'AkMemcache' => 'active_support/cache/memcache.php', 'AkColor' => 'active_support/color/base.php', 'AkConsole' => 'active_support/console/base.php', 'AkAnsiColor' => 'active_support/console/ansi.php', 'AkConfig' => 'active_support/config/base.php', 'AkClassExtender' => 'active_support/core/class_extender.php', 'AkDebug' => 'active_support/core/debug.php', 'AkLazyObject' => 'active_support/core/lazy_object.php', 'AkArray' => 'active_support/core/types/array.php', 'AkType' => 'active_support/core/types/base.php', 'AkDate' => 'active_support/core/types/date.php', 'AkMimeType' => 'active_support/core/types/mime.php', 'AkNumber' => 'active_support/core/types/number.php', 'AkString' => 'active_support/core/types/string.php', 'AkTime' => 'active_support/core/types/time.php', 'AkFileSystem' => 'active_support/file_system/base.php', 'AkelosGenerator' => 'active_support/generator.php', 'AkCharset' => 'active_support/i18n/charset/base.php', 'AkCountries' => 'active_support/i18n/countries.php', 'AkLocaleManager' => 'active_support/i18n/locale_manager.php', 'AkTimeZone' => 'active_support/i18n/time_zone.php', 'AkImage' => 'active_support/image/base.php', 'AkImageColorScheme' => 'active_support/image/color_scheme.php', 'AkImageFilter' => 'active_support/image/filters/base.php', 'AkLogger' => 'active_support/logger.php', 'AkInstaller' => 'active_support/migrations/installer.php', 'AkBaseModel' => 'active_support/models/base.php', 'AkModelExtenssion' => 'active_support/models/base.php', 'AkFtp' => 'active_support/network/ftp.php', 'AkPlugin' => 'active_support/plugin/base.php', 'AkPluginLoader' => 'active_support/plugin/base.php', 'AkPluginInstaller' => 'active_support/plugin/installer.php', 'AkPluginManager' => 'active_support/plugin/manager.php', 'AkProfiler' => 'active_support/profiler.php', 'AkReflection' => 'active_support/reflection/base.php', 'AkReflectionClass' => 'active_support/reflection/class.php', 'AkReflectionDocBlock' => 'active_support/reflection/doc_block.php', 'AkReflectionFile' => 'active_support/reflection/file.php', 'AkReflectionFunction' => 'active_support/reflection/function.php', 'AkReflectionMethod' => 'active_support/reflection/method.php', 'AkTestApplication' => 'active_support/testing/application.php', 'AkelosTextReporter' => 'active_support/testing/base.php', 'AkelosVerboseTextReporter' => 'active_support/testing/base.php', 'AkXUnitXmlReporter' => 'active_support/testing/base.php', 'AkUnitTest' => 'active_support/testing/base.php', 'AkWebTestCase' => 'active_support/testing/base.php', 'AkTestDispatcher' => 'active_support/testing/dispatcher.php', 'AkTestRequest' => 'active_support/testing/request.php', 'AkTestResponse' => 'active_support/testing/response.php', 'AkUnitTestSuite' => 'active_support/testing/suite.php', 'AkRouterUnitTest' => 'active_support/testing/router.php', 'AkRouteUnitTest' => 'active_support/testing/route.php', 'AkControllerUnitTest' => 'active_support/testing/controller.php', 'AkInflector' => 'active_support/text/inflector.php', 'AkLexer' => 'active_support/text/lexer.php', 'AkError' => 'active_support/error_handlers/base.php', 'AkActiveDocument' => 'active_document/base.php', 'AkOdbAdapter' => 'active_document/adapters/base.php');
    }
    if (isset($lib_paths[$name])) {
        include AK_FRAMEWORK_DIR . DS . $lib_paths[$name];
        return;
    }
    if (isset($app_paths[$name])) {
        $file_path = AkConfig::getDir('app') . DS . $app_paths[$name];
        if (file_exists($file_path)) {
            include $file_path;
            return;
        }
    }
    if (isset($paths[$name])) {
        include $paths[$name];
    } elseif (file_exists(DS . $name . '.php')) {
        include DS . $name . '.php';
    } else {
        $underscored_name = AkInflector::underscore($name);
        if (!Ak::import($name)) {
            if (strstr($name, 'Helper')) {
                $file_path = AkConfig::getDir('helpers') . DS . $underscored_name . '.php';
                if (!file_exists($file_path)) {
                    $file_path = AK_ACTION_PACK_DIR . DS . 'helpers' . DS . $underscored_name . '.php';
                    if (!file_exists($file_path)) {
                        $file_path = AK_ACTION_PACK_DIR . DS . 'helpers' . DS . 'ak_' . $underscored_name . '.php';
                        if (include_once $file_path) {
                            eval('class ' . $name . ' extends Ak' . $name . '{}');
                            return;
                        }
                    }
                }
            } elseif (strstr($name, 'Installer')) {
                $file_path = AkConfig::getDir('app_installers') . DS . $underscored_name . '.php';
            } elseif (strstr($name, 'Controller')) {
                $file_path = AkInflector::toControllerFilename($name);
            }
        }
    }
    if (isset($file_path) && file_exists($file_path)) {
        include $file_path;
    }
}
开发者ID:bermi,项目名称:akelos,代码行数:54,代码来源:autoload.php


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