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


PHP __c函数代码示例

本文整理汇总了PHP中__c函数的典型用法代码示例。如果您正苦于以下问题:PHP __c函数的具体用法?PHP __c怎么用?PHP __c使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testTimeDefinition

/**
 * testTimeDefinition
 *
 * @retun void
 * @access public
 */
	function testTimeDefinition() {
		$result = __c('abday', 5, true);
		$expected = array('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab');
		$this->assertEqual($result, $expected);

		$result = __c('day', 5, true);
		$expected = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado');
		$this->assertEqual($result, $expected);

		$result = __c('abmon', 5, true);
		$expected = array('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez');
		$this->assertEqual($result, $expected);

		$result = __c('mon', 5, true);
		$expected = array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');
		$this->assertEqual($result, $expected);

		$result = __c('d_fmt', 5, true);
		$expected = '%d/%m/%Y';
		$this->assertEqual($result, $expected);

		$result = __c('am_pm', 5, true);
		$expected = array('AM', 'PM');
		$this->assertEqual($result, $expected);
	}
开发者ID:rafaelqueiroz,项目名称:cake_ptbr,代码行数:31,代码来源:i18n.test.php

示例2: __construct

 public function __construct()
 {
     // add tokens
     $token = Model::factory('BacboxConfigModel')->create();
     $token->key = 'mailer.host';
     $token->value = serialize('localhost');
     $token->allow_override = true;
     $token->save();
     $token = Model::factory('BacboxConfigModel')->create();
     $token->key = 'mailer.port';
     $token->value = serialize(587);
     $token->allow_override = true;
     $token->save();
     $token = Model::factory('BacboxConfigModel')->create();
     $token->key = 'mailer.username';
     $token->value = serialize('user@localhost.ch');
     $token->allow_override = true;
     $token->save();
     $token = Model::factory('BacboxConfigModel')->create();
     $token->key = 'mailer.password';
     $token->value = serialize('123456');
     $token->allow_override = true;
     $token->save();
     // clear cache
     __c()->delete('_configTokens');
 }
开发者ID:bacbos,项目名称:bacbox,代码行数:26,代码来源:0001_AddMailerConfig.php

示例3: buildLocale

 /**
  * Tries to build the complete locale name, including charset.
  * Integrated fallback for systems that use uppercase Charset-appendices
  */
 private function buildLocale()
 {
     if (!($availableLocales = __c()->_availableLocales)) {
         ob_start();
         if (system('locale -a')) {
             $availableLocales = ob_get_contents();
             ob_end_clean();
             $availableLocales = explode("\n", trim($availableLocales));
             __c()->_availableLocales = array($availableLocales, 3600);
         } else {
             return false;
         }
     }
     // charset format can differ depending on system - prepare different formats
     $charsetStack = array($this->charset, strtoupper($this->charset), str_replace('-', '', $this->charset), str_replace('-', '', strtoupper($this->charset)));
     // verify if requested locale is available on this system
     foreach ($charsetStack as $test) {
         if (in_array($this->localeShort . '.' . $test, $availableLocales)) {
             // match! register
             $this->charset = $test;
             $this->locale = $this->localeShort . '.' . $this->charset;
             return true;
         }
     }
     // requested locale is not available on this system!
     throw new Exception('locale ' . $this->localeShort . '.' . $this->charset . ' not supported on this system (variations fallback failed)!');
 }
开发者ID:bacbos,项目名称:bacbox,代码行数:31,代码来源:Localization.php

示例4: _initCache

 public function _initCache()
 {
     //$servers = array();
     $cacheCfg = $this->_config->memcached->config;
     $servers = $cacheCfg->toArray();
     if (!empty($servers)) {
         phpFastCache::$storage = "auto";
         $cache = __c($cacheCfg->type);
         $server = array(array($cacheCfg->host, $cacheCfg->port, $cacheCfg->timeout));
         $cache->option("server", $server);
         Registry::set("cache", $cache);
     }
 }
