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


PHP System\Fx类代码示例

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


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

示例1: run

 public function run($args = null)
 {
     if (!$args) {
         $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : array(__FILE__);
     } elseif (is_scalar($args)) {
         $arg_string = $args;
         $args = array(\Floxim\Floxim\System\Fx::path()->fileName(__FILE__));
         foreach (self::parseArgs($arg_string) as $arg) {
             $args[] = $arg;
         }
     }
     $this->scriptName = $args[0];
     array_shift($args);
     // Define command
     if (isset($args[0])) {
         $name = $args[0];
         array_shift($args);
     } else {
         $name = 'help';
     }
     // Create command
     if (!($command = $this->createCommand($name))) {
         $command = $this->createCommand('help');
     }
     return $command->run($args);
 }
开发者ID:floxim,项目名称:floxim,代码行数:26,代码来源:Manager.php

示例2: generate

 public function generate($params = array())
 {
     $form = $this->create($params);
     $form->is_generated = true;
     $form['fields'] = fx::collection();
     return $form;
 }
开发者ID:floxim,项目名称:module-form,代码行数:7,代码来源:Finder.php

示例3: getSavestring

 public function getSavestring(System\Entity $content = null)
 {
     $old_value = $content[$this['keyword']];
     $old_path = FX_BASE_URL . $old_value;
     if ($old_path === $this->value) {
         return $this->value;
     }
     $res = '';
     if (!empty($this->value)) {
         $c_val = fx::path()->abs($this->value);
         if (file_exists($c_val) && is_file($c_val)) {
             $file_name = fx::path()->fileName($c_val);
             $path = fx::path('@content_files/' . $content['site_id'] . '/' . $content['type'] . '/' . $this['keyword'] . '/' . $file_name);
             $path = fx::files()->getPutFilePath($path);
             fx::files()->move($c_val, $path);
             $res = fx::path()->removeBase(fx::path()->http($path));
         }
     }
     if (!empty($old_value)) {
         $old_value = fx::path()->abs($old_value);
         if (file_exists($old_value) && is_file($old_value)) {
             fx::files()->rm($old_value);
         }
     }
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:26,代码来源:File.php

示例4: route

 public function route($url = null, $context = null)
 {
     $thumbs_path = fx::path()->http('@thumbs');
     $thumbs_path_trimmed = fx::path()->removeBase($thumbs_path);
     if (substr($url, 0, strlen($thumbs_path_trimmed)) !== $thumbs_path_trimmed) {
         return null;
     }
     $dir = substr($url, strlen($thumbs_path_trimmed));
     preg_match("~/([^/]+)(/.+\$)~", $dir, $parts);
     $config = $parts[1];
     $source_path = $parts[2];
     $source_abs = fx::path($source_path);
     if (!file_exists($source_abs)) {
         return null;
     }
     $target_dir = dirname(fx::path('@home/' . $url));
     if (!file_exists($target_dir) || !is_dir($target_dir)) {
         return null;
     }
     $config = $config . '.async-false.output-true';
     $config = \Floxim\Floxim\System\Thumb::readConfigFromPathString($config);
     fx::image($source_path, $config);
     fx::complete();
     die;
 }
开发者ID:floxim,项目名称:floxim,代码行数:25,代码来源:Thumb.php

示例5: 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;
 }
开发者ID:floxim,项目名称:floxim,代码行数:25,代码来源:Finder.php

示例6: formatSettings

 public function formatSettings()
 {
     $fields = array();
     $fields[] = array('id' => 'format[source]', 'name' => 'format[source]', 'type' => 'hidden', 'value' => 'manual');
     $fields[] = array('name' => 'format[values]', 'label' => fx::alang('Elements', 'system'), 'type' => 'set', 'tpl' => array(array('name' => 'id', 'type' => 'string'), array('name' => 'value', 'type' => 'string')), 'values' => $this['format']['values'] ? $this['format']['values'] : array(), 'labels' => array('id', 'value'));
     return $fields;
 }
开发者ID:floxim,项目名称:floxim,代码行数:7,代码来源:Select.php

