本文整理汇总了PHP中Floxim\Floxim\System\Fx::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::config方法的具体用法?PHP Fx::config怎么用?PHP Fx::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUpdates
public function checkUpdates()
{
$stored = $this->all();
$url = fx::config('fx.update_url') . '?action=find&from=' . fx::version();
@($res = file_get_contents($url));
if (!$res) {
return false;
}
$res = @json_decode($res);
if ($res) {
foreach ($res as $patch) {
if ($stored->findOne('to', $patch->to)) {
continue;
}
$new_patch = $this->create(array('to' => $patch->to, 'from' => $patch->from, 'url' => $patch->url, 'created' => $patch->created));
if ($patch->from == fx::version()) {
$new_patch['status'] = 'ready';
} else {
$new_patch['status'] = 'pending';
}
$new_patch->save();
}
}
return true;
}
示例2: getProfiler
protected function getProfiler()
{
$profile = fx::config('dev.profile_controllers');
if ($profile) {
return fx::profiler();
}
}
示例3: setLang
public function setLang($lang = null)
{
if (!$lang) {
$this->lang = fx::config('lang.admin');
} else {
$this->lang = $lang;
}
}
示例4: getAvailableBlocks
public function getAvailableBlocks($page, $area_meta = null)
{
$controllers = fx::data('component')->all();
$controllers->concat(fx::data('widget')->all());
$result = array('controllers' => array(), 'actions' => array(), 'groups' => array('content' => array('name' => 'Данные'), 'content:infoblock' => array('name' => 'Новые данные', 'description' => 'Добавьте пустой блок и заполните его новыми данными.'), 'content:filtered' => array('name' => 'Данные по фильтру', 'description' => 'Добавьте блок для отображения существующих данных — всех, или ограниченных набором условий.'), 'content:selected' => array('name' => 'Данные, отобранные вручную', 'description' => 'Добавьте блок и внесите в него уже существующие данные, выбрав их из списка.'), 'widget' => array('name' => 'Виджеты')));
foreach ($controllers as $c) {
if (fx::config()->isBlockDisabled($c['keyword'])) {
continue;
}
$type = $c instanceof Component\Entity ? 'component' : 'widget';
$keyword = $c['keyword'];
$result['controllers'][$keyword] = array('name' => $c['name'], 'keyword' => $keyword, 'type' => $type);
$ctrl = fx::controller($keyword);
$actions = $ctrl->getActions();
foreach ($actions as $action_code => $action_info) {
// do not show actions starting with "_"
if (preg_match("~^_~", $action_code)) {
continue;
}
if (fx::config()->isBlockDisabled($c['keyword'], $action_code)) {
continue;
}
if (isset($action_info['check_context'])) {
$is_avail = call_user_func($action_info['check_context'], $page);
if (!$is_avail) {
continue;
}
}
$act_ctr = fx::controller($keyword . ':' . $action_code);
$act_templates = $act_ctr->getAvailableTemplates(fx::env('layout'), $area_meta);
if (count($act_templates) == 0) {
continue;
}
$action = array('controller' => $keyword, 'keyword' => $action_code, 'name' => $action_info['name'], 'id' => $keyword . ':' . $action_code);
if (isset($action_info['group'])) {
$action['group'] = $action_info['group'];
} elseif ($type === 'component' && preg_match("~^list_(.+)\$~", $action_code, $list_type)) {
$action['group'] = 'content';
$list_type = $list_type[1];
$action['subgroup'] = in_array($list_type, array('infoblock', 'selected')) ? $list_type : 'filtered';
} else {
$action['group'] = 'widget';
}
if (empty($action['name'])) {
$action['name'] = $action_code;
}
$result['actions'][] = $action;
}
}
//fx::log($result);
return $result;
}
示例5: execute
public function execute($input)
{
if ($input['console_text']) {
ob_start();
$code = $input['console_text'];
fx::env('console', true);
fx::config('dev.on', true);
$code = self::preProcess($code);
eval($code);
$res = ob_get_clean();
return array('result' => $res);
}
}
示例6: route
public function route($url = null, $context = null)
{
$adm_path = '/' . fx::config('path.admin_dir_name') . '/';
if (trim($url, '/') === trim($adm_path, '/') && $url !== $adm_path) {
fx::http()->redirect(fx::config('paht.admin'), 301);
}
if ($url !== $adm_path) {
return null;
}
$input = fx::input()->makeInput();
$entity = fx::input()->fetchPost('entity');
$action = fx::input()->fetchPost('action');
if (!$entity || !$action) {
fx::page()->setBaseUrl(FX_BASE_URL . '/' . trim($adm_path, '/'));
return new Controller\Admin();
}
$base_url = fx::input()->fetchPost('_base_url');
if ($base_url) {
$base_path = fx::router()->getPath(fx::path()->removeBase($base_url));
if ($base_path) {
fx::env('page', $base_path->last());
}
}
fx::env('ajax', true);
$posting = fx::input()->fetchPost('posting');
if (!preg_match("~^module_~", $entity) || fx::input()->fetchPost('fx_admin')) {
$entity = 'admin_' . $entity;
}
if ($posting && $posting !== 'false') {
$action .= "_save";
}
$path = explode('_', $entity, 2);
if ($path[0] == 'admin') {
$classname = 'Floxim\\Floxim\\Admin\\Controller\\' . fx::util()->underscoreToCamel($path[1]);
} else {
// todo: psr0 what?
}
try {
$controller = new $classname($input, $action);
} catch (\Exception $e) {
die("Error! Entity: " . htmlspecialchars($entity));
}
//header("Content-type: application/json; charset=utf-8");
return $controller;
}
示例7: getByHostName
public function getByHostName($host = '')
{
if (!$host) {
$host = fx::config()->HTTP_HOST;
}
$host = preg_replace("~^https?://~i", '', $host);
$host = preg_replace("~/\$~", '', $host);
$sites = $this->all();
if (count($sites) === 1) {
return $sites->first();
}
// search for the domain and the mirrors
foreach ($sites as $site) {
if (in_array($host, $site->getAllHosts())) {
return $site;
}
}
return $sites->first();
}
示例8: __construct
public function __construct()
{
$this->options['login'] = 'admin';
$this->options['action_link'] = fx::config('path.admin');
$this->addMoreMenu(Controller\Adminpanel::getMoreMenu());
$this->addButtons(Controller\Adminpanel::getButtons());
$main_menu = array('manage' => array('name' => fx::alang('Management', 'system'), 'key' => 'manage', 'href' => '/floxim/#admin.administrate.site.all'), 'develop' => array('name' => fx::alang('Development', 'system'), 'key' => 'develop', 'href' => '/floxim/#admin.component.all'));
$site = fx::env('site');
if ($site) {
$main_menu['site'] = array('name' => fx::env('site')->getLocalDomain(), 'key' => 'site', 'href' => '/');
$other_sites = fx::data('site')->where('id', $site['id'], '!=')->all();
if (count($other_sites) > 0) {
$main_menu['site']['children'] = array();
foreach ($other_sites as $other_site) {
$domain = $other_site->getLocalDomain();
$main_menu['site']['children'][] = array('name' => $domain, 'href' => 'http://' . $domain . '/');
}
}
}
$this->addMainMenu($main_menu);
}
示例9: route
/**
* Perform all registered routers, to return most suitable controller
* @param string $url
* @param array $context
* @return fx_controller
*/
public function route($url = null, $context = array())
{
if (is_null($url)) {
$url = getenv('REQUEST_URI');
}
if (!isset($context['site_id'])) {
$env_site = fx::env('site');
$context['site_id'] = $env_site ? $env_site['id'] : null;
}
foreach ($this->routers as $router_key => $r) {
$result = $r['router']->route($url, $context);
if ($result !== null && $result !== false) {
$log_option = fx::config('dev.log_routes');
if (is_bool($log_option) && $log_option || is_array($log_option) && in_array($router_key, $log_option) || is_string($log_option) && $log_option === $router_key) {
fx::log('routed', $router_key, $url);
}
if ($result instanceof \Floxim\Floxim\System\Controller) {
$result = $result->process();
}
return $result;
}
}
}
示例10: updateVersionNumber
protected function updateVersionNumber($new_version)
{
fx::config('fx.version', $new_version);
fx::config()->store('fx.version');
}
示例11: getFullPath
public function getFullPath()
{
return fx::config()->DOCUMENT_ROOT . $this->getHttpPath();
}
示例12: isFresh
public function isFresh($target_path)
{
$cache = fx::config('templates.cache');
// template caching is disabled
if (!$cache) {
return false;
}
$ttl = fx::config('templates.ttl');
// file is not created yet
if (!file_exists($target_path)) {
return false;
}
// cache forever
if ($ttl === 0) {
return true;
}
// file is older than ttl
if (time() - filemtime($target_path) > $ttl) {
return false;
}
return true;
}
示例13: dirname
<?php
use Floxim\Floxim\System\Fx as fx;
// current dir /vendor/floxim/floxim/console/
require_once dirname(__DIR__) . '/../../../boot.php';
$manager = new \Floxim\Floxim\System\Console\Manager();
$manager->addCommands(fx::config('console.commands'));
$manager->addPath(__DIR__ . '/Command');
$manager->run();
示例14: addAdminFiles
public static function addAdminFiles()
{
$path_floxim = fx::path('@floxim');
$lang = fx::config('lang.admin');
$js_files = array(FX_JQUERY_PATH, $path_floxim . '/lib/js/jquery.bem.js', $path_floxim . '/Admin/js/fxj.js', $path_floxim . '/Admin/js/fx.js', $path_floxim . '/Admin/js/js-dictionary-' . $lang . '.js', FX_JQUERY_UI_PATH, $lang === 'en' ? null : $path_floxim . '/lib/js/jquery.datepicker.' . $lang . '.js', $path_floxim . '/lib/js/jquery.ba-hashchange.min.js', $path_floxim . '/lib/js/jquery.json-2.3.js', $path_floxim . '/lib/js/ajaxfileupload.js', $path_floxim . '/Admin/js-templates/jstx.js', 'http://' . getenv("HTTP_HOST") . fx::path()->http($path_floxim) . '/Admin/js-templates/compile.php', $path_floxim . '/Admin/js/lib.js', $path_floxim . '/Admin/js/sort.js', $path_floxim . '/Admin/js/front.js', $path_floxim . '/Admin/js/adder.js', $path_floxim . '/Admin/js/buttons.js', $path_floxim . '/Admin/js/form.js', $path_floxim . '/Admin/js/debug.js', $path_floxim . '/Admin/js/livesearch.js', $path_floxim . '/Admin/js/fields.js', $path_floxim . '/Admin/js/edit-in-place.js', $path_floxim . '/Admin/js/panel.js', $path_floxim . '/Admin/js/popup.js', $path_floxim . '/Admin/js/admin.js', $path_floxim . '/Admin/js/nav.js', $path_floxim . '/lib/editors/redactor/redactor.patched.js', $lang === 'en' ? null : $path_floxim . '/lib/editors/redactor/langs/' . $lang . '.js', $path_floxim . '/lib/editors/redactor/fontcolor.js', $path_floxim . '/lib/codemirror/codemirror.all.min.js', $path_floxim . '/lib/js/jquery.form.js', $path_floxim . '/lib/js/jquery.cookie.js', $path_floxim . '/lib/js/jquery.ba-resize.min.js', $path_floxim . '/lib/js/jquery.scrollTo.js', $path_floxim . '/Admin/js/map.js', $path_floxim . '/Admin/js/node-panel.js', $path_floxim . '/Admin/js/infoblock.js');
$page = fx::page();
$page->addJsBundle($js_files, array('name' => 'fx_admin'));
$page->addCssFile('https://fonts.googleapis.com/css?family=Roboto:400,500,400italic,500italic,700,700italic&subset=latin,cyrillic');
// todo: need fix path for css - now used server path
$page->addCssBundle(array($path_floxim . '/lib/editors/redactor/redactor.css'));
$page->addCssBundle(array($path_floxim . '/Admin/style/mixins.less', $path_floxim . '/Admin/style/main.less', $path_floxim . '/Admin/style/backoffice.less', $path_floxim . '/Admin/style/forms.less', $path_floxim . '/Admin/style/front.less', $path_floxim . '/Admin/style/livesearch.less', $path_floxim . '/Admin/style/debug.less', $path_floxim . '/lib/codemirror/codemirror.css'), array('name' => 'admin_less'));
}
示例15: strings
public function strings($input)
{
$lang_id = isset($input['id']) ? $input['id'] : isset($input['params'][0]) ? $input['params'][0] : null;
$lang = fx::data('lang', $lang_id);
$list = array('type' => 'list', 'filter' => false, 'tpl' => 'imgh', 'entity' => 'lang', 'values' => array());
$list['labels'] = array('dict' => array('label' => fx::alang('Dictionary', 'system'), 'filter' => 'select'), 'string' => array('label' => fx::alang('String', 'system'), 'filter' => 'text'), 'value' => array('label' => fx::alang('Value', 'system'), 'filter' => 'text', 'editable' => array('entity' => 'lang', 'action' => 'string', 'lang' => $lang_id)));
$strings = fx::data('lang_string')->order('dict')->order('string')->all();
foreach ($strings as $s) {
$list['values'][] = array('id' => $s['id'], 'dict' => $s['dict'], 'string' => $s['string'], 'value' => $s['lang_' . $lang['lang_code']]);
}
$fields = array('strings' => $list);
$this->response->addFields($fields);
$lang_name = fx::config('lang.admin') == $lang['lang_code'] ? $lang['native_name'] : $lang['en_name'];
$this->response->breadcrumb->addItem(fx::alang('Languages', 'system'), '#admin.lang.all');
$this->response->breadcrumb->addItem($lang_name, '#admin.lang.edit(' . $lang['id'] . ')');
$this->response->breadcrumb->addItem(fx::alang('Language strings'), '#admin.lang.strings(' . $lang['id'] . ')');
$this->response->submenu->setMenu('lang');
}