开发者ID:musicsnap,项目名称:Cdoco_Yaf_Ext,代码行数:13,代码来源:Bootstrap.php

示例5: fetchAndCache

 function fetchAndCache($query, $cacheTime, $cb = null)
 {
     $cacheKey = 'ED-' . md5($query);
     $result = __c()->get($cacheKey);
     if ($result === null) {
         $result = $this->endPoint->query($query);
         $result = $result["result"]["rows"];
         if (is_callable($cb)) {
             $result = $cb($result);
         }
         __c()->set($cacheKey, $result, $cacheTime * 3600);
         //cache for cacheTime hours
     }
     return $result;
 }
开发者ID:nobelprize-org,项目名称:top-laureates,代码行数:15,代码来源:external-data.php

示例6: testAction

 public function testAction()
 {
     phpFastCache::$storage = "auto";
     $cache = __c("memcache");
     $server = array(array("192.168.10.122", 11211, 100));
     $cache->option("server", $server);
     $cache->keyword = array("something here++++++++++++++++_________", 600);
     //        var_dump($cache->get("31lh9kj9cs3627fauu90njuj26"));
     var_dump($cache->keyword);
     $excel = new CreateExcel();
     //        $excel->setHeader('高子航' . date('Y年m月d日 H:i:s', time()));
     //        $excel->setTitle(array( '高子航'));
     //        $excel->setData(array());
     //        $excel->echoExcel('show_' . date('Y_m_d_H_i_s', time()));
     die;
 }
开发者ID:musicsnap,项目名称:Cdoco_Yaf_Ext,代码行数:16,代码来源:Index.php

示例7: __construct

 function __construct()
 {
     global $gStatsToplistAPI;
     global $gCacheLocal;
     if ($gCacheLocal) {
         $cacheKey = 'LD-' . md5($gStatsToplistAPI);
         $result = __c()->get($cacheKey);
         if ($result === null) {
             $result = $this->_fetch($gStatsToplistAPI);
             global $gExternalStatsCacheTime;
             __c()->set($cacheKey, $result, $gExternalStatsCacheTime * 3600);
         }
     } else {
         $result = $this->_fetch($gStatsToplistAPI);
     }
     $this->list = $result;
 }
开发者ID:nobelprize-org,项目名称:top-laureates,代码行数:17,代码来源:popularity.php

示例8: load

 /**
  * load configuration tokens from database
  */
 public static function load()
 {
     if (!($configTokens = __c()->_configTokens)) {
         try {
             // try to load configuration tokens
             $configTokens = Model::factory('BacboxConfigModel')->order_by_asc('key')->find_many();
             __c()->_configTokens = array($configTokens, 3600);
         } catch (PDOException $e) {
             if ($e->getCode() == '42S02') {
                 /**
                  * table '_config' has not yet been defined / run initial migration
                  * we first augment max_execution_time to avoid initial migrations causing
                  * a time-out error on slow systems
                  */
                 ini_set('max_execution_time', 180);
                 // init first migration -> this chains all the remaining initial migrations automagically
                 new InstallBacbox();
                 // clear cache
                 __c()->delete('_configTokens');
                 /**
                  * redirect the user so he doesn't see ugly errors after
                  * initial set-up
                  */
                 header("Location: " . BACBOX_URLBASE);
                 exit;
             } else {
                 // other database error - re-throw exception
                 throw $e;
             }
         }
     }
     // assign configuration tokens
     foreach ($configTokens as $configToken) {
         // register each token
         self::set($configToken->key, unserialize($configToken->value));
         // if token is overrideable, store it appropriatly
         if ($configToken->allow_override) {
             self::$overrideable_tokens[] = $configToken->key;
         }
     }
     // set internal system settings based on defined configuration tokens
     self::set_system_settings();
 }
