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


PHP AkInflector::demodulize方法代码示例

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


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

示例1: instantiateHelpersAsHandlerAttributes

 function instantiateHelpersAsHandlerAttributes($helpers = array())
 {
     foreach ($helpers as $file => $helper) {
         $helper_class_name = AkInflector::camelize(AkInflector::demodulize(strstr($helper, 'Helper') ? $helper : $helper . 'Helper'));
         $helper_file_name = AkInflector::underscore($helper_class_name);
         if (is_int($file)) {
             $file = AK_HELPERS_DIR . DS . $helper_file_name . '.php';
         }
         $full_path = preg_match('/[\\\\\\/]+/', $file);
         $file_path = $full_path ? $file : AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . $file;
         if (is_file($file_path)) {
             include_once $file_path;
         }
         if (class_exists($helper_class_name)) {
             $attribute_name = $full_path ? $helper_file_name : substr($file, 0, -4);
             $this->_Handler->{$attribute_name} = new $helper_class_name(&$this->_Handler);
             if (method_exists($this->_Handler->{$attribute_name}, 'setController')) {
                 $this->_Handler->{$attribute_name}->setController(&$this->_Handler);
             } elseif (method_exists($this->_Handler->{$attribute_name}, 'setMailer')) {
                 $this->_Handler->{$attribute_name}->setMailer(&$this->_Handler);
             }
             if (method_exists($this->_Handler->{$attribute_name}, 'init')) {
                 $this->_Handler->{$attribute_name}->init();
             }
             $this->_HelperInstances[$attribute_name] =& $this->_Handler->{$attribute_name};
         }
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:28,代码来源:AkHelperLoader.php

示例2: 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

示例3: instantiateHelpersAsHandlerAttributes

 public function instantiateHelpersAsHandlerAttributes($helpers = array())
 {
     $helpers_dir = AkConfig::getDir('helpers');
     foreach ($helpers as $file => $helper) {
         if (empty($helper)) {
             continue;
         }
         $helper_class_name = AkInflector::camelize(AkInflector::demodulize(strstr($helper, 'Helper') ? $helper : $helper . 'Helper'));
         $helper_file_name = AkInflector::underscore($helper_class_name);
         if (is_int($file)) {
             $file = $helpers_dir . DS . $helper_file_name . '.php';
         }
         $full_path = preg_match('/[\\\\\\/]+/', $file);
         $file_path = $full_path ? $file : AK_ACTION_PACK_DIR . DS . 'helpers' . DS . $file;
         if (is_file($file_path)) {
             include_once $file_path;
         }
         if (class_exists($helper_class_name)) {
             $attribute_name = $full_path ? $helper_file_name : substr($file, 0, -4);
             $this->_Handler->{$attribute_name} = new $helper_class_name($this->_Handler);
             if (method_exists($this->_Handler->{$attribute_name}, 'setController')) {
                 $this->_Handler->{$attribute_name}->setController($this->_Handler);
             } elseif (method_exists($this->_Handler->{$attribute_name}, 'setMailer')) {
                 $this->_Handler->{$attribute_name}->setMailer($this->_Handler);
             }
             if (method_exists($this->_Handler->{$attribute_name}, 'init')) {
                 $this->_Handler->{$attribute_name}->init();
             }
             $this->_HelperInstances[$attribute_name] = $this->_Handler->{$attribute_name};
         }
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:32,代码来源:helper_loader.php

示例4: foreignKey

 /**
 * Returns $class_name in underscored form, with "_id" tacked on at the end. 
 * This is for use in dealing with the database.
 * 
 * @param string $class_name
 * @return string
 */
 function foreignKey($class_name, $separate_class_name_and_id_with_underscore = true)
 {
     return AkInflector::underscore(AkInflector::demodulize($class_name)).($separate_class_name_and_id_with_underscore ? "_id" : "id");
 }
开发者ID:joeymetal,项目名称:v1,代码行数:11,代码来源:AkInflector.php

示例5: instantiateHelpers

 /**
  * Creates an instance of each available helper and links it into into current controller.
  * 
  * Per example, if a helper TextHelper is located into the file text_helper.php. 
  * An instance is created on current controller
  * at $this->text_helper. This instance is also available on the view by calling $text_helper.
  * 
  * Helpers can be found at lib/AkActionView/helpers (this might change in a future)
  */
 function instantiateHelpers()
 {
     $helpers = $this->getDefaultHelpers();
     $helpers = array_merge($helpers, $this->getApplicationHelpers());
     $helpers = array_merge($helpers, $this->getPluginHelpers());
     $helpers = array_merge($helpers, $this->getModuleHelper());
     $helpers = array_merge($helpers, $this->getCurrentControllerHelper());
     require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'AkActionViewHelper.php';
     $available_helpers = array();
     foreach ($helpers as $file => $helper) {
         $helper_class_name = AkInflector::camelize(AkInflector::demodulize(strstr($helper, 'Helper') ? $helper : $helper . 'Helper'));
         $full_path = preg_match('/[\\\\\\/]+/', $file);
         $file_path = $full_path ? $file : AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . $file;
         include_once $file_path;
         if (class_exists($helper_class_name)) {
             $attribute_name = $full_path ? AkInflector::underscore($helper_class_name) : substr($file, 0, -4);
             $available_helpers[] = $attribute_name;
             $this->{$attribute_name} =& new $helper_class_name(&$this);
             if (method_exists($this->{$attribute_name}, 'setController')) {
                 $this->{$attribute_name}->setController(&$this);
             }
             if (method_exists($this->{$attribute_name}, 'init')) {
                 $this->{$attribute_name}->init();
             }
         }
     }
     defined('AK_ACTION_CONTROLLER_AVAILABLE_HELPERS') ? null : define('AK_ACTION_CONTROLLER_AVAILABLE_HELPERS', join(',', $available_helpers));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:37,代码来源:AkActionController.php

示例6: test_should_demodulize

 function test_should_demodulize()
 {
     $this->assertEqual(AkInflector::demodulize('admin/dashboard_controller'), 'dashboard_controller');
     $this->assertEqual(AkInflector::demodulize('Admin_DashboardController'), 'DashboardController');
     $this->assertEqual(AkInflector::demodulize('Admin::Dashboard'), 'Dashboard');
     $this->assertEqual(AkInflector::demodulize('User'), 'User');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:AkInflector.php

示例7: error_reporting

 * @author Bermi Ferrer <bermi a.t akelos c.om>
 * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
 * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
 */
error_reporting(defined('AK_ERROR_REPORTING_ON_SCRIPTS') ? AK_ERROR_REPORTING_ON_SCRIPTS : 0);
require_once AK_LIB_DIR . DS . 'Ak.php';
require_once AK_LIB_DIR . DS . 'AkObject.php';
require_once AK_LIB_DIR . DS . 'AkInflector.php';
defined('AK_SKIP_DB_CONNECTION') && AK_SKIP_DB_CONNECTION ? $dsn = '' : Ak::db(&$dsn);
array_shift($argv);
$options = $argv;
require_once AK_LIB_DIR . DS . 'AkInstaller.php';
require_once AK_LIB_DIR . DS . 'utils' . DS . 'generators' . DS . 'AkelosGenerator.php';
$installer = array_shift($options);
if (preg_match('/:{2}|\\//', $installer)) {
    $installer_class_name = AkInflector::camelize(AkInflector::demodulize($installer)) . 'Installer';
} else {
    $installer_class_name = AkInflector::camelize($installer) . 'Installer';
}
$command = count($options) > 0 ? array_shift($options) : 'usage';
$installer = str_replace('::', '/', $installer);
$file = AK_APP_DIR . DS . 'installers' . DS . rtrim(join('/', array_map(array('AkInflector', 'underscore'), explode('/', $installer . '/'))), '/') . '_installer.php';
function ak_print_available_installers($files, $preffix = '')
{
    foreach ($files as $k => $file) {
        if (is_string($file)) {
            if (preg_match('/(.*)_installer\\.php$/', $file, $match)) {
                echo ' * ' . $preffix . $match[1] . "\n";
            }
        } else {
            ak_print_available_installers($file, $k . '::');
开发者ID:joeymetal,项目名称:v1,代码行数:31,代码来源:migrate.php

示例8: getAttribute

 function getAttribute($attribute, $inspect_for_callback_child_method = true)
 {
     static $watchdog;
     if ($attribute[0] == '_') {
         return false;
     }
     if ($inspect_for_callback_child_method === true && method_exists($this, 'get' . AkInflector::camelize($attribute))) {
         $watchdog[@$attribute] = @$watchdog[$attribute] + 1;
         if ($watchdog[$attribute] == 66) {
             if (!defined('AK_ACTIVE_RECORD_PROTECT_GET_RECURSION') || defined('AK_ACTIVE_RECORD_PROTECT_GET_RECURSION') && AK_ACTIVE_RECORD_PROTECT_GET_RECURSION) {
                 trigger_error(Ak::t('You are calling recursivelly AkActiveRecord::getAttribute by placing parent::getAttribute() or  parent::get() on your model "%method" method. In order to avoid this, set the 2nd paramenter of parent::getAttribute to FALSE. If this was the behaviour you expected, please define the constant AK_ACTIVE_RECORD_PROTECT_GET_RECURSION and set it to false', array('%method' => 'get' . AkInflector::camelize($attribute))), E_USER_ERROR);
                 return false;
             }
         }
         $value = $this->{'get' . AkInflector::camelize($attribute)}();
         return $this->getInheritanceColumn() != false ? AkInflector::demodulize($value) : $value;
     }
     if (isset($this->{$attribute}) || !isset($this->{$attribute}) && $this->isCombinedAttribute($attribute)) {
         if ($this->hasAttribute($attribute)) {
             if ($this->isCombinedAttribute($attribute)) {
                 $this->composeCombinedAttribute($attribute);
             }
             return isset($this->{$attribute}) ? $this->{$attribute} : null;
         } elseif ($this->_internationalize && $this->_isInternationalizeCandidate($attribute)) {
             if (!empty($this->{$attribute}) && is_string($this->{$attribute})) {
                 return $this->{$attribute};
             }
             $current_locale = $this->getCurrentLocale();
             if (!empty($this->{$attribute}[$current_locale]) && is_array($this->{$attribute})) {
                 return $this->{$attribute}[$current_locale];
             }
             return $this->getAttribute($current_locale . '_' . $attribute);
         }
     }
     if ($this->_internationalize) {
         return $this->getAttributeByLocale($attribute, is_bool($inspect_for_callback_child_method) ? $this->getCurrentLocale() : $inspect_for_callback_child_method);
     }
     return null;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:39,代码来源:AkActiveRecord.php

示例9: Test_of_demodulize

 function Test_of_demodulize()
 {
     $this->assertEqual('Account', AkInflector::demodulize('MyApplication::Billing::Account'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:AkInflector.php


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