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


PHP Ak::first方法代码示例

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


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

示例1: hasCollisions

 public function hasCollisions()
 {
     $this->collisions = array();
     $this->namespace = AkInflector::underscore(Ak::first(explode(':', $this->task_name . ':')));
     $this->task_name = AkInflector::underscore(Ak::last(explode(':', ':' . $this->task_name)));
     $this->destination_path = AK_TASKS_DIR . DS . $this->namespace;
     if (file_exists($this->destination_path . DS . $this->task_name . '.task.php')) {
         $this->collisions[] = Ak::t('%path already exists', array('%path' => $this->destination_path . DS . $this->task_name . '.task.php'));
     }
     return count($this->collisions) > 0;
 }
开发者ID:bermi,项目名称:akelos,代码行数:11,代码来源:task_generator.php

示例2: getResourcePathNameFor

 static function getResourcePathNameFor($name, $default = null)
 {
     $result = Ak::first(Ak::pick($name, AkConfig::getOption('resources_path_names', array('add' => 'add', 'edit' => 'edit'))));
     return empty($result) ? $default : $result;
 }
开发者ID:bermi,项目名称:akelos,代码行数:5,代码来源:resources.php

示例3: ak_get_application_included_files

function ak_get_application_included_files($source_for = '')
{
    $app_files = array();
    foreach (get_included_files() as $k => $file) {
        if (strstr($file, AK_FRAMEWORK_DIR)) {
            continue;
        }
        $short_path = str_replace(AK_BASE_DIR, '', $file);
        if (strstr($file, AK_MODELS_DIR)) {
            $app_files['Models'][$k]['path'] = $short_path;
            if ($file == $source_for) {
                $app_files['Models'][$k]['original_path'] = $file;
            }
        } elseif (strstr($file, AK_COMPILED_VIEWS_DIR)) {
            $path = Ak::first(explode('.tpl.', str_replace(array(AK_COMPILED_VIEWS_DIR, '/compiled'), '', $file))) . '.tpl';
            if (!in_array($path, array('/app/views/exception.tpl', '/app/views/_trace.tpl'))) {
                $app_files['Views'][$k]['path'] = $path;
                if ($file == $source_for) {
                    $app_files['Views'][$k]['original_path'] = $file;
                }
            }
        } elseif (strstr($file, AK_CONTROLLERS_DIR)) {
            $app_files['Controllers'][$k]['path'] = $short_path;
            if ($file == $source_for) {
                $app_files['Controllers'][$k]['original_path'] = $file;
            }
        } elseif (strstr($file, AK_HELPERS_DIR)) {
            $app_files['Helpers'][$k]['path'] = $short_path;
            if ($file == $source_for) {
                $app_files['Helpers'][$k]['original_path'] = $file;
            }
        }
    }
    return $app_files;
}
开发者ID:bermi,项目名称:akelos,代码行数:35,代码来源:error_functions.php

示例4: getOffset

 public function getOffset()
 {
     return Ak::first($this->paginator->getOffsetByPageId($this->getCurrent())) - 1;
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:pagination.php

示例5: _getLocaleForRequest

 protected function _getLocaleForRequest(&$Request)
 {
     if (isset($Request->lang)) {
         $lang = $Request->lang;
     } else {
         $lang = $this->getNavigationLanguage();
     }
     if ($url_locale = $this->getLangFromUrl($Request)) {
         $lang = $this->getLocaleFromAlias($url_locale);
     }
     if (!$this->_canUseLocaleOnCurrentRequest($lang, $Request)) {
         $lang = Ak::first($this->getPublicLocales());
     } elseif (empty($lang)) {
         $lang = Ak::first($this->getPublicLocales());
     }
     // This way we store on get_url_locale and on lang the value of $lang on
     // a static variable for accessing it application wide
     empty($url_locale) ? null : Ak::get_url_locale($url_locale);
     Ak::lang($lang);
     return $lang;
 }
开发者ID:bermi,项目名称:akelos,代码行数:21,代码来源:locale_manager.php

示例6: test_attachment_with_text_type

    function test_attachment_with_text_type()
    {
        $TestMailer =& new TestMailer();
        $Mail =& $TestMailer->receive(file_get_contents(AK_TEST_DIR."/fixtures/data/action_mailer/raw_email13"));

        $this->assertTrue($Mail->hasAttachments());
        $this->assertEqual(1, Ak::size($Mail->attachments));

        $Attachment = Ak::first($Mail->attachments);
        $this->assertEqual("hello.rb", $Attachment->original_filename);
    }
开发者ID:joeymetal,项目名称:v1,代码行数:11,代码来源:AkActionMailer.php

示例7: test_attachment_with_text_type

 public function test_attachment_with_text_type()
 {
     $TestMailer = new TestMailer();
     $Mail = $TestMailer->receive(file_get_contents(AkConfig::getDir('fixtures') . DS . "raw_email13"));
     $this->assertTrue($Mail->hasAttachments());
     $this->assertEqual(1, Ak::size($Mail->attachments));
     $Attachment = Ak::first($Mail->attachments);
     $this->assertEqual("hello.rb", $Attachment->original_filename);
 }
开发者ID:bermi,项目名称:akelos,代码行数:9,代码来源:action_mailer.php

示例8: get

 /**
  * Get a models a model instance. Including and instantiating the model for us.
  *
  * This kinds mimics the ideal (new Model())->find() which does not exist on PHP yet.
  *
  * On Akelos we can do Ak::get('Model')->find();
  */
 static function get($model_name, $attributes = array())
 {
     $model_name = Ak::first(Ak::import($model_name));
     if (!empty($model_name)) {
         return new $model_name($attributes);
     }
 }
开发者ID:bermi,项目名称:sintags,代码行数:14,代码来源:base.php

示例9: getAccountSubdomain

 public function getAccountSubdomain()
 {
     return Ak::first($this->Request->getSubdomains());
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:action_controller.php

示例10: _getGeneratorsInsidePath

 private function _getGeneratorsInsidePath($path)
 {
     $generators = array();
     if (is_dir($path)) {
         foreach (AkFileSystem::dir($path, array('files' => false, 'dirs' => true)) as $folder) {
             $generator = Ak::first(array_keys($folder));
             if (strstr($generator, '.php') || is_file($path . DS . $generator)) {
                 continue;
             }
             $generators[$path . DS . $generator . DS . $generator . '_generator.php'] = $generator;
         }
     }
     return $generators;
 }
开发者ID:bermi,项目名称:akelos,代码行数:14,代码来源:generator.php

示例11: getPluginHelperNames

 public function getPluginHelperNames()
 {
     $handler = $this->_Handler;
     $handler->plugin_helpers = !isset($handler->plugin_helpers) ? 'all' : $handler->plugin_helpers;
     $helper_names = AkHelperLoader::addPluginHelper(false);
     // Trick for getting helper names set by AkPlugin::addHelper
     if (empty($helper_names)) {
         return array();
     } elseif ($handler->plugin_helpers == 'all') {
         return $helper_names;
     } else {
         $selected_helper_names = array();
         foreach (Ak::toArray($handler->plugin_helpers) as $helper_name) {
             $helper_name = AkInflector::camelize($helper_name);
             if ($path = Ak::first(array_keys($helper_names, AkInflector::camelize($helper_name)))) {
                 $selected_helper_names[$path] = $helper_names[$path];
             }
         }
         return $selected_helper_names;
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:21,代码来源:helper_loader.php


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