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


PHP C::g方法代码示例

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


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

示例1: update

 public static function update($data)
 {
     //CHECK
     $checks = array('defaultLanguage' => 'is_string-!is_empty', 'availableLanguages' => 'is_array-!is_empty', 'defaultBaseUrl' => 'is_string-!is_empty', 'availableBaseUrl' => 'is_array-!is_empty');
     if (!KLib\Validator::arrayCheck($data, $checks)) {
         throw new Exception('INVALID CONFIG DATA', 500);
     }
     if (!array_key_exists($data['defaultLanguage'], C::g('LIST_LANGUAGE'))) {
         throw new Exception('INVALID CONFIG DATA', 500);
     }
     foreach ($data['availableLanguages'] as $id) {
         if (!array_key_exists(strtoupper($id), C::g('LIST_LANGUAGE'))) {
             throw new Exception('INVALID CONFIG DATA', 500);
         }
         $availableLanguages[] = "'" . strtoupper($id) . "'";
     }
     if (!filter_var('http://' . $data['defaultBaseUrl'], FILTER_VALIDATE_URL)) {
         throw new Exception('INVALID CONFIG DATA', 500);
     }
     foreach ($data['availableBaseUrl'] as $id) {
         if (!filter_var('http://' . $id, FILTER_VALIDATE_URL)) {
             throw new Exception('INVALID CONFIG DATA', 500);
         }
         $availableBaseUrls[] = "'" . $id . "'";
     }
     $raw = "<?php\n### Default language\n### Index of LIST_LANGUAGE\nC::s('DEFAULT_LANG', '" . $data['defaultLanguage'] . "');\n### Language available\n### List of index of LIST_LANGUAGE\nC::s('DEFAULT_AVAILABLE_LANG', array(" . implode(', ', $availableLanguages) . "));\n###  Default baseUrl\n### eg. 'www.korona.io'\nC::s('DEFAULT_BASEURL', '" . $data['defaultBaseUrl'] . "');\n###  List of available baseUrl\n### eg. 'www.korona.io'\nC::s('DEFAULT_AVAILABLE_BASEURL', array(" . implode(', ', $availableBaseUrls) . "));";
     return file_put_contents(self::$configPath, $raw);
 }
开发者ID:monkeytie,项目名称:korona,代码行数:28,代码来源:configfile.class.php

示例2: setType

 public function setType($data)
 {
     if (!is_string($data) || !array_key_exists($data, C::g('MENUITEM_TYPE'))) {
         throw new Exception('INVALID MENUITEM TYPE PARAMETER', 500);
     }
     $this->type = $data;
 }
开发者ID:monkeytie,项目名称:korona,代码行数:7,代码来源:menuitem.class.php

示例3: updatePo

 public function updatePo()
 {
     if (KLib\File::fileNameExtension($_FILES['file']['name']) != 'po') {
         throw new Exception('FORBIDDEN ACCESS', 403);
     }
     if (move_uploaded_file($_FILES['file']['tmp_name'], $this->path . C::g('LANG_DOMAIN_CURRENT') . '.po')) {
         return array('error' => 'OK');
     }
     return array('error' => 'FAIL');
 }
开发者ID:monkeytie,项目名称:korona,代码行数:10,代码来源:translate.ctrl.php

