本文整理汇总了PHP中Core::option方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::option方法的具体用法?PHP Core::option怎么用?PHP Core::option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::option方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public static function initialize(array $options = array())
{
foreach (self::$options as $k => $v) {
self::$options[$k] = str_replace('%files%', Core::option('files_name'), $v);
}
self::options($options);
}
示例2: file_path_for
public function file_path_for($module, $first = false)
{
$file = null;
foreach ($this->paths as $name => $roots) {
if (!is_array($roots)) {
$roots = array($roots);
}
$drop_prefix = $this->extract_prefix_from($name);
$parms = $this->parse_params_from($name);
foreach ($roots as $root) {
$module_template = $this->create_module_template_from($name);
if (preg_match($module_template, $module, $module_match)) {
$prefix = $this->set_parms_to($drop_prefix, $parms, $module_match);
$root = $this->set_parms_to($root, $parms, $module_match);
$file = $this->compose_file_path_for($module, $root, $prefix);
$file = $this->process_not_necessarily_part($file);
if (!is_file($file) && !$first) {
continue;
} else {
return $file;
}
}
}
}
if (!is_null($file)) {
return $file;
}
if (Core::option('spl_autoload')) {
return false;
} else {
throw new Core_ModuleNotFoundException($module);
}
}
示例3: initialize
/**
* Инициализация модуля
*
* @param array $options
*/
public static function initialize(array $options = array())
{
self::options($options);
self::$helpers = Object::Aggregator();
if (Core::option('deprecated')) {
self::$options['templates_root'][] = Core::tao_dir() . '/deprecated/views';
}
}
示例4: initialize
static function initialize($config = array())
{
foreach ($config as $key => $value) {
self::${$key} = $value;
}
if (!self::$dir) {
self::$dir = '../' . Core::option('files_name') . '/vars';
}
}
示例5: initialize
/**
* @param array $config
*/
static function initialize($config = array())
{
self::$files_dir = './' . Core::option('files_name') . '/vars';
foreach ($config as $key => $value) {
self::${$key} = $value;
}
Core::load('CMS.Vars.Types');
if (self::$type == 'orm') {
Core::load('CMS.Vars.ORM');
WS::env()->orm->submapper('vars', 'CMS.Vars.ORM.Mapper');
}
if (self::$type == 'storage') {
Core::load('Storage');
Storage::manager()->add('vars', 'CMS.Vars.Storage');
}
CMS::cached_run('CMS.Vars.Schema');
self::register_type('CMS.Vars.Types.Dir', 'CMS.Vars.Types.Integer', 'CMS.Vars.Types.String', 'CMS.Vars.Types.Text', 'CMS.Vars.Types.Html', 'CMS.Vars.Types.Array', 'CMS.Vars.Types.Mail', 'CMS.Vars.Types.HtmlP', 'CMS.Vars.Types.File');
CMS_Dumps::dumper('VARS', 'CMS.Dumps.Vars');
}
示例6: attaches
public function attaches($parms)
{
$id = (int) $parms['id'];
$attaches = array();
if (IO_FS::exists("./" . Core::option('files_name') . "/vars/{$id}")) {
foreach (IO_FS::Dir("./" . Core::option('files_name') . "/vars/{$id}") as $f) {
$fp = $f->path;
$attaches[$fp] = array('name' => $fp, 'path' => $f->path);
}
}
return $this->render('attaches', array('id' => $id, 'attaches' => $attaches));
}
示例7: load_module_file
/**
* Выполняет непосредствунную загрузкку файла модуля
*
* @param string $file
* @param string $class_name
* @param string $module
*
* @return Core_ModuleLoader
*/
protected function load_module_file($file, $class_name = '', $module = '')
{
if (Core::option('spl_autoload') && !$file) {
return false;
}
$path = realpath($file);
if (empty($path) && !class_exists($class_name, true)) {
//Даем сработать autoload
if (Core::option('spl_autoload')) {
return false;
} else {
throw new Core_ModuleNotFoundException($module, $file);
}
}
if (!empty($path)) {
include_once $path;
}
return Core::option('spl_autoload') ? true : $this;
}
示例8: homedir_location
protected function homedir_location($private = false)
{
return ($private ? '../' : '') . Core::option('files_name') . '/' . $this->mnemocode();
}
示例9: change
public function change($id, $data, $item)
{
if (is_object($item)) {
$item->id = $id;
}
$file = $_FILES['value'];
$name = trim($file['name']);
$tmp_name = trim($file['tmp_name']);
if ($tmp_name != '') {
$dir = "./" . Core::option('files_name') . "/vars/{$id}";
CMS::mkdirs($dir, 0775);
foreach (IO_FS::Dir($dir) as $f) {
@IO_FS::rm($f->path);
}
$name = CMS::translit(mb_strtolower($name));
$name = preg_replace('{\\s+}', '_', $name);
$name = trim(preg_replace('{[^a-z0-9_\\.\\-]}', '', $name));
if ($name == '') {
$name = 'noname';
}
if ($name[0] == '.') {
$name = "noname.{$name}";
}
move_uploaded_file($tmp_name, "{$dir}/{$name}");
chmod("{$dir}/{$name}", 0775);
$rc = CMS::vars()->on_change_call($id, $value, $data);
if (is_string($rc)) {
$item->valuesrc = $data['valuesrc'];
return $rc;
}
$item->value = "{$dir}/{$name}";
$item->update_value();
}
}
示例10: homedir
public function homedir($private = false)
{
$path = $private ? '../' : './';
$path .= Core::option('files_name');
$path .= '/varfiles/' . $this->id();
CMS::mkdirs($path);
return $path;
}
示例11: temp_dir
/**
* Возвращает имя каталога для хранения временных файлов
*
* @return string
*/
static function temp_dir()
{
if (self::$temp_dir === true) {
return rtrim(sys_get_temp_dir(), '/');
}
if (is_string(self::$temp_dir)) {
return rtrim(self::$temp_dir, '/');
}
if (isset(self::$cfg->site) && ($dir = self::$cfg->site->temp_dir)) {
return rtrim($dir, '/');
}
if (!IO_FS::exists('../' . Core::option('files_name') . '/tmp')) {
@self::mkdirs('../' . Core::option('files_name') . '/tmp');
}
if (IO_FS::exists('../' . Core::option('files_name') . '/tmp')) {
return '../' . Core::option('files_name') . '/tmp';
}
if (!IO_FS::exists('./' . Core::option('files_name') . '/tmp')) {
self::mkdirs('./' . Core::option('files_name') . '/tmp');
}
return './' . Core::option('files_name') . '/tmp';
}
示例12: path
public static function path($type, $path, $copy = true, $link = false)
{
$rc = Events::call('templates.asset.path', $type, $path, $copy, $link);
if (!is_null($rc)) {
return $rc;
}
$key = "{$type};{$path};{$copy};{$link}";
if (isset(self::$cached_paths[$key])) {
return self::$cached_paths[$key];
}
$path = self::extern_filepath($path, $copy, $link);
if (Templates::is_absolute_path($path) || self::is_url($path)) {
return self::$cached_paths[$key] = $path;
}
$urls = array();
foreach (self::option('assets') as $asset) {
if ($asset[0] == '.') {
$asset = self::option('extern_file_prefix') . $asset;
}
$url = sprintf("%s/%s/%s", $asset, self::option("{$type}_dir"), $path);
$url = self::extern_filepath($url, $copy, $link);
$urls[] = $url;
$file = ".{$url}";
if (is_file($file)) {
return self::$cached_paths[$key] = $url;
}
}
if (Core::option('deprecated')) {
$file = Core::tao_deprecated_file('files/' . self::option("{$type}_dir") . '/' . $path);
if (is_file($file)) {
return self::$cached_paths[$key] = self::extern_filepath(self::option('extern_file_prefix') . $file, $copy, $link);
}
}
return self::$cached_paths[$key] = null;
}
示例13: action_imagelist
public function action_imagelist()
{
$id = (int) $this->args[0];
$ar = array();
if (IO_FS::exists("./" . Core::option('files_name') . "/vars/{$id}")) {
foreach (IO_FS::Dir("./" . Core::option('files_name') . "/vars/{$id}") as $f) {
$fp = $f->path;
if ($m = Core_Regexps::match_with_results('{/([^/]+)$}', $fp)) {
$fp = $m[1];
}
$ar[] = '["' . $fp . '","' . CMS::file_url($f->path) . '"]';
}
}
echo 'var tinyMCEImageList = new Array(' . implode(',', $ar) . ');';
die;
}