當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。