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


PHP Ak::toArray方法代码示例

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


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

示例1: _encodeAddress

    public function _encodeAddress($address_string, $header_name = '', $names = true)
    {
        $headers = '';
        $addresses = Ak::toArray($address_string);
        $addresses = array_map('trim', $addresses);
        foreach ($addresses as $address){
            $address_description = '';
            if(preg_match('#(.*?)<(.*?)>#', $address, $matches)){
                $address_description = trim($matches[1]);
                $address = $matches[2];
            }

            if(empty($address) || !$this->_isAscii($address) || !$this->_isValidAddress($address)){
                continue;
            }
            if($names && !empty($address_description)){
                $address = "<$address>";
                if(!$this->_isAscii($address_description)){
                    $address_description = '=?'.AK_ACTION_MAILER_DEFAULT_CHARSET.'?Q?'.$this->quoted_printable_encode($address_description, 0).'?=';
                }
            }
            $headers .= (!empty($headers)?','.AK_MAIL_HEADER_EOL.' ':'').$address_description.$address;
        }

        return empty($headers) ? false : (!empty($header_name) ? $header_name.': '.$headers.AK_MAIL_HEADER_EOL : $headers);
    }
开发者ID:joeymetal,项目名称:v1,代码行数:26,代码来源:AkMailEncoding.php