开发者ID:bacbos,项目名称:bacbox,代码行数:46,代码来源:Config.php

示例9: __category

 /**
  * category method
  *
  * @access private
  * @return void
  */
 function __category($category = 3)
 {
     $singular = __c('Plural Rule 1', $category, true);
     return $singular;
 }
开发者ID:aqua777,项目名称:rackdoc,代码行数:11,代码来源:i18n.test.php

示例10: load_sites

 private static function load_sites()
 {
     if (!($sites = __c()->_coreSites)) {
         if (!($sites = Model::factory('BacboxSiteModel')->find_many())) {
             throw new Exception('Failed to load site entities');
         }
         // @todo: find a proper way to cache the sites
         //__c()->_coreSites = array($sites->as_array(), 3600);
     }
     foreach ($sites as $site) {
         self::$site_cache[$site->host_id][$site->site_regex] = $site;
     }
 }
开发者ID:bacbos,项目名称:bacbox,代码行数:13,代码来源:Controller.php

示例11: __translateSpecifier

 /**
  * Auxiliary function to translate a matched specifier element from a regular expresion into
  * a windows safe and i18n aware specifier
  *
  * @param array $specifier match from regular expression
  * @return string converted element
  * @access private
  */
 function __translateSpecifier($specifier)
 {
     switch ($specifier[1]) {
         case 'a':
             $abday = __c('abday', 5, true);
             if (is_array($abday)) {
                 return $abday[date('w', $this->__time)];
             }
             break;
         case 'A':
             $day = __c('day', 5, true);
             if (is_array($day)) {
                 return $day[date('w', $this->__time)];
             }
             break;
         case 'c':
             $format = __c('d_t_fmt', 5, true);
             if ($format != 'd_t_fmt') {
                 return $this->convertSpecifiers($format, $this->__time);
             }
             break;
         case 'C':
             return sprintf("%02d", date('Y', $this->__time) / 100);
         case 'D':
             return '%m/%d/%y';
         case 'e':
             if (DS === '/') {
                 return '%e';
             }
             $day = date('j', $this->__time);
             if ($day < 10) {
                 $day = ' ' . $day;
             }
             return $day;
         case 'eS':
             return date('jS', $this->__time);
         case 'b':
         case 'h':
             $months = __c('abmon', 5, true);
             if (is_array($months)) {
                 return $months[date('n', $this->__time) - 1];
             }
             return '%b';
         case 'B':
             $months = __c('mon', 5, true);
             if (is_array($months)) {
                 return $months[date('n', $this->__time) - 1];
             }
             break;
         case 'n':
             return "\n";
         case 'p':
         case 'P':
             $default = array('am' => 0, 'pm' => 1);
             $meridiem = $default[date('a', $this->__time)];
             $format = __c('am_pm', 5, true);
             if (is_array($format)) {
                 $meridiem = $format[$meridiem];
                 return $specifier[1] == 'P' ? strtolower($meridiem) : strtoupper($meridiem);
             }
             break;
         case 'r':
             $complete = __c('t_fmt_ampm', 5, true);
             if ($complete != 't_fmt_ampm') {
                 return str_replace('%p', $this->__translateSpecifier(array('%p', 'p')), $complete);
             }
             break;
         case 'R':
             return date('H:i', $this->__time);
         case 't':
             return "\t";
         case 'T':
             return '%H:%M:%S';
         case 'u':
             return ($weekDay = date('w', $this->__time)) ? $weekDay : 7;
         case 'x':
             $format = __c('d_fmt', 5, true);
             if ($format != 'd_fmt') {
                 return $this->convertSpecifiers($format, $this->__time);
             }
             break;
         case 'X':
             $format = __c('t_fmt', 5, true);
             if ($format != 't_fmt') {
                 return $this->convertSpecifiers($format, $this->__time);
             }
             break;
     }
     return $specifier[0];
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:98,代码来源:time.php

示例12: testTimeDefinitionJapanese

 /**
  * testTimeDefinitionJapanese method
  *
  * @return void
  */
 public function testTimeDefinitionJapanese()
 {
     Configure::write('Config.language', 'ja_jp');
     $result = __c('d_fmt', 5);
     $expected = "%Y年%m月%d日";
     $this->assertEquals($expected, $result);
     $result = __c('am_pm', 5);
     $expected = array("午前", "午後");
     $this->assertEquals($expected, $result);
     $result = __c('abmon', 5);
     $expected = array(" 1月", " 2月", " 3月", " 4月", " 5月", " 6月", " 7月", " 8月", " 9月", "10月", "11月", "12月");
     $this->assertEquals($expected, $result);
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:18,代码来源:I18nTest.php

示例13: __c

if (isset($_POST)) {
    $caching = false;
}
// no caching if have some $_GET ?string=var
if (isset($_GET['somevar']) && $_GET['somevar'] == "something") {
    $caching = false;
}
// No caching for logined user
// can use with $_COOKIE AND $_SESSION
if (isset($_SESSION) && $_SESSION['logined'] == true) {
    $caching = false;
}
// ONLY ACCESS CACHE IF $CACHE = TRUE
if ($caching == true) {
    $html = __c("files")->get($keyword_webpage);
}
if ($html == null) {
    ob_start();
    /*
        ALL OF YOUR CODE GO HERE
        RENDER YOUR PAGE, DB QUERY, WHATEVER
    */
    echo " WEBSITE HTML HERE ";
    echo " MY WEB SITE CONTENTS IS HERE";
    echo " ENDING WEBSITE CONTENT";
    // GET HTML CONTENT
    $html = ob_get_contents();
    // Save to Cache 30 minutes
    __c("files")->set($keyword_webpage, $html, 1800);
}
echo $html;
开发者ID:Inteleck,项目名称:hwc,代码行数:31,代码来源:6.cache_whole_website.php

示例14: testTranslateCategory

 /**
  * test __c()
  *
  * @return void
  */
 public function testTranslateCategory()
 {
     Configure::write('Config.language', 'rule_1_po');
     $result = __c('Plural Rule 1', 6);
     $expected = 'Plural Rule 1 (translated)';
     $this->assertEquals($expected, $result);
     $result = __c('Plural Rule 1 (from core)', 6);
     $expected = 'Plural Rule 1 (from core translated)';
     $this->assertEquals($expected, $result);
     $result = __c('Some string with %s', 6, 'arguments');
     $expected = 'Some string with arguments';
     $this->assertEquals($expected, $result);
     $result = __c('Some string with %s %s', 6, 'multiple', 'arguments');
     $expected = 'Some string with multiple arguments';
     $this->assertEquals($expected, $result);
     $result = __c('Some string with %s %s', 6, array('multiple', 'arguments'));
     $expected = 'Some string with multiple arguments';
     $this->assertEquals($expected, $result);
 }
开发者ID:pritten,项目名称:SmartCitizen.me,代码行数:24,代码来源:BasicsTest.php

示例15: test__c

 /**
  * test __c()
  *
  * @access public
  * @return void
  */
 function test__c()
 {
     Configure::write('Config.language', 'rule_1_po');
     $result = __c('Plural Rule 1', 6, true);
     $expected = 'Plural Rule 1 (translated)';
     $this->assertEqual($result, $expected);
     $result = __c('Plural Rule 1 (from core)', 6, true);
     $expected = 'Plural Rule 1 (from core translated)';
     $this->assertEqual($result, $expected);
     ob_start();
     __c('Plural Rule 1 (from core)', 6);
     $result = ob_get_clean();
     $expected = 'Plural Rule 1 (from core translated)';
     $this->assertEqual($result, $expected);
 }
开发者ID:surfingtonio,项目名称:flashub.com,代码行数:21,代码来源:basics.test.php


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