示例4: go

 /**
  * Init a routing algo
  * @param string  $from      URL source if not provide, Route::go will determine the good route from $_SERVER parameter
  * @return mixed[]
  */
 public static function go($published = true, $lang = 'FR', $host = null)
 {
     $host = !is_string($host) ? $_SERVER['HTTP_HOST'] : $host;
     C::s('FULLURL', 'http://' . $host);
     if (array_key_exists('HTTPS', $_SERVER)) {
         C::s('FULLURL', 'https://' . $host);
     }
     $uri = parse_url($_SERVER['REQUEST_URI']);
     if (substr($uri['path'], -1) == '/') {
         $uri['path'] = substr($uri['path'], 0, -1);
     }
     $route = self::getRoute($host, $uri['path'], $_SERVER['REQUEST_METHOD']);
     if (!is_a($route, 'KLib\\Router')) {
         //PAGE
         $data = \Page::getByUrl($host, $uri['path'], $lang, $published);
         if (!is_a($data, 'Page') && $lang != C::g('DEFAULT_LANG')) {
             $data = \Page::getByUrl($host, $uri['path'], C::g('DEFAULT_LANG'), $published);
         }
         if (!is_a($data, 'Page')) {
             throw new \Exception('PAGE NOT FOUND', 404);
         }
         $route = new Self($data->getBaseUrl(), $uri['path'], $data->getAction(), $data->getMethod(), array_merge($_GET, array('page' => $data)));
     }
     if (!is_a($route, 'KLib\\Router')) {
         throw new \Exception('PAGE NOT FOUND', 404);
     }
     return BaseController::run($route->getController(), $route->getAction(), $route->getArgs());
 }
开发者ID:monkeytie,项目名称:korona,代码行数:33,代码来源:routerkorona.class.php

示例5: f

<?php

error_reporting(E_ALL | E_STRICT);
trait T
{
    protected function f()
    {
        return 1;
    }
    private function p()
    {
        return 2;
    }
    function g()
    {
        return $this->f();
    }
    function h()
    {
        return $this->p();
    }
}
class C
{
    use T;
}
$c = new C();
echo $c->g();
echo $c->h();
开发者ID:badlamer,项目名称:hhvm,代码行数:29,代码来源:2058.php

示例6: urls

 public function urls()
 {
     return array('static' => C::g('STATICURL'));
 }
开发者ID:monkeytie,项目名称:korona,代码行数:4,代码来源:list.ctrl.php

示例7: remove

 /**
  * Remove the page
  *
  * @param string $collection Collection to store
  * @return null
  */
 public function remove()
 {
     //LOAD
     $datas = json_decode(file_get_contents(C::g('AUTH_FILE')), true);
     //REMOVE
     foreach ($datas as $k => $d) {
         if ($d['id'] == $this->id) {
             unset($datas[$k]);
         }
     }
     file_put_contents(C::g('AUTH_FILE'), json_encode(array_values($datas), JSON_PRETTY_PRINT));
     return true;
 }
开发者ID:monkeytie,项目名称:korona,代码行数:19,代码来源:kadmin.class.php

示例8: f1

<?php

class B
{
    public function f1()
    {
        var_dump(get_called_class());
        if ($this !== null) {
            var_dump(get_class($this));
        } else {
            var_dump(null);
        }
        echo "\n";
    }
}
class C extends B
{
    public function g()
    {
        $obj = new B();
        forward_static_call(array('B', 'f1'));
        call_user_func(array('B', 'f1'));
    }
}
$obj = new C();
$obj->g();
开发者ID:badlamer,项目名称:hhvm,代码行数:26,代码来源:fsc02.php

示例9: setLanguage

 public function setLanguage($data)
 {
     if (!is_string($data) || empty($data) || !array_key_exists(strtoupper($data), C::g('LIST_LANGUAGE'))) {
         $data = C::g('DEFAULT_LANG');
     }
     $this->language = strtoupper($data);
 }
开发者ID:monkeytie,项目名称:korona,代码行数:7,代码来源:menu.class.php

示例10: view

 public function view()
 {
     $ret = array('defaultLanguage' => C::g('DEFAULT_LANG'), 'availableLanguages' => C::g('DEFAULT_AVAILABLE_LANG'), 'defaultBaseUrl' => C::g('DEFAULT_BASEURL'), 'availableBaseUrl' => C::g('DEFAULT_AVAILABLE_BASEURL'));
     return $ret;
 }
开发者ID:monkeytie,项目名称:korona,代码行数:5,代码来源:config.ctrl.php

示例11: f

