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


PHP Ak::getStaticVar方法代码示例

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


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

示例1: setup

 public function setup()
 {
     foreach (array_keys($this->_singletons) as $singleton) {
         $this->_singletons[$singleton] = Ak::getStaticVar($singleton);
         Ak::unsetStaticVar($singleton);
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:7,代码来源:routing_assertions.php

示例2: loadConfig

 static function loadConfig($dictionary)
 {
     static $_loaded = array();
     if (!($return = Ak::getStaticVar('AkInflectorConfig::' . $dictionary))) {
         $return = Ak::getSettings($dictionary, false);
         if ($return !== false) {
             Ak::setStaticVar('AkInflectorConfig::' . $dictionary, $return);
             $_loaded[$dictionary] = true;
         } else {
             trigger_error(Ak::t('Could not load inflector rules file: %file', array('%file' => 'config' . DS . $dictionary . '.yml')), E_USER_ERROR);
         }
     }
     return $return;
 }
开发者ID:bermi,项目名称:akelos,代码行数:14,代码来源:inflector.php

示例3: connect

 public function connect($options = null)
 {
     $this->setOptions($options);
     if ($this->_meetsDependencies()) {
         $port = $this->getOption('port');
         if (!($Connection = Ak::getStaticVar(__CLASS__ . '_' . $this->_connetion_signature))) {
             try {
                 $Connection = new Mongo($this->getOption('host') . (empty($port) ? '' : ':' . $port));
             } catch (MongoConnectionException $e) {
                 $Connection = false;
             }
             Ak::setStaticVar(__CLASS__ . '_' . $this->_connetion_signature, $Connection);
         }
         $this->_Mongo[$this->_connetion_signature] = $Connection;
         if ($Connection && !$this->isConnected()) {
             $Connection->connect();
         }
     }
     return $this->isConnected();
 }
开发者ID:bermi,项目名称:akelos,代码行数:20,代码来源:mongo_db.php

示例4: 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::classify($table);
         if($this->instantiateModel($class_name)){
             $contents = &Ak::getStaticVar('yaml_fixture_'.$file);
             if (!$contents) {
                 ob_start();
                 require_once($file);
                 $contents = ob_get_clean();
                 Ak::setStaticVar('yaml_fixture_'.$file, $contents);
             }
             $items = Ak::convert('yaml','array',$contents);
             foreach ($items as $item){
                 
                 $obj=&$this->{$class_name}->create($item);
                 if (isset($item['created_at'])) {
                     $obj->updateAttribute('created_at',$item['created_at']);
                 } else if (isset($item['created_on'])) {
                     $obj->updateAttribute('created_on',$item['created_on']);
                 }
             }
         }
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:32,代码来源:AkUnitTest.php

示例5: test_static_var_destruct_all_vars

 public function test_static_var_destruct_all_vars()
 {
     $value = new stdClass();
     $value->id = 1;
     $return = Ak::setStaticVar('testVar1', $value);
     $this->assertEqual(true, $return);
     $value2 = new stdClass();
     $value2->id = 2;
     $return = Ak::setStaticVar('testVar2', $value2);
     $this->assertEqual(true, $return);
     $value3 = new stdClass();
     $value3->id = 3;
     $return = Ak::setStaticVar('testVar3', $value3);
     $this->assertEqual(true, $return);
     $null = null;
     Ak::unsetStaticVar('testVar1');
     $storedValue1 =& Ak::getStaticVar('testVar1');
     $this->assertEqual($null, $storedValue1);
     $storedValue2 =& Ak::getStaticVar('testVar2');
     $this->assertEqual($value2, $storedValue2);
     $storedValue3 =& Ak::getStaticVar('testVar3');
     $this->assertEqual($value3, $storedValue3);
     Ak::unsetStaticVar($null);
     $storedValue1 =& Ak::getStaticVar('testVar1');
     $this->assertEqual($null, $storedValue1);
     $storedValue2 =& Ak::getStaticVar('testVar2');
     $this->assertEqual($null, $storedValue2);
     $storedValue3 =& Ak::getStaticVar('testVar3');
     $this->assertEqual($null, $storedValue3);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:30,代码来源:Ak.php

示例6: makelos_setting

function makelos_setting($settings = array())
{
    Ak::getStaticVar('Makelos')->addSettings($settings);
}
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:makelos.php

示例7: array

    /**
    * Register the reference to an object object
    * @return void
    */
    function &getObservers()
    {
        $staticVarNs='AkActiveRecord::observers::' . $this->_modelName;
        $key = 'objects';

        $array = array();
        $observers_arr =& Ak::getStaticVar($staticVarNs);
        if (isset($observers_arr[$key])) {
            $observers = &$observers_arr[$key];
        } else {
            $observers = &$array;
        }

        return $observers;
    }
开发者ID:joeymetal,项目名称:v1,代码行数:19,代码来源:AkActiveRecord.php

示例8: array

 /**
  * Gets the list of observers for the current model.
  * @return array
  */
 public function &getObservers()
 {
     $staticVarNs = 'AkActiveModel::observers::' . $this->_Model->getModelName();
     $key = 'objects';
     $array = array();
     $observers_arr = Ak::getStaticVar($staticVarNs);
     if (isset($observers_arr[$key])) {
         $observers = $observers_arr[$key];
     } else {
         $observers = $array;
     }
     return $observers;
 }
开发者ID:bermi,项目名称:akelos,代码行数:17,代码来源:observer.php

示例9: isLoaded

 /**
  * Checks if the user is set
  *
  * @return boolean
  */
 function isLoaded()
 {
     return Ak::getStaticVar('CurrentUser') != null;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:user.php

示例10: runTaskAsDaemon

 public function runTaskAsDaemon($task_name, $options = array())
 {
     $this->_ensurePosixAndPcntlAreAvailable();
     require_once 'System/Daemon.php';
     $app_name = AkInflector::underscore($task_name);
     $pid_file = AK_BASE_DIR . DS . 'run' . DS . $app_name . DS . $app_name . '.pid';
     $log_file = AK_LOG_DIR . DS . 'daemons' . DS . $app_name . '.log';
     if (!file_exists($pid_file)) {
         if (empty($options['attributes']['kill'])) {
             AkFileSystem::file_put_contents($pid_file, '');
             AkFileSystem::file_delete($pid_file);
         } else {
             $this->error("Could not kill process for {$task_name}", true);
         }
     } else {
         $pid = (int) file_get_contents($pid_file);
         if ($pid > 0) {
             if (!empty($options['attributes']['kill'])) {
                 $this->message("Killing process {$pid}");
                 `kill {$pid}`;
                 AkFileSystem::file_delete($pid_file);
                 die;
             } elseif (!empty($options['attributes']['restart'])) {
                 $this->message("Restarting {$task_name}.");
                 $this->message(`kill {$pid}`);
             } else {
                 $this->error("Daemon for {$task_name} still running ({$pid_file}).\nTask aborted.", true);
             }
         }
     }
     if (!empty($options['attributes']['kill']) && empty($pid)) {
         $this->error("No daemon running for task {$task_name}", true);
     }
     unset($options['attributes']['restart']);
     if (!file_exists($log_file)) {
         AkFileSystem::file_put_contents($log_file, '');
     }
     System_Daemon::setOption('appName', $app_name);
     System_Daemon::setOption('appDir', AK_BASE_DIR);
     System_Daemon::setOption('logLocation', $log_file);
     System_Daemon::setOption('appRunAsUID', posix_geteuid());
     System_Daemon::setOption('appRunAsGID', posix_getgid());
     System_Daemon::setOption('appPidLocation', $pid_file);
     $this->message("Staring daemon. ({$log_file})");
     System_Daemon::start();
     $dsn = Ak::getStaticVar('dsn');
     defined('AK_SKIP_DB_CONNECTION') && AK_SKIP_DB_CONNECTION ? null : Ak::db($dsn);
     $this->runTask($task_name, $options);
     System_Daemon::stop();
     AkFileSystem::file_delete($pid_file);
     die;
 }
开发者ID:bermi,项目名称:akelos,代码行数:52,代码来源:makelos.php

示例11: _getAvailableHelpers

 function _getAvailableHelpers()
 {
     $helpers = array();
     if (empty($this->available_helpers)) {
         if (defined('AK_SINTAGS_AVALABLE_HELPERS')) {
             $helpers = unserialize(AK_SINTAGS_AVALABLE_HELPERS);
         } else {
             $AkHelperLoader = Ak::getStaticVar('AkHelperLoader');
             $AkHelperLoader->instantiateHelpers();
             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

示例12: AkCacheHandler

 static function &getInstance(AkActionController &$Controller)
 {
     if (!($CacheHandler = Ak::getStaticVar('AkCacheHandlerSingleton'))) {
         $settings = Ak::getSettings('caching', false);
         if (!empty($settings['enabled'])) {
             $CacheHandler = new AkCacheHandler();
             $CacheHandler->init($Controller);
             Ak::setStaticVar('AkCacheHandlerSingleton', $CacheHandler);
         }
     }
     return $CacheHandler;
 }
开发者ID:bermi,项目名称:akelos,代码行数:12,代码来源:cache_handler.php

示例13: getInstance

 static function getInstance()
 {
     if (!($Request = Ak::getStaticVar('AkRequestSingleton'))) {
         $Request = new AkRequest();
         Ak::setStaticVar('AkRequestSingleton', $Request);
     }
     return $Request;
 }
开发者ID:bermi,项目名称:akelos,代码行数:8,代码来源:request.php

示例14: getInstantiatedHelperNames

 /**
  * Returns an array of helper names like:
  *
  *  array('url_helper', 'prototype_helper')
  */
 function getInstantiatedHelperNames()
 {
     return Ak::getStaticVar('AkActionView::instantiated_helper_names');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:AkHelperLoader.php

示例15: getInstance

 /**
  * @return AkRouter
  */
 static function getInstance()
 {
     if (!($Router = Ak::getStaticVar('AkRouterSingleton'))) {
         $Router = new AkRouter();
         $Router->loadMap();
         Ak::setStaticVar('AkRouterSingleton', $Router);
     }
     return $Router;
 }
开发者ID:bermi,项目名称:akelos,代码行数:12,代码来源:base.php


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