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


PHP Fx::path方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: addAdminAssets

 public static function addAdminAssets()
 {
     if (fx::isAdmin()) {
         $path = fx::path('@module/Floxim/Ui/Grid');
         fx::page()->addJsFile($path . '/grid-builder.js');
         fx::page()->addCssBundle(array($path . '/grid-builder.less'));
     }
 }
开发者ID:floxim,项目名称:module-ui,代码行数:8,代码来源:Grid.php

示例6: 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

示例7: getConfigSources

 protected function getConfigSources()
 {
     $sources = array();
     $c_name = $this->getControllerName();
     $com_file = fx::path('@module/' . fx::getComponentPath($c_name) . '/cfg.php');
     if (file_exists($com_file)) {
         $sources[] = $com_file;
     }
     return $sources;
 }
开发者ID:floxim,项目名称:floxim,代码行数:10,代码来源:Widget.php

示例8: dropDictFiles

 public function dropDictFiles($dict)
 {
     $files = glob(fx::path('@files/php_dictionaries/*.' . $dict . '.php'));
     if (!$files) {
         return;
     }
     foreach ($files as $file) {
         unlink($file);
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:10,代码来源:Finder.php

示例9: route

 public function route($url = null, $context = null)
 {
     if (!fx::isAdmin()) {
         return null;
     }
     if (!preg_match("~^/\\~ib/(\\d+|fake(?:\\-\\d+)?)@(\\d+)~", $url, $ib_info)) {
         return null;
     }
     $c_url = fx::input()->fetchGetPost('_ajax_base_url');
     if ($c_url) {
         $_SERVER['REQUEST_URI'] = $c_url;
         $path = fx::router()->getPath(fx::path()->removeBase($c_url));
         if ($path) {
             fx::env('page', $path->last());
         } else {
             fx::env('page', fx::router('error')->getErrorPage());
         }
         $c_url = parse_url($c_url);
         if (isset($c_url['query'])) {
             parse_str($c_url['query'], $_GET);
         }
     }
     $ib_id = $ib_info[1];
     $page_id = $ib_info[2];
     if (!fx::env('page') && $page_id) {
         $page = fx::data('floxim.main.content', $page_id);
         fx::env('page', $page);
     }
     fx::env('ajax', true);
     $page_infoblocks = fx::router('front')->getPageInfoblocks($page_id, fx::env('layout'));
     fx::page()->setInfoblocks($page_infoblocks);
     // import layout template to recreate real env
     fx::router('front')->importLayoutTemplate();
     // front end can try to reload the layout which is out of date
     // when updating from "layout settings" panel
     $infoblock = fx::data('infoblock', $ib_id);
     if (!$infoblock && isset($_POST['infoblock_is_layout']) || $infoblock->isLayout()) {
         //$infoblock = $layout_infoblock;
         $infoblock = fx::router('front')->getLayoutInfoblock(fx::env('page'));
     }
     fx::http()->status('200');
     $infoblock_overs = null;
     if (fx::isAdmin() && isset($_POST['override_infoblock'])) {
         $infoblock_overs = fx::input('post', 'override_infoblock');
         if (is_string($infoblock_overs)) {
             parse_str($infoblock_overs, $infoblock_overs);
             $infoblock_overs = fx::input()->prepareSuperglobal($infoblock_overs);
         }
         $infoblock->override($infoblock_overs);
     }
     $infoblock->overrideParam('ajax_mode', true);
     $res = $infoblock->render();
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:54,代码来源:Infoblock.php

示例10: scaffold

 protected function scaffold(\Floxim\Floxim\Component\Widget\Entity $com, $overwrite = false)
 {
     $source_path = fx::path('@floxim/Console/protected/widget');
     $component_path = $com->getPath();
     $file_list = $this->buildFileList($source_path, $component_path);
     foreach ($file_list as &$file_data) {
         $file_data['callback_content'] = function ($content) use($com) {
             return Widget::replacePlaceholder($content, $com);
         };
     }
     $this->copyFiles($file_list);
 }
开发者ID:floxim,项目名称:floxim,代码行数:12,代码来源:Widget.php

示例11: show

 public function show($input)
 {
     $this->response->breadcrumb->addItem(fx::alang('Console'), '#admin.console.show');
     $this->response->submenu->setMenu('console');
     $fields = array('console_text' => array('name' => 'console_text', 'type' => 'text', 'code' => 'htmlmixed', 'value' => isset($input['console_text']) ? $input['console_text'] : '<?php' . "\n"));
     $fields[] = $this->ui->hidden('entity', 'console');
     $fields[] = $this->ui->hidden('action', 'execute');
     $this->response->addFormButton(array('label' => fx::alang('Execute') . ' (Ctrl+Enter)', 'is_submit' => false, 'class' => 'execute'));
     $this->response->addFields($fields);
     fx::page()->addJsFile(fx::path('@floxim') . '/Admin/js/console.js');
     return array('show_result' => 1);
 }
开发者ID:floxim,项目名称:floxim,代码行数:12,代码来源:Console.php

示例12: getConfigSources

 protected function getConfigSources()
 {
     $sources = array();
     $sources[] = fx::path('@module/' . fx::getComponentPath('floxim.main.content') . '/cfg.php');
     $com = $this->getComponent();
     $chain = $com->getChain();
     foreach ($chain as $com) {
         $com_file = fx::path('@module/' . fx::getComponentPath($com['keyword']) . '/cfg.php');
         if (file_exists($com_file)) {
             $sources[] = $com_file;
         }
     }
     return $sources;
 }
开发者ID:floxim,项目名称:module-main,代码行数:14,代码来源:Controller.php

示例13: getPath

 public function getPath($url, $site_id = null)
 {
     $url = fx::path()->removeBase($url);
     $url = preg_replace("~\\#.*\$~", '', $url);
     if (is_null($site_id)) {
         $site_id = fx::env('site_id');
     }
     // @todo check if url contains another host name
     $url = preg_replace("~^https?://.+?/~", '/', $url);
     foreach ($this->routers as $rk => $r) {
         $result = $r['router']->getPath($url, $site_id);
         if ($result) {
             return $result;
         }
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:16,代码来源:Manager.php

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

示例15: handleThumbs

 protected function handleThumbs()
 {
     fx::listen('unlink', function ($e) {
         $f = $e['file'];
         if (fx::files()->isMetaFile($f)) {
             return;
         }
         if (fx::path()->isInside($f, fx::path('@thumbs'))) {
             return;
         }
         if (!fx::path()->isInside($f, fx::path('@content_files'))) {
             return;
         }
         $thumbs = \Floxim\Floxim\System\Thumb::findThumbs($f);
         foreach ($thumbs as $thumb) {
             fx::files()->rm($thumb);
         }
     });
 }
开发者ID:floxim,项目名称:module-main,代码行数:19,代码来源:Module.php


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