class C
{
    /**
     * @return self
     */
    function f()
    {
        return $this;
    }
    /**
     * @return static
     */
    function g()
    {
        return $this;
    }
    /**
     * @return $this
     */
    function h()
    {
        return $this;
    }
    function test(C $c)
    {
    }
}
$c = new C();
$f = $c->test($c->f());
$g = $c->test($c->g());
$h = $c->test($c->h());
开发者ID:ablyler,项目名称:phan,代码行数:31,代码来源:0053_self_static_this.php

示例12: setLanguage

 public function setLanguage($data)
 {
     if (!is_string($data) || empty($data) || !in_array(strtoupper($data), C::g('DEFAULT_AVAILABLE_LANG'))) {
         $data = C::g('DEFAULT_LANG');
     }
     $this->language = strtoupper($data);
 }
开发者ID:monkeytie,项目名称:korona,代码行数:7,代码来源:page.class.php

示例13:

RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/page/{is_mongoid}', 'Page::delete', 'DELETE');
//KADMIN
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user', 'Kadmin::all', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user', 'Kadmin::add', 'POST');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user/already', 'Kadmin::already', 'POST');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user/{is_string}', 'Kadmin::view', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user/{is_string}', 'Kadmin::update', 'PUT');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/user/{is_string}', 'Kadmin::delete', 'DELETE');
//MENU
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/menu', 'Menu::all', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/menu', 'Menu::add', 'POST');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/menu/{is_mongoid}', 'Menu::view', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/menu/{is_mongoid}', 'Menu::update', 'PUT');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/menu/{is_mongoid}', 'Menu::delete', 'DELETE');
//CONFIG
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/config', 'Config::view', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/config', 'Config::update', 'PUT');
//SEO
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/robot', 'Seo::robotView', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/robot', 'Seo::robotUpdate', 'PUT');
//BLOCK
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/block', 'Block::list', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/block/clone/{is_mongoid}', 'Block::clone', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/block/{is_mongoid}', 'Block::view', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/block/{is_mongoid}', 'Block::update', 'PUT');
//TRANSLATE
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/translate/po', 'Translate::po', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/translate/pot', 'Translate::pot', 'GET');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/translate/po', 'Translate::updatePo', 'POST');
RK::a(C::g('DEFAULT_BASEURL'), '/kadmin/translate/mo', 'Translate::updateMo', 'POST');
开发者ID:monkeytie,项目名称:korona,代码行数:30,代码来源:router.inc.php

示例14: session_name

session_name('KNSESSID');
session_start();
require_once __DIR__ . '/global.inc.php';
try {
    Router::loadPost();
    Router::loadGet();
    $published = true;
    if (isset($_GET['force']) && $_GET['force'] == '1') {
        $published = null;
    }
    KLib\RouterKorona::go($published);
} catch (Exception $e) {
    //LOG EXCEPTION
    if (!in_array($e->getCode(), array(200, 204, 542))) {
        KLib\Log::info($e->getCode() . ' ' . $e->getMessage());
        if (C::g('DEV')) {
            KLib\Log::warning("\n" . $e->getTraceAsString());
        }
        header('Content-Type: text/html');
    }
    //FORMAT EXCEPTION
    switch ($e->getCode()) {
        case 204:
            header('HTTP/1.1 204 OK');
            break;
        case 401:
            KLib\BaseController::run('error', 'authenticate', array('exception' => $e));
            break;
        case 403:
            KLib\BaseController::run('error', 'forbidden', array('exception' => $e));
            break;
开发者ID:monkeytie,项目名称:korona,代码行数:31,代码来源:index.php

示例15: setLanguage

 public function setLanguage($data)
 {
     if (!is_string($data) || empty($data)) {
         throw new Exception('INVALID LANGUAGE BLOCK PARAMETER', 500);
     }
     if (in_array(strtoupper($data), C::g('DEFAULT_AVAILABLE_LANG'))) {
         $this->language = strtoupper($data);
     } else {
         $this->language = C::g('DEFAULT_LANG');
     }
 }
开发者ID:monkeytie,项目名称:korona,代码行数:11,代码来源:block.class.php


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