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


PHP Config::app方法代码示例

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


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

示例1: encoding

 public static function encoding()
 {
     if (is_null(static::$encoding)) {
         static::$encoding = Config::app('encoding');
     }
     return static::$encoding;
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:7,代码来源:html.php

示例2: parsePath

 public function parsePath($path)
 {
     $path = Tools::parsePath($path);
     if (strpos($path, '/') === 0) {
         $path = substr($path, 1);
     }
     $app = substr($path, 0, strpos($path, '/'));
     if ($app && file_exists(INJI_SYSTEM_DIR . '/program/' . $app)) {
         $path = substr($path, strpos($path, '/') + 1);
         if (\App::$cur->name != $app) {
             $scriptApp = new App();
             $scriptApp->name = $app;
             $scriptApp->system = true;
             $scriptApp->staticPath = "/" . $scriptApp->name . "/static";
             $scriptApp->templatesPath = "/" . $scriptApp->name . "/static/templates";
             $scriptApp->path = INJI_SYSTEM_DIR . '/program/' . $scriptApp->name;
             $scriptApp->type = 'app' . ucfirst(strtolower($scriptApp->name));
             $scriptApp->installed = true;
             $scriptApp->params = [];
             $scriptApp->config = Config::app($scriptApp);
         } else {
             $scriptApp = \App::$cur;
         }
     } else {
         $scriptApp = \App::$cur->system ? \App::$primary : \App::$cur;
     }
     if (strpos($path, 'static/') !== false && strpos($path, 'static/') <= 1) {
         $path = substr($path, strpos($path, 'static') + 7);
     }
     $type = substr($path, 0, strpos($path, '/'));
     switch ($type) {
         case 'libs':
             return App::$cur->Libs->getPath(array_slice(explode('/', $path), 2));
         case 'templates':
             $path = substr($path, strpos($path, '/') + 1);
             return $scriptApp->view->templatesPath . '/' . $path;
         case 'system':
             $path = substr($path, strpos($path, '/') + 1);
             return INJI_SYSTEM_DIR . '/static/' . $path;
         case 'moduleAsset':
             $path = substr($path, strpos($path, '/') + 1);
             if (!strpos($path, '/')) {
                 return false;
             }
             $module = substr($path, 0, strpos($path, '/'));
             if (!$scriptApp->{$module}) {
                 return false;
             }
             $path = substr($path, strpos($path, '/') + 1);
             if (is_callable([$module, 'staticCalled'])) {
                 return $scriptApp->{$module}->staticCalled($path, $scriptApp->{$module}->path . '/static/');
             }
             return $scriptApp->{$module}->path . '/static/' . $path;
         default:
             return $scriptApp->path . '/static/' . $path;
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:57,代码来源:StaticLoader.php

示例3: open

 public static function open($action, $method = 'POST', $attributes = array())
 {
     $attributes['method'] = static::method(strtoupper($method));
     $attributes['action'] = static::action($action);
     if (!array_key_exists('accept-charset', $attributes)) {
         $attributes['accept-charset'] = Config::app('encoding');
     }
     return '<form' . Html::attributes($attributes) . '>';
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:9,代码来源:form.php

示例4: format

 public static function format($date, $format = null)
 {
     // set the meta format
     if (is_null($format)) {
         $format = Config::meta('date_format', 'jS F, Y');
     }
     $date = new DateTime($date, new DateTimeZone('GMT'));
     $date->setTimezone(new DateTimeZone(Config::app('timezone')));
     return $date->format($format);
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:10,代码来源:date.php

示例5: currentUser

 static function currentUser()
 {
     $cookie = new CookieSigner(Config::app()['BASE_KEY']);
     if (isset($_SESSION['userId']) && ($userId = $_SESSION['userId'])) {
         $user = new User();
         return $user->findOne($userId);
     } else {
         if ($userId = $cookie->get('userId')) {
             $user = new User();
             $user->findOne($userId);
             if ($user && $user->isAuthenticated('remember', $cookie->get('rememberToken'))) {
                 self::logIn($user);
                 return $user;
             }
         }
     }
     return null;
 }
开发者ID:arjayads,项目名称:php-simple-auth,代码行数:18,代码来源:Session.php

示例6: configureAction

 public function configureAction()
 {
     $appOptions = Apps\App::get(filter_input(INPUT_GET, 'item_pk', FILTER_SANITIZE_NUMBER_INT));
     $app = new App();
     $app->name = $appOptions->name;
     $app->system = true;
     $app->staticPath = "/" . $appOptions->dir . "/static";
     $app->templatesPath = "/" . $appOptions->dir . "/static/templates";
     $app->path = INJI_PROGRAM_DIR . '/' . $appOptions->dir;
     $app->type = 'app';
     $app->installed = true;
     $app->params = [];
     $app->config = Config::app($app);
     $modules = Module::getInstalled($app, $app);
     $inputs = [];
     foreach ($modules as $module) {
         $info = Module::getInfo($module);
         if (!empty($info['configure'])) {
             $config = Config::module($module, false, $app);
             foreach ($info['configure'] as $optionName => $params) {
                 if (filter_input(INPUT_POST, $optionName)) {
                     $config[$optionName] = filter_input(INPUT_POST, $optionName);
                     Config::save('module', $config, $module, $app);
                 }
                 $input = [];
                 $input['name'] = $optionName;
                 $input['type'] = $params['type'];
                 $input['label'] = $params['label'];
                 $input['options']['value'] = !empty($config[$optionName]) ? $config[$optionName] : '';
                 $input['options']['values'] = ['' => 'Не выбрано'];
                 $input['options']['values'] += $params['model']::getList(['forSelect' => true, 'key' => $params['col']]);
                 $inputs[] = $input;
             }
         }
     }
     if (!empty($_POST)) {
         Tools::redirect('/setup');
     }
     $this->view->page(['data' => compact('inputs')]);
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:40,代码来源:AppsController.php

示例7: relative_time

function relative_time($date)
{
    if (is_numeric($date)) {
        $date = '@' . $date;
    }
    $user_timezone = new DateTimeZone(Config::app('timezone'));
    $date = new DateTime($date, $user_timezone);
    // get current date in user timezone
    $now = new DateTime('now', $user_timezone);
    $elapsed = $now->format('U') - $date->format('U');
    if ($elapsed <= 1) {
        return 'Just now';
    }
    $times = array(31104000 => 'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second');
    foreach ($times as $seconds => $title) {
        $rounded = $elapsed / $seconds;
        if ($rounded > 1) {
            $rounded = round($rounded);
            return $rounded . ' ' . pluralise($rounded, $title) . ' ago';
        }
    }
}
开发者ID:Justin417,项目名称:SimpleBlogDesign,代码行数:22,代码来源:functions.php

示例8: date_default_timezone_set

<?php

/*
 * Set your applications current timezone
 */
date_default_timezone_set(Config::app('timezone', 'UTC'));
/*
 * Define the application error reporting level based on your environment
 */
switch (constant('ENV')) {
    case 'dev':
        ini_set('display_errors', true);
        error_reporting(-1);
        break;
    default:
        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
}
/*
 * Set autoload directories to include your app models and libraries
 */
Autoloader::directory(array(APP . 'models', APP . 'libraries'));
/**
 * Helpers
 */
require APP . 'helpers' . EXT;
/**
 * Anchor setup
 */
Anchor::setup();
/**
 * Import defined routes
开发者ID:Rictus,项目名称:CMS_Prod,代码行数:31,代码来源:run.php

示例9:

<h1>Установка модулей</h1>
<form>
    <?php 
$config = Config::app(App::$primary ? App::$primary : App::$cur);
$modules = array_flip(Module::getInstalled(App::$cur));
$systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2);
foreach ($systemModules as $module) {
    $info = Module::getInfo($module);
    if (!$info || isset($modules[$module])) {
        continue;
    }
    ?>
        <div class ="form-group">
            <div class="checkbox">
                <label>
                    <input type ="checkbox" name ="modules[]" value ="<?php 
    echo $module;
    ?>
" /> <?php 
    echo $info['name'];
    ?>
                </label>
            </div>
        </div>
        <?php 
}
?>
    <button class="btn btn-primary">Установить</button>
</form>
开发者ID:krvd,项目名称:cms-Inji,代码行数:29,代码来源:install.php

示例10: install

 public function install($module, $params = [])
 {
     $installed = Module::getInstalled(App::$primary);
     if (in_array($module, $installed)) {
         return true;
     }
     $info = Module::getInfo($module);
     if (!empty($info['requires'])) {
         foreach ($info['requires'] as $requireModuleName) {
             $this->install($requireModuleName);
         }
     }
     $config = Config::app();
     $type = 'modules';
     $path = INJI_SYSTEM_DIR . '/modules/';
     $location = 'modules';
     $config[$location][] = $module;
     if (!empty($info['autoload'])) {
         $config['autoloadModules'][] = $module;
     }
     if (!empty($info['menu'])) {
         foreach ($info['menu'] as $appType => $items) {
             $this->addInMenu($items, $appType);
         }
     }
     Config::save('app', $config, null, App::$primary);
     if (file_exists($path . $module . '/install_script.php')) {
         $installFunction = (include $path . $module . '/install_script.php');
         $installFunction(1, $params);
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:31,代码来源:Modules.php

示例11: path

 private static function path($file)
 {
     $language = Config::app('language', 'en_GB');
     return APP . 'language/' . $language . '/' . $file . '.php';
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:5,代码来源:language.php

示例12: function

        $input['status'] = 'spam';
    }
    $comment = Comment::create($input);
    Notify::success(__('comments.created'));
    // dont notify if we have marked as spam
    if (!$spam and Config::meta('comment_notifications')) {
        $comment->notify();
    }
    return Response::redirect($posts_page->slug . '/' . $slug . '#comment');
});
/**
 * Rss feed
 */
Route::get(array('rss', 'feeds/rss'), function () {
    $uri = 'http://' . $_SERVER['HTTP_HOST'];
    $rss = new Rss(Config::meta('sitename'), Config::meta('description'), $uri, Config::app('language'));
    $query = Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc');
    foreach ($query->get() as $article) {
        $rss->item($article->title, Uri::full(Registry::get('posts_page')->slug . '/' . $article->slug), $article->description, $article->created);
    }
    $xml = $rss->output();
    return Response::create($xml, 200, array('content-type' => 'application/xml'));
});
/**
 * Json feed
 */
Route::get('feeds/json', function () {
    $json = Json::encode(array('meta' => Config::get('meta'), 'posts' => Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc')->get()));
    return Response::create($json, 200, array('content-type' => 'application/json'));
});
/**
开发者ID:gautamkrishnar,项目名称:Anchor-CMS-openshift-quickstart,代码行数:31,代码来源:site.php

示例13: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     DB::table('firewall')->where('typeofsave', 'temporary')->where('created_at', '>', date("Y-m-d H:i:s", time() + Config::app('firewall.timeip')))->delete();
 }
开发者ID:z7d,项目名称:ip-firewall,代码行数:9,代码来源:FirewallConsole.php

示例14: asset

?>
">

		<link rel="stylesheet" media="(max-width: 980px), (max-device-width: 480px)" href="<?php 
echo asset('anchor/views/assets/css/small.css');
?>
">

		<meta http-equiv="X-UA-Compatible" content="chrome=1">
		<meta name="viewport" content="width=600">
	</head>
	<body class="<?php 
echo Auth::guest() ? 'login' : 'admin';
?>
 <?php 
echo str_replace('_', '-', Config::app('language'));
?>
">

		<?php 
echo Notify::read();
?>

		<header class="top">
			<div class="wrap">
				<?php 
if (Auth::user()) {
    ?>
				<nav>
					<ul>
						<li class="logo">
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:31,代码来源:header.php

示例15: array

     $vars['pages'] = Page::dropdown(array('exclude' => array($id), 'show_empty_option' => true));
     $vars['statuses'] = array('published' => __('global.published'), 'draft' => __('global.draft'), 'archived' => __('global.archived'));
     // extended fields
     $vars['fields'] = Extend::fields('page', $id);
     return View::create('pages/edit', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer')->partial('editor', 'partials/editor');
 });
 Route::post('admin/pages/edit/(:num)', function ($id) {
     $input = Input::get(array('parent', 'name', 'title', 'slug', 'content', 'status', 'redirect', 'show_in_menu'));
     // if there is no slug try and create one from the title
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     // convert to ascii
     $input['slug'] = slug($input['slug']);
     // encode title
     $input['title'] = htmlspecialchars($input['title'], ENT_QUOTES, Config::app('encoding'), false);
     $validator = new Validator($input);
     $validator->add('duplicate', function ($str) use($id) {
         return Page::where('slug', '=', $str)->where('id', '<>', $id)->count() == 0;
     });
     $validator->check('title')->is_max(3, __('pages.title_missing'));
     $validator->check('slug')->is_max(3, __('pages.slug_missing'))->is_duplicate(__('pages.slug_duplicate'))->not_regex('#^[0-9_-]+$#', __('pages.slug_invalid'));
     if ($input['redirect']) {
         $validator->check('redirect')->is_url(__('pages.redirect_missing'));
     }
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/pages/edit/' . $id);
     }
     if (empty($input['name'])) {
开发者ID:gautamkrishnar,项目名称:Anchor-CMS-openshift-quickstart,代码行数:31,代码来源:pages.php


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