本文整理汇总了PHP中core::in_editor方法的典型用法代码示例。如果您正苦于以下问题:PHP core::in_editor方法的具体用法?PHP core::in_editor怎么用?PHP core::in_editor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::in_editor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_urls
function make_urls()
{
if (core::in_editor()) {
$this->append_urls('children', sprintf('?m=sat&c=menu&pid=%d', $this->id));
$this->append_urls('self', sprintf('?m=sat&c=menu&pid=%d', $this->pid));
}
}
示例2: __construct
/**
* Build filter
* @param IAbs_Collection object
* @param string base url
*/
function __construct(IAbs_Collection $collection, $base_url = false)
{
$this->set_collection($collection);
if (false !== $base_url) {
$this->base_url = $base_url;
}
if (core::in_editor()) {
$this->url_template = "&start={page}";
}
$this->config = new collection_params($this->config ? $this->config : null);
$this->configure();
}
示例3: make_urls
function make_urls()
{
if (core::in_editor()) {
$this->append_urls('parent', '?m=extrafs&c=group');
}
}
示例4: init0
/**
* init0
*/
function init0()
{
core::dprint('[users] init0');
// link
// $this->auth = core::lib('auth');
$return = parent::init0();
$this->_cp_links = array();
// lookup links array
$this->_cp_links = $this->load_cp_links();
// kick acls
if (core::in_editor() && $this->with_acls()) {
$this->get_acl_handle();
}
/**
* Links for logged users
*/
if ($this->auth->logged_in()) {
$admin = 'admin' == $this->get_current_user()->get_level();
if ($admin) {
$this->_cp_links['admin'] = array('title' => $this->translate('cp_admin'), 'url' => '/editor/');
}
/*
if ($this->get_current_user()->level >= 50)
$this->_cp_links['mod'] = array('title' => $this->translate('cp_mod') , 'url' => '/users/cp/mod/');
*/
// $this->_cp_links['pms'] = array('title' => $this->translate('cp_pms') , 'url' => '/users/cp/pms/');
}
return $return;
}
示例5: class_register
/**
* Create or retrieve object bu class
*
* module name prefixed with {@see loader::CLASS_PREFIX}
*
* @param string module_name
* @param array config ( order_sql , where_sql, limit_sql )
* tpl_table - template name block
* @param boolean standalone (регистрировать в системе или нет)
*
* @return object (&by ref)
*
* @throws core_exception
*/
function class_register($module, $config = array(), $standalone = false)
{
$tmp = false;
/* check modules path
if yes, make namespace for it
*/
$path_prefix = $this->root_dir;
/* standalone class support
without register in $core->classes db
class naming:
/classes/module/
+- collection (module_collection)
+- item (module_item)
*/
$m_class = $module . '_collection';
// chroot support
// [tf]obsolete: auto chroot to module
$f_class_path = $path_prefix . 'classes/' . $module . '/';
$f_class = array($f_class_path . 'collection' . loader::DOT_PHP, $f_class_path . 'item' . loader::DOT_PHP);
if (!class_exists($m_class)) {
if (!fs::file_exists($f_class[0]) || !fs::file_exists($f_class[1])) {
core::dprint("[color=red][ERROR CLASS_REGISTER] file not found; [/color] {$module} ({$f_class_path})");
core::dprint($f_class);
throw new core_exception("Class register failed : {$module} in " . $path_prefix, core::E_ERROR);
return $tmp;
// false;
}
require_once $f_class[0];
require_once $f_class[1];
}
if (!$standalone && isset($this->classes[$module])) {
return $this->classes[$module];
}
/* use prefix
render to {$tpl_table}
sql from {$table}
*/
$table_ = $module;
$config['prefix'] = core::get_instance()->get_cfg_var(array('database', 'prefix'));
$table_ = $config['prefix'] . $table_;
// if not passed, set to module tag
if (!isset($config['tpl_table'])) {
$config['tpl_table'] = $module;
}
// new one
$config_ = array('load' => true, 'table' => $table_, 'root' => $f_class_path);
if ($config !== false) {
$config_ = array_merge($config_, $config);
}
// preload fix
if (isset($config['no_preload'])) {
unset($config_['load']);
}
// In editor, check for class with 'editor_' prefix
if (core::in_editor()) {
$editor_class = 'editor_' . $m_class;
if (class_exists($editor_class)) {
$m_class = $editor_class;
}
$config_['in_editor'] = true;
}
$tmp = new $m_class($config_);
if ($standalone) {
return $tmp;
}
$this->classes[$module] = $tmp;
return $this->classes[$module];
}
示例6: init91
/**
кэш только для основного домена.
на алиасах не работает!
*/
function init91()
{
if (core::in_editor() || loader::in_ajax() || loader::in_shell()) {
return;
}
// @todo cancel on errors!
if (tf_exception::get_last_exception()) {
return;
}
// check current site
if (!($tsite = $this->get_current_site()) || !$tsite->is_staticable()) {
return;
}
/* save static cache!
skip logged in users, debug mode
*/
if ($this->get_core()->cfg('sat_use_static') && !core::lib('auth')->logged_in() && !core::is_debug()) {
$file = $this->get_static_node_path($tnode = $this->get_router()->get_current_node());
$pagination_filter = $this->get_router()->get_filter('pagination');
if ($pagination_filter && ($page = $pagination_filter->get_start())) {
$file = str_replace('/index.html', "/page/{$page}/index.html", $file);
}
core::dprint(array('generate staic : %s', $file), core::E_DEBUG4);
if (!file_exists($file)) {
$dir = dirname($file);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
file_put_contents($file, core::lib('renderer')->get_buffer());
}
}
}
示例7: 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
}
*/
}
示例8: apply
/**
* Apply a sets Filter
*
* Remember: in editor data auto rendered thru render2edt()!
*
* @throws collection_filter_exception
*
* @return object {pagination, filters, data}
*/
function apply()
{
// prepend config
// make shure no "limit sql" in it!
$config = $this->config;
// where sql prepare
if (isset($config['where_sql'])) {
$where_sql_ = $this->collection->get_cfg_var('where_sql');
if (!empty($where_sql_)) {
$config['where_sql'] = $where_sql_ . ' AND ' . $config['where_sql'];
}
}
// map filter config to collection
foreach ($config as $k => $v) {
$this->collection->set_cfg_var($k, $v);
}
// apply user filters
$this->collection_filters();
$this->count = $this->collection->count_sql();
core::dprint('[FILTER] Apply for ' . $this->collection->get_domain() . ' x ' . $this->count);
if ($this->pagination_limit * $this->pagination_start > $this->count + $this->pagination_limit) {
throw new collection_filter_exception('Invalid range ' . $this->pagination_limit * $this->pagination_start . ' > ' . $this->count);
}
// real page 0=1, 2...
$real_page = $this->pagination_start > 1 ? $this->pagination_start - 1 : 0;
$this->collection->set_limit($this->pagination_limit, $real_page * $this->pagination_limit);
$this->collection->load();
// generate_pagination
$this->pagination = $this->paginate($this->base_url, $this->count, $this->pagination_limit, $this->pagination_start);
return core::in_editor() ? $this->render2edt() : $this->render();
}
示例9: output
/**
* Final output
* called from @see core::shutdown
*/
public function output()
{
/** give up if in crontab */
if (loader::in_shell()) {
return false;
}
$core = core::get_instance();
if (!empty($this->_content_type) && !headers_sent()) {
header('Content-Type: ' . $this->_content_type . '; charset=' . $core->get_cfg_var('charset'));
}
// disabled
if ($this->_disable_output) {
return false;
}
$cfg_data = array();
// initial
$this->output_begin();
if (core::in_editor()) {
$this->output_editor($tpl);
} else {
$tpl = $this->page_template;
}
// check message
if ($msg = $core->get_message()) {
if ($temp_tpl = $this->render_message($msg)) {
$tpl = $temp_tpl;
}
}
// no template
if (empty($tpl)) {
core::dprint('render with empty page template assigned');
//throw new renderer_exception('render with empty page template assigned');
}
/*
Throwing exception here
Will result in
Fatal error: Exception thrown without a stack frame in Unknown on line 0
*/
if (false == $this->get_main_template()) {
core::dprint('render with empty main template assigned');
// throw new renderer_exception('render with empty main template assigned');
}
// append
$tpl .= loader::DOT_TPL;
$this->output_end($tpl);
}
示例10: output
/**
* Final output
* called from @see core::shutdown
*/
public function output()
{
if (loader::in_ajax()) {
return $this->output_ajax();
}
/** give up if in crontab */
if (loader::in_shell()) {
return false;
}
$core = core::get_instance();
core::dprint('renderer::ouput', core::E_DEBUG0);
$this->content_type_header();
// disabled
if ($this->_disable_output) {
return false;
}
$cfg_data = array();
// initial
$this->output_begin();
if (core::in_editor()) {
$this->output_editor();
}
$tpl = $this->page_template;
// check message
if ($msg = $core->get_message()) {
$this->render_message($msg, $core->get_message_data());
} elseif (!empty($this->_message)) {
$this->render_message($this->_message['message'], @$this->_message['data']);
}
// no template
if (empty($tpl)) {
core::dprint('render with empty page template assigned');
//throw new renderer_exception('render with empty page template assigned');
}
/*
Throwing exception here
Will result in
Fatal error: Exception thrown without a stack frame in Unknown on line 0
*/
if (false == $this->get_main_template()) {
core::dprint('render with empty main template assigned');
// throw new renderer_exception('render with empty main template assigned');
}
$this->output_end($tpl);
}