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


PHP loader::get_public方法代码示例

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


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

示例1: run

 function run()
 {
     /**@var tf_sat $sat */
     $sat = core::module('sat');
     $site = $sat->get_current_site();
     $json_file = loader::get_public('assets/' . $site->domain . '.json');
     $last_mod = @filemtime($json_file);
     $tree_last_mod = 0;
     if ($last_mod) {
         $last_node = $sat->get_node_handle()->set_where('site_id = %d', $sat->get_current_site_id())->set_order('updated_at DESC')->load_first();
         $tree_last_mod = $last_node ? $last_node->updated_at : 0;
         core::dprint(__METHOD__ . ': cached');
         // uptodate
         if ($tree_last_mod <= $last_mod) {
             $this->renderer->set_ajax_answer(file_get_contents($json_file))->ajax_flush();
             return;
         }
     }
     core::dprint(__METHOD__ . ': fetch!');
     $tree = $sat->get_current_site_tree();
     $allowedKeys = array('title', 'url');
     array_walk($tree, function (&$v) use($allowedKeys) {
         $v = array_intersect_key($v, array_flip($allowedKeys));
     });
     $tree = array_values($tree);
     // cache
     file_put_contents($json_file, functions::json_encode($tree));
     $this->renderer->set_ajax_answer($tree)->ajax_flush();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:29,代码来源:tree.php

示例2: __construct

 /**
  * Constructor
  */
 function __construct($config)
 {
     $this->_config = $config;
     $this->persistency = @$config['persistency'];
     $this->user = @$config['login'];
     $this->password = @$config['password'];
     $this->server = isset($config['server']) ? $config['server'] : 'localhost';
     $this->dbname = @$config['database'];
     $this->prefix = @$config['prefix'];
     $this->root = loader::get_public();
     if (is_callable(array($this, 'configure'))) {
         $this->configure($config);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:17,代码来源:dbal.php

示例3: ob_implicit_flush

<?php

/**
 * Runs test in concurrent queue
 *
 * @param chroot directory core/_tests/config
 */
use Symfony\Component\Process\Process;
require "loader.php";
ob_implicit_flush(true);
$out = array();
$sourceDir = __DIR__;
if (!empty($argv[1])) {
    $sourceDir = loader::get_public('modules/' . $argv[1]);
}
fs::build_tree($sourceDir, $out, false, '\\.php$');
// убираем loader и ru-all.php
foreach ($out['files'] as $k => $v) {
    if (preg_match('@(loader|run\\-all)\\.php$@', $v)) {
        unset($out['files'][$k]);
    }
}
// $files = array_splice($out['files'], 2);
$files = $out['files'];
test_assertions::$successed = 0;
test_assertions::$failed = 0;
test_assertions::$start_time = microtime(1);
$concurrent = 10;
$processes = [];
$file = null;
$kfile = 0;
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:31,代码来源:run-all.php

示例4: get_static_node_path

 /**
  * Called in non-debug mode!
  * Check for errors
  *     
  * @param mixed $node
  * @return string
  */
 function get_static_node_path($node)
 {
     // @todo on error, $node empty too!
     $domain = '';
     if (!$node) {
         // this is / index
         $url = '/';
         $domain = $this->get_current_site()->get_domain();
     } else {
         // node
         $url = $node->get_url();
         $domain = $node->get_site()->get_domain();
     }
     core::dprint(array('[!] Generate static %s', $url));
     $urls = explode('/', $url);
     foreach ($urls as &$u) {
         if (loader::is_windows()) {
             $u = iconv('UTF-8', 'WINDOWS-1251', $u);
             // @fixme windows?
         }
     }
     $url = join('/', $urls);
     if (substr($url, -1, 1) == '/') {
         $url .= 'index.html';
     }
     $url = loader::get_public() . 'static/' . $domain . '/' . substr($url, 1);
     return $url;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:35,代码来源:module.php

示例5: file_exists

 /**
  * Check file presents
  * @param string file name
  * @param mixed FALSE(default) - filename must be full path, otherwise ROOT_PATH added
  */
 public static function file_exists($name, $prefix = false)
 {
     return file_exists(($prefix === false ? '' : loader::get_public()) . $name);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:9,代码来源:fs.php

示例6: error_reporting

error_reporting(0);
// Set E_ALL for debuging
require "./Authorize.php";
if (!elFinderIsAuthed()) {
    die('You shall not pass!!!');
}
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderConnector.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinder.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderVolumeDriver.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderVolumeLocalFileSystem.class.php';
// Required for MySQL storage connector
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// Required for FTP connector support
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
/**
 * Simple function to demonstrate how to control file access using "accessControl" callback.
 * This method will disable accessing files/folders starting from  '.' (dot)
 *
 * @param  string  $attr  attribute name (read|write|locked|hidden)
 * @param  string  $path  file path relative to volume root directory started with directory separator
 * @return bool|null
 **/
function access($attr, $path, $data, $volume)
{
    return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
    // else elFinder decide it itself
}
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => loader::get_uploads(), 'URL' => '/uploads/', 'accessControl' => 'access'), array('driver' => 'LocalFileSystem', 'path' => loader::get_public('templates'), 'URL' => '/templates/', 'accessControl' => 'access')));
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:31,代码来源:connector.php

示例7: register

 /**
  * Register module
  * @throws modules_exception
  * @return core_module
  */
 public function register($module, $params = null)
 {
     $module_class = isset($params['class']) ? $params['class'] : $module;
     $module_class = (isset($params['prefix']) ? $params['prefix'] : loader::CLASS_PREFIX) . $module_class;
     $module_path_orig = loader::DIR_MODULES . $module . '/';
     $module_path = loader::get_public();
     $module_path .= isset($params['path']) ? $params['path'] : loader::DIR_MODULES . $module;
     $module_path .= '/';
     $module_file = $module_path;
     $module_file .= (isset($params['file']) ? $params['file'] : 'module') . loader::DOT_PHP;
     core::dprint(array('module::register %s, %s', $module, $module_class), core::E_DEBUG0);
     if (!fs::file_exists($module_file)) {
         core::dprint_r(array($module_class, $module_file));
         throw new module_exception('Failed to register module ' . $module . '. File does not exists');
     }
     require_once $module_file;
     if (!class_exists($module_class, 0)) {
         throw new module_exception('Cant load module ' . $module . ', wrong config?');
     }
     // autotag module, if alternative class used
     if (!isset($params['tag']) && !empty($params['class'])) {
         $params['tag'] = $module;
     }
     $module_path = loader::fix_path(loader::get_public() . (!empty($params['chroot']) ? $module_path : $module_path_orig));
     $this->set($module, new $module_class($module_path, $params));
     $newb = $this->get($module);
     $newb->init_config($this->_get_module_config($module), abs_config::INIT_APPEND);
     return $newb;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:34,代码来源:modules.php

示例8: process_modify


//.........这里部分代码省略.........
         // reuse name, if it here already
         if (!empty($current['file'])) {
             // unlink?
             $citem->format_field_on_remove($vf, $fld, $current);
         }
         // $naming = isset($vf['unique']) ? (md5(microtime(true)) . '.' . $pinfo['extension']) : false;
         $naming = functions::url_hash() . '.' . $pinfo['extension'];
         // dd($naming, $path);
         if (!empty($vf['spacing'])) {
             $path .= '/' . substr($naming, 0, $vf['spacing']);
         }
         if (!is_dir($path) && !@mkdir($path, 0777, 1)) {
             throw new collection_exception('Upload error. Cant create directory: ' . $path);
         }
         $file = $uploader->upload_file($fld, $path, $naming, array('force_override' => true));
         // check for bad image
         $exists = false;
         if (!$file || !($exists = file_exists($file)) || !getimagesize($file)) {
             if ($exists) {
                 unlink($file);
             }
             throw new collection_exception('Upload error. invalid file');
         }
         // fix bad \\
         $fld['file'] = str_replace(array('\\\\', '\\'), '/', $file);
         // override type with extension
         $fld['type'] = $pinfo['extension'];
         if (!empty($vf['original'])) {
             copy($fld['file'], preg_replace('@\\.([^\\.]+)$@', '.orig.$1', $fld['file']));
         }
         // make max_width
         if (!empty($vf['max_width']) || !empty($vf['max_height'])) {
             core::lib('images')->resample_image_bigger($fld['file'], $fld['file'], @$vf['max_width'], @$vf['max_height']);
         }
         // {{{thumbnail}}}
         // ------------------------------------------------
         if (!empty($vf['thumbnail'])) {
             $t_props = $vf['thumbnail'];
             $t_file = preg_replace('@\\.([^\\.]+)$@', '.thumb.$1', $fld['file']);
             $t_height = false;
             $t_filter = false;
             if (is_array($t_props)) {
                 if (isset($t_props['width'])) {
                     //fullpros
                     $t_height = @intval($t_props['height']);
                     $t_width = @intval($t_props['width']);
                     $t_filter = @$t_props['filter'];
                 } elseif (isset($t_props['format'])) {
                     // see below, for b.c.
                 } else {
                     //(x,y)
                     $t_height = $t_props[1];
                     $t_width = $t_props[0];
                 }
             } else {
                 $t_width = (int) $t_props;
             }
             if (isset($t_props['format'])) {
                 // with Wideimage
                 self::runWideImage($fld['file'], $t_file, $t_props['format']);
             } else {
                 // resample_image($src, $dst, $new_width, $new_height = false)
                 if ($t_width > 0) {
                     core::lib('images')->resample_image($fld['file'], $t_file, $t_width, $t_height);
                 } else {
                     // just copy
                     copy($fld['file'], $t_file);
                 }
             }
             // filter for thumbnail
             if (isset($t_filter['id'])) {
                 core::lib('images')->image_filter($t_file, $t_file, $t_filter['id'], @$t_filter['params']);
             }
         }
         // {{{/thumbnail}}}
         // make width
         if (!empty($vf['width']) && !empty($vf['height'])) {
             core::lib('images')->resample_image($fld['file'], $fld['file'], $vf['width'], $vf['height']);
         }
         if (isset($vf['format'])) {
             // with Wideimage
             self::runWideImage($fld['file'], $fld['file'], $vf['format']);
         }
         // filter
         if (isset($vf['filter'])) {
             core::lib('images')->image_filter($fld['file'], $fld['file'], $vf['filter']['id'], @$vf['filter']['params']);
         }
         if (!empty($vf['watermark'])) {
             $wm_file = loader::get_public($vf['watermark']['file']);
             core::lib('images')->watermark($fld['file'], $fld['file'], $wm_file, @$vf['watermark']['options']);
         }
         unset($fld['error']);
         unset($fld['tmp_name']);
         // relative to app-path?
         // what if on another server
     } else {
         $fld = $current;
     }
     return $fld;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:101,代码来源:image.php

示例9: set_template

 /**
  * Set root
  */
 static function set_template($template)
 {
     if (core::in_editor()) {
         self::$template_dir = loader::get_public() . loader::DIR_EDITOR . loader::DIR_TEMPLATES;
     } else {
         self::$template_dir = loader::get_public() . loader::DIR_TEMPLATES . $template;
     }
     self::$parser->template_dir = self::$template_dir;
     /*
      * If using template, compile directory must exists /cache/tpl/{template}
      */
     $c_postfix = core::in_editor() ? 'editor/' : $template . '/';
     self::$parser->compile_dir = loader::get_root(loader::DIR_TEMPLATES_C . $c_postfix);
     self::$parser->cache_dir = loader::get_root(loader::DIR_TEMPLATES_C . $c_postfix);
     if (!file_exists(self::$parser->compile_dir)) {
         mkdir(self::$parser->compile_dir, 0777, true);
         // chmod this right
     }
     /*
     if (!file_exists(self::$parser->cache_dir)) {            
         mkdir(self::$parser->cache_dir, 0777, true); // chmod this right
     }
     */
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:27,代码来源:tpl_loader.php

示例10: create_upload_dir

 /**
  * Create uploads
  */
 function create_upload_dir()
 {
     if ($dir = $this->get_uploads_path()) {
         $dir = loader::get_public() . $dir;
         return mkdir($dir, 0770);
     }
     return false;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:11,代码来源:item.php

示例11: define

<?php

/**
 * Sape interface
 * 
 * @package    SatCMS
 * @author     Golovkin Vladimir <r00t@skillz.ru> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: sape.php,v 1.2 2009/08/05 08:45:21 surg30n Exp $
 */
$_su = core::get_instance()->get_cfg_var('sape_user');
if (!empty($_su)) {
    if (!defined('_SAPE_USER')) {
        define(_SAPE_USER, $_su);
    }
    require_once loader::get_public($_su . '/sape.php');
}
if (!class_exists('SAPE_client')) {
    class SAPE_client
    {
        function SAPE_client($p = array())
        {
            // mock
            core::dprint('[LIB_SAPE] Using mock', core::E_ERROR);
        }
    }
}
class sape extends SAPE_client
{
    function __construct()
    {
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:31,代码来源:sape.php

示例12: import_langwords

 /**
  * Parse module langwords into one
  * huge array. Used in templates later.
  * Module lang start with m_
  * [lang.var]
  */
 public function import_langwords($module)
 {
     $lang = $this->cfg('lang');
     $lang_file = loader::get_public(loader::DIR_MODULES) . $module . '/' . loader::DIR_LANGS . $lang;
     if (fs::file_exists($lang_file)) {
         $temp = parse_ini_file($lang_file, true);
         //self::dprint('..language ' . $lang_file . " (x" . count($temp) . ")", core::E_DEBUG1);
         if ('core' == $module) {
             $this->langwords = array_merge_recursive($this->langwords, $temp);
         } else {
             $this->langwords['_' . $module] = $temp;
         }
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:20,代码来源:core.php

示例13: get_template_root

 function get_template_root($template = null)
 {
     if (!isset($template)) {
         return $this->template_root;
     }
     return loader::fix_path(loader::get_public() . core::get_instance()->get_cfg_var('site_url') . loader::DIR_TEMPLATES . $template . '/');
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:7,代码来源:renderer.php


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