示例7: getSavestring

 public function getSavestring(System\Entity $content = null)
 {
     $old_value = $content[$this['keyword']];
     if ($old_value != $this->value) {
         if (!empty($old_value)) {
             $old_value = fx::path()->abs($old_value);
             if (file_exists($old_value) && is_file($old_value)) {
                 fx::files()->rm($old_value);
             }
         }
         if (!empty($this->value)) {
             $c_val = fx::path()->abs($this->value);
             if (file_exists($c_val) && is_file($c_val)) {
                 preg_match("~[^" . preg_quote(DIRECTORY_SEPARATOR) . ']+$~', $c_val, $fn);
                 $path = fx::path()->http('@content_files/' . $content['site_id'] . '/' . $content['type'] . '/' . $this['keyword'] . '/' . $fn[0]);
                 $try = 0;
                 while (fx::path()->exists($path)) {
                     $file_name = preg_replace("~(\\.[^\\.]+)\$~", "_" . $try . "\$1", $fn[0]);
                     $try++;
                     $path = fx::path()->http('@content_files/' . $content['type'] . '/' . $this['keyword'] . '/' . $file_name);
                 }
                 fx::files()->move($c_val, $path);
             }
         }
     }
     $res = isset($path) ? $path : $this->value;
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:28,代码来源:File.php

示例8: __construct

 public function __construct($context, $box_id, $loop = null)
 {
     if (fx::isAdmin()) {
         self::addAdminAssets();
         $this->avail = $this->getAvailFields($context);
     }
     $this->box_id = $box_id;
     $param_id = $this->getParamId();
     $data = $context->get($param_id);
     if (is_string($data) && !empty($data)) {
         $data = json_decode($data, true);
     }
     //fx::log($this, $data);
     if (!$data || !isset($data['is_stored'])) {
         $groups = $context->get('groups');
         $default_data = $this->prepareGroups($groups);
         $data = $data ? \Floxim\Floxim\System\Util::fullMerge($data, $default_data) : $default_data;
     }
     $this->data = $data;
     //fx::log('set data', $this->data);
     if ($loop) {
         $this->containing_loop = $loop;
         $box = $this;
         $loop->onStop(function () use($box) {
             $box->export();
         });
     }
 }
开发者ID:floxim,项目名称:module-ui,代码行数:28,代码来源:Box.php

示例9: getProfiler

 protected function getProfiler()
 {
     $profile = fx::config('dev.profile_controllers');
     if ($profile) {
         return fx::profiler();
     }
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:7,代码来源:Frontoffice.php

示例10: doNeighbours

 public function doNeighbours()
 {
     $item = fx::env('page');
     $q = $this->getFinder()->order(null)->limit(1)->where('site_id', fx::env('site_id'));
     $q_next = clone $q;
     $q_prev = clone $q;
     if ($this->getParam('sorting') === 'auto' && $item['infoblock_id']) {
         $item_ib_params = fx::data('infoblock', $item['infoblock_id'])->get('params');
         $ib_sorting = $item_ib_params['sorting'];
         $this->setParam('sorting', $ib_sorting == 'manual' || $ib_sorting == 'auto' ? 'priority' : $ib_sorting);
         $this->setParam('sorting_dir', $item_ib_params['sorting_dir']);
     }
     $sort_field = $this->getParam('sorting', 'priority');
     if ($sort_field === 'auto') {
         $sort_field = 'priority';
     }
     $dir = strtolower($this->getParam('sorting_dir', 'asc'));
     $where_prev = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '<' : '>'));
     $where_next = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '>' : '<'));
     $group_by_parent = $this->getParam('group_by_parent');
     if ($group_by_parent) {
         $c_parent = fx::content($item['parent_id']);
         // todo: psr0 need verify
         $q_prev->order('parent.priority', 'desc')->where('parent.priority', $c_parent['priority'], '<=');
         $q_next->order('parent.priority', 'asc')->where('parent.priority', $c_parent['priority'], '>=');
         $where_prev[] = array('parent_id', $item['parent_id'], '!=');
         $where_next[] = array('parent_id', $item['parent_id'], '!=');
     }
     $q_prev->order($sort_field, $dir == 'asc' ? 'desc' : 'asc')->where($where_prev, null, 'or');
     $prev = $q_prev->all();
     $q_next->order($sort_field, $dir)->where($where_next, null, 'or');
     $next = $q_next->all();
     //fx::log($q_prev->showQuery(), $q_next->showQuery());
     return array('prev' => $prev, 'current' => $item, 'next' => $next);
 }
开发者ID:floxim,项目名称:module-main,代码行数:35,代码来源:Controller.php

示例11: deleteInfoblocks

 protected function deleteInfoblocks()
 {
     $infoblocks = fx::data('infoblock')->where('site_id', $this['id'])->all();
     foreach ($infoblocks as $infoblock) {
         $infoblock->delete();
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:7,代码来源:Entity.php

示例12: getErrorPage

 public function getErrorPage($site_id = null)
 {
     if (is_null($site_id)) {
         $site_id = fx::env('site_id');
     }
     $error_page = fx::data('page', fx::data('site', $site_id)->get('error_page_id'));
     return $error_page;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:8,代码来源:Error.php

示例13: checkValueIsFile

 public static function checkValueIsFile($v)
 {
     if (empty($v)) {
         return false;
     }
     $files_path = fx::path('@files');
     $path = fx::path();
     return $path->isInside($v, $files_path) && $path->isFile($v);
 }
开发者ID:floxim,项目名称:floxim,代码行数:9,代码来源:Entity.php

示例14: getDateFormats

 public function getDateFormats()
 {
     $formats = array('j %month:gen% Y', '%Month% Y', 'd.m.Y', 'd/m/Y', 'H:i');
     $res = array();
     foreach ($formats as $f) {
         $res[$f] = fx::date(time(), $f);
     }
     return $res;
 }
开发者ID:floxim,项目名称:module-ui,代码行数:9,代码来源:Module.php

示例15: getBlocks

 public function getBlocks()
 {
     $area_id = $this->getAreaId();
     $blocks = fx::page()->getAreaInfoblocks($area_id);
     if (count($blocks) === 0) {
         return null;
     }
     return $blocks;
 }
开发者ID:floxim,项目名称:module-ui,代码行数:9,代码来源:Grid.php


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