示例2: _init

 function _init()
 {
     $this->logger =& Ak::getLogger();
     $base = AK_TEST_DIR . DS . 'unit' . DS . 'lib' . DS;
     $this->GroupTest($this->title);
     $allFiles = glob($base . $this->baseDir);
     if (isset($this->excludes)) {
         $excludes = array();
         $this->excludes = @Ak::toArray($this->excludes);
         foreach ($this->excludes as $pattern) {
             $excludes = array_merge($excludes, glob($base . $pattern));
         }
         $this->excludes = $excludes;
     } else {
         $this->excludes = array();
     }
     if (count($allFiles) >= 1 && $allFiles[0] != $base . $this->baseDir && $this->partial_tests === true) {
         $this->_includeFiles($allFiles);
     } else {
         if (is_array($this->partial_tests)) {
             foreach ($this->partial_tests as $test) {
                 //$this->log('Including partial testfile:'.$test);
                 $this->addTestFile($base . $this->baseDir . DS . $test . '.php');
             }
         } else {
             echo "No files in : " . $this->title . "\n";
         }
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:29,代码来源:AkUnitTestSuite.php

示例3: _protectAction

 function _protectAction()
 {
     $protected_actions = Ak::toArray($this->protected_actions);
     $action_name = $this->getActionName();
     if (in_array($action_name, $protected_actions) && !$this->CurrentUser->can($action_name . ' action', 'Admin::' . $this->getControllerName())) {
         $this->redirectTo(array('action' => 'protected_action'));
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:admin_controller.php

示例4: _linkWebServiceApis

 function _linkWebServiceApis()
 {
     if (!empty($this->web_service_api)) {
         $this->web_service_api = Ak::toArray($this->web_service_api);
         foreach ($this->web_service_api as $api) {
             $this->_linkWebServiceApi($api);
         }
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:AkActionWebService.php

示例5: _preloadPaths

 function _preloadPaths()
 {
     $this->class_name = AkInflector::camelize($this->class_name);
     $this->assignVarToTemplate('class_name', $this->class_name);
     $this->actions = Ak::toArray(@$this->actions);
     $this->assignVarToTemplate('actions', $this->actions);
     $this->underscored_class_name = AkInflector::underscore($this->class_name);
     $this->model_path = 'app' . DS . 'models' . DS . $this->underscored_class_name . '.php';
     $this->installer_path = 'app' . DS . 'installers' . DS . $this->underscored_class_name . '_installer.php';
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:mailer_generator.php

示例6: rss2_builder

 function rss2_builder($items = array(), $channel_options = array(), $item_options = array())
 {
     $return = array();
     $default_channel_options = array('title' => 'Please put your custom channel title in $channel_options[title]', 'description' => 'Please put your custom channel description in $channel_options[description]', 'link' => 'http://example.com/put/your/custom/link/here', 'language' => Ak::base_lang());
     $channel_parameters = array('available_options' => array('title', 'description', 'link', 'language'));
     Ak::parseOptions($channel_options, $default_channel_options, $channel_parameters);
     $default_item_options = array('title' => 'name', 'description' => 'description', 'date' => 'created_at', 'author' => false, 'link' => true, 'guid' => false);
     $item_parameters = array('available_options' => array('title', 'description', 'link', 'date', 'author', 'guid', 'content:encoded'));
     Ak::parseOptions($item_options, $default_item_options, $item_parameters);
     $return[] = $this->xml_instruct('xml', array('version' => '1.0'));
     $return[] = $this->xml_rss_open(array('version' => "2.0", 'xmlns' => array('dc' => "http://purl.org/dc/elements/1.1/", 'atom' => "http://www.w3.org/2005/Atom", 'content' => 'http://purl.org/rss/1.0/modules/content/')));
     $return[] = $this->xml_channel_open();
     $return[] = $this->xml_title($channel_options['title']);
     $return[] = $this->xml_description($channel_options['description']);
     $return[] = $this->xml_link(htmlentities($channel_options['link']));
     $return[] = $this->xml_language($channel_options['language']);
     $items = Ak::toArray($items);
     foreach ($items as $item) {
         $return[] = $this->xml_item_open();
         if (!empty($item_options['title'])) {
             $title = $this->_getValue($item, $item_options['title']);
             !empty($title) ? $return[] = $this->xml_title($title) : null;
         }
         if (!empty($item_options['link'])) {
             $item_link = $this->_getValue($item, $item_options['link']);
             !empty($item_link) ? $return[] = $this->xml_link($item_link) : null;
         }
         if (!empty($item_options['guid'])) {
             $guid = $this->_getValue($item, $item_options['guid']);
             !empty($guid) ? $return[] = $this->xml_guid($guid, strstr($guid, 'http://') ? array() : array('isPermaLink' => 'false')) : (!empty($item_link) ? $return[] = $this->xml_guid($item_link, strstr($item_link, 'http://') ? array() : array('isPermaLink' => 'false')) : null);
         }
         if (!empty($item_options['content:encoded'])) {
             $encoded = $this->_getValue($item, $item_options['content:encoded']);
             !empty($encoded) ? $return[] = $this->xml_content__encoded('<![CDATA[' . $encoded . ']]>') : null;
         }
         if (!empty($item_options['description'])) {
             $description = $this->_getValue($item, $item_options['description']);
             !empty($description) ? $return[] = $this->xml_description('<![CDATA[' . $description . ']]>') : null;
         }
         if (!empty($item_options['date'])) {
             $created_at = $this->_getValue($item, $item_options['date']);
             !empty($created_at) ? $return[] = $this->xml_dc__date($this->_generate_date($created_at)) : null;
         }
         if (!empty($item_options['author'])) {
             $author = $this->_getValue($item, $item_options['author']);
             !empty($author) ? $return[] = $this->xml_dc__author($author) : null;
         }
         $return[] = $this->xml_item_close();
     }
     $return[] = $this->xml_channel_close();
     $return[] = $this->xml_rss_close();
     return implode("\n", $return);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:53,代码来源:xml_helper.php

示例7: _preloadPaths

 function _preloadPaths()
 {
     $this->class_name = AkInflector::camelize($this->class_name);
     $this->assignVarToTemplate('class_name', $this->class_name);
     $this->actions = Ak::toArray(@$this->actions);
     if(empty($this->actions)){
         trigger_error(Ak::t('You must supply at least one action for the mailer.'), E_USER_ERROR);
     }
     $this->assignVarToTemplate('actions', $this->actions);
     $this->underscored_class_name = AkInflector::underscore($this->class_name);
     $this->model_path = 'app'.DS.'models'.DS.$this->underscored_class_name.'.php';
     $this->installer_path = 'app'.DS.'installers'.DS.$this->underscored_class_name.'_installer.php';
 }
开发者ID:joeymetal,项目名称:v1,代码行数:13,代码来源:mailer_generator.php

示例8: addErrorOnBoundaryBreaking

 /**
  * Will add an error message to each of the attributes in $attributes that has a length outside of the passed boundary $range.
  * If the length is above the boundary, the too_long_message message will be used. If below, the too_short_message.
  */
 public function addErrorOnBoundaryBreaking($attribute_names, $range_begin, $range_end, $too_long_message = 'too_long', $too_short_message = 'too_short')
 {
     $too_long_message = $this->getDefaultErrorMessageFor($too_long_message);
     $too_short_message = $this->getDefaultErrorMessageFor($too_short_message);
     $attribute_names = Ak::toArray($attribute_names);
     foreach ($attribute_names as $attribute) {
         if (@$this->_Model->{$attribute} < $range_begin) {
             $this->addError($attribute, $too_short_message);
         }
         if (@$this->_Model->{$attribute} > $range_end) {
             $this->addError($attribute, $too_long_message);
         }
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:18,代码来源:errors.php

示例9: _getOrderFromAssociations

 function _getOrderFromAssociations(&$object, $paginator_name, &$find_options)
 {
     if (!empty($this->_controller->params['sort']) && !empty($this->{$paginator_name}->_ak_options['include']) && $object->hasAssociations()) {
         $included_models = Ak::toArray($this->{$paginator_name}->_ak_options['include']);
         foreach ($object->getAvailableAssociates() as $association_type => $associated_models) {
             foreach ($associated_models as $associated_model) {
                 if (in_array($this->_controller->params['sort'], array_keys($object->{$associated_model}->getAvailableAttributes()))) {
                     $find_options['order'] = $association_type . '_' . $associated_model . '.' . $this->_controller->params['sort'] . $this->getSortDirection();
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:15,代码来源:pagination_helper.php

示例10: createRoles

 public function createRoles()
 {
     $Role = new Role();
     $ApplicationOwner = $Role->create(array('name' => 'Application owner'));
     $Administrator = $ApplicationOwner->addChildrenRole('Administrator');
     foreach (Ak::toArray('add,destroy,edit,index,listing,show') as $action) {
         $Administrator->addPermission(array('name' => $action . ' action', 'extension' => $this->AdminUsers));
     }
     $Administrator->addPermission(array('name' => 'Manage Users (users controller)', 'extension' => $this->AdminMenuTabs));
     $Administrator->addPermission(array('name' => 'Accounts (users controller, listing action)', 'extension' => $this->AdminMenuTabs));
     $Administrator->addPermission(array('name' => 'Edit other users', 'extension' => $this->AdminUsers));
     $NormalUser = $Administrator->addChildrenRole('Registered user');
     $NormalUser->addPermission(array('name' => 'index action', 'extension' => $this->AdminDashboard));
     $NormalUser->addPermission(array('name' => 'Dashboard (dashboard controller)', 'extension' => $this->AdminMenuTabs));
 }
开发者ID:bermi,项目名称:admin,代码行数:15,代码来源:admin_plugin_installer.php

示例11: populateTables

    function populateTables()
    {
        $args = func_get_args();
        $tables = !empty($args) ? (is_array($args[0]) ? $args[0] : (count($args) > 1 ? $args : Ak::toArray($args))) : array();
        foreach ($tables as $table){
            $file = AK_TEST_DIR.DS.'fixtures'.DS.'data'.DS.(empty($this->module)?'':$this->module.DS).Ak::sanitize_include($table).'.yaml';
            if(!file_exists($file)){
                continue;
            }
            $class_name = AkInflector::modulize($table);
            if($this->instantiateModel($class_name)){
                $items = Ak::convert('yaml','array',file_get_contents($file));
                foreach ($items as $item){
                    $this->{$class_name}->create($item);
                }
            }

        }
    }
开发者ID:joeymetal,项目名称:v1,代码行数:19,代码来源:AkUnitTest.php

示例12: _getAvailableHelpers

    function _getAvailableHelpers()
    {
        $helpers = array();
        if(empty($this->available_helpers)){
            if(defined('AK_SINTAGS_AVALABLE_HELPERS')){
                $helpers = unserialize(AK_SINTAGS_AVALABLE_HELPERS);
            }else{
                require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'AkHelperLoader.php');
                if($underscored_helper_names = AkHelperLoader::getInstantiatedHelperNames()){
                    foreach ($underscored_helper_names as $underscored_helper_name){
                        $helper_class_name = AkInflector::camelize($underscored_helper_name);
                        if(class_exists($helper_class_name)){
                            $methods = get_class_methods($helper_class_name);
                            $vars=get_class_vars($helper_class_name);
                            if (AK_PHP5 && isset($vars['dynamic_helpers'])) {
                                $dynamic_helpers = Ak::toArray($vars['dynamic_helpers']);
                                foreach ($dynamic_helpers as $method_name){
                                    $this->dynamic_helpers[$method_name] = $underscored_helper_name;
                                }
                            }
                            foreach (get_class_methods($helper_class_name) as $method_name){
                                if($method_name[0] != '_'){
                                    $helpers[$method_name] = $underscored_helper_name;
                                }
                            }
                        }
                    }
                    $helpers['render'] = 'controller';
                    $helpers['render_partial'] = 'controller';
                }
            }
            $this->available_helpers = $helpers;
        }
        return $this->available_helpers;

    }
开发者ID:joeymetal,项目名称:v1,代码行数:36,代码来源:AkSintagsParser.php

示例13: array

 /**
  * Creates an instance of each available helper and links it into into current mailer.
  * 
  * Mailer helpers work as Controller helpers but without the Request context
  */
 function &getHelpers()
 {
     static $helpers = array();
     require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'AkActionViewHelper.php';
     $mailer_helpers = array_merge(Ak::toArray($this->helpers), array(substr($this->getModelName(), -6)));
     $mailer_helpers = array_unique(array_map(array('AkInflector', 'underscore'), $mailer_helpers));
     foreach ($mailer_helpers as $file => $mailer_helper) {
         $full_path = preg_match('/[\\\\\\/]+/', $file);
         $helper_class_name = AkInflector::camelize($mailer_helper) . 'Helper';
         $attribute_name = !$full_path ? AkInflector::underscore($helper_class_name) : substr($file, 0, -4);
         if (empty($helpers[$attribute_name])) {
             if ($full_path) {
                 include_once $file;
             } else {
                 $helper_file_name = $mailer_helper . '_helper.php';
                 if (file_exists(AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . $helper_file_name)) {
                     include_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . $helper_file_name;
                 } elseif (file_exists(AK_HELPERS_DIR . DS . $helper_file_name)) {
                     include_once AK_HELPERS_DIR . DS . $helper_file_name;
                 }
             }
             if (class_exists($helper_class_name)) {
                 if (empty($helpers[$attribute_name])) {
                     $helpers[$attribute_name] =& new $helper_class_name(&$this);
                     if (method_exists($helpers[$attribute_name], 'setController')) {
                         $helpers[$attribute_name]->setController(&$this);
                     }
                     if (method_exists($helpers[$attribute_name], 'setMailer')) {
                         $helpers[$attribute_name]->setMailer(&$this);
                     }
                     if (method_exists($helpers[$attribute_name], 'init')) {
                         $helpers[$attribute_name]->init();
                     }
                 }
             }
         }
     }
     return $helpers;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:44,代码来源:AkActionMailer.php

示例14: getSettings

 /**
  * Returns YAML settings from config/$namespace.yml
  */
 function getSettings($namespace, $raise_error_if_config_file_not_found = true, $environment = AK_ENVIRONMENT)
 {
     static $_config;
     if (!in_array($environment, Ak::toArray(AK_AVAILABLE_ENVIRONMENTS))) {
         trigger_error('The environment ' . $environment . ' is not allowed. Allowed environments: ' . AK_AVAILABLE_ENVIRONMENTS);
         return false;
     }
     if (!isset($_config)) {
         require_once AK_LIB_DIR . DS . 'AkConfig.php';
         $_config = new AkConfig();
     }
     return $_config->get($namespace, $environment, $raise_error_if_config_file_not_found);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:16,代码来源:Ak.php

示例15: convert

 function convert()
 {
     return Ak::toArray($this->source);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:AkStringToArray.php


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