本文整理汇总了PHP中core::get_params方法的典型用法代码示例。如果您正苦于以下问题:PHP core::get_params方法的具体用法?PHP core::get_params怎么用?PHP core::get_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::get_params方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_editor
/**
* on editor action
*
* Called in editor to module
*
* @return array(
* 'layout' = false
* 'template' = false
* )
*/
function on_editor()
{
core::lib('editor')->assign_module_menu($this->get_editor_actions());
// Controller action
$controller_action = '';
// modify ident var 'c' (if empty)
if (empty(core::get_params()->c) && !empty($this->editor_default_action)) {
core::get_params()->c = $this->editor_default_action;
}
$controller_action = preg_replace('/[^a-z\\d\\_]/i', '', core::get_params()->c);
core::dprint("on_editor controller: " . $controller_action);
if (empty($controller_action)) {
throw new editor_exception('Empty action');
}
// check user has access
core::lib('editor')->on_editor($this);
// dispatch
if (!empty($controller_action)) {
$controller_action_file = $this->root_dir . "editor/controllers/{$controller_action}" . loader::DOT_PHP;
if (fs::file_exists($controller_action_file, false)) {
require $controller_action_file;
// run controller object, if present
$controller_class = $this->get_name() . '_' . $controller_action . '_controller';
if (class_exists($controller_class, 0)) {
core::dprint("run controller object : {$controller_class}");
/** @var editor_controller $controller */
$controller = new $controller_class($this);
$controller->run();
$layout = $controller->get_layout();
$template = $controller->get_template();
$this->renderer->set_page_template($layout)->set_main_template($template);
} else {
throw new core_exception('Bad controller class name ' . $controller_class);
}
} else {
core::dprint('[ERROR] Unable to execute ' . $controller_action_file);
}
}
/* @return main template
*/
/*
return array(
'layout' => $layout,
'template' => $template
);
*/
}
示例2: define
* @package TwoFace
* @author Golovkin Vladimir <r00t@skillz.ru> http://www.skillz.ru
* @copyright SurSoft (C) 2008
* @version $Id: index.php,v 1.2.6.1 2008/10/24 13:19:05 j4ck Exp $
*/
define('IN_MAIN', 'I think so');
define('IN_EDITOR', 'Hell year');
require '../modules/core/loader.php';
// disable cache
functions::headers_no_cache();
if (!core::lib('auth')->logged_in() || 'admin' != core::lib('auth')->get_user()->get_level()) {
// disable auth
functions::redirect('/');
exit;
}
$module = core::get_params()->module;
if (!empty($module) && 'core' != $module) {
try {
if ($mod = core::module($module)) {
$mod->on_editor();
}
} catch (modules_exception $e) {
// module not found
core::get_instance()->error404('Module not found');
}
} else {
// core handler
core::get_instance()->on_editor();
}
// run
core::get_instance()->main();
示例3: die
<?php
/**
* @package TwoFace
* @author Golovkin Vladimir <r00t@skillz.ru> http://www.skillz.ru
* @copyright SurSoft (C) 2008
* @version $Id: hits.php,v 1.2 2008/03/31 08:02:57 j4ck Exp $
*
* Controller
*/
if (!defined('IN_MAIN')) {
die('hax0rs alert!');
}
// Узнаем глобальные параметры
$cmd_op = core::get_params()->op;
$cmd_id = core::get_params()->id;
// был сабмит
$is_submited = isset($_POST["item_submit"]);
// Заголовок станицы
$this->core->set_cfg_var('title', 'Шаблоны рассылки');
// class name (handler)
$cdata = $this->posts;
// single item load hack
if ($cmd_op == 'edit' || $cmd_op == 'drop' || $is_submited && !empty($cmd_id)) {
$cdata->set_cfg_var('load_only_id', $cmd_id);
/* при удалении, загружаем все данные для блока
(чтобы собственно их удалить) */
$cdata->load();
}
/* Удаление позиции [ajax]
*/
示例4: array
/**
* Post create/update method
* Context: users controller
*
* @package TwoFace
* @author Golovkin Vladimir <r00t@skillz.ru> http://www.skillz.ru
* @copyright SurSoft (C) 2008
* @version $Id: post_text.php,v 1.2 2008/05/22 07:58:07 surg30n Exp $
*/
// template set up automatically
// $this->set_template('user_cp/post_text');
if (!defined('IN_MAIN')) {
die;
}
if (isset($post['post_submit'])) {
$id = core::get_params('id');
if (empty($id)) {
$cat_id = (int) $post['cat_id'];
$category = $content->get_category($cat_id);
if (!$category) {
throw new controller_exception('Bad category in post submit');
}
$data = array('faculty_id' => $category->pid, 'cat_id' => $category->id, 'title' => $post['title'], 'text' => $post['text'], 'owner_id' => $user->id);
// approved?
$data['b_approved'] = !$category->is_premoded() || $user->get_level() >= 50 ? true : false;
$post_handle->modify($data);
$new = $post_handle->get_item();
// core::var_dump($new->as_array());
core::get_instance()->set_raw_message('Submit');
} else {
// probably modify?
示例5: on_editor
/**
* Called from module::on_editor
* @throws acl_exception
*/
function on_editor($mod)
{
$this->module = $mod;
$section = core::get_params('c');
$id = (int) core::get_params('id');
// module checks goes on top, so skip if section empty
if (empty($section)) {
return;
}
if (!core::module('users')->with_acls()) {
return;
}
// override section acl / id
if (isset($this->_actions[$section]['acl_id'])) {
$id = core::get_params($this->_actions[$section]['acl_id']);
}
if (isset($this->_actions[$section]['acl'])) {
$section = $this->_actions[$section]['acl'];
}
$op = 'read';
// @todo check this
$is_submitted = (bool) $this->request->get_post('is_submitted', 0);
$_op = core::get_params('op');
if ($_op == 'edit') {
$op = 'update';
}
if ($_op == 'drop') {
$op = 'delete';
}
if (empty($id) && $is_submitted) {
$op = 'create';
}
if (!empty($id) && $is_submitted) {
$op = 'update';
}
if (is_callable(array($mod, 'editor_check_acls'))) {
$result = call_user_func(array($mod, 'editor_check_acls'), array('section' => &$section, 'section_id' => &$id, 'action' => &$op));
// WARN! true skips checks
if ($result === true) {
return;
}
}
$this->check_acls($section, $id, $op);
}
示例6: on_editor
/**
* on editor action
*
* Called in editor to module
*/
function on_editor()
{
$actions_file = "{$this->root_dir}editor/actions.php";
if (file_exists($actions_file)) {
// this is array of actions
$menu = (require $actions_file);
core::lib('editor')->assign_module_menu($menu);
}
// Включаемый файл
$inc_ = '';
/**
* @todo
* При добавлении новых разделов,
* не забудьте прописать в index.tpl
* опцию для подключения нового раздела
*/
// this modify ident var (if its empty)!
if (empty(core::get_params()->c) && !empty($this->editor_default_action)) {
core::get_params()->c = $this->editor_default_action;
}
$inc_ = preg_replace('/[^a-z\\d\\_]/i', '', core::get_params()->c);
core::dprint("on_editor : " . $inc_);
/* подключаем обработчик
*/
if (!empty($inc_)) {
$inc_ = $this->root_dir . "editor/controllers/{$inc_}" . loader::DOT_PHP;
if (fs::file_exists($inc_, false)) {
require $inc_;
} else {
core::dprint('[ERROR] Unable to execute ' . $inc_);
}
}
/* @return main template
*/
return 'index.tpl';
}
示例7: cp_profile
/**
* Cp action
*/
function cp_profile()
{
$post = core::lib('request')->get_post();
// change nick, email, gender, password
if ('update_profile' == core::get_params('op')) {
$error = false;
try {
$this->get_context()->update_user_profile($post);
} catch (validator_exception $e) {
$error = $e->getMessage();
$error = $this->get_context()->translate($error);
}
$message = $error !== false ? $error : $this->get_context()->translate('profile_update_ok');
if (loader::in_ajax()) {
$this->set_null_template();
core::lib('renderer')->set_ajax_answer(array('status' => false === $error, 'message' => $message));
} else {
$core = core::get_instance();
$core->set_raw_message($message);
$core->set_message_data(false, false !== $error);
}
}
}
示例8: output_editor
/**
* Editor out
*/
public function output_editor(&$tpl)
{
if (($mod = core::get_params()->module) && !empty($mod)) {
// root template relative
$this->set_data('modtpl_prefix', '../../modules/' . core::get_params()->module . '/editor/templates/');
$this->tpl_parser->assign('modtpl_prefix', $this->get_data('modtpl_prefix'));
$this->data['config']['base_url'] = core::module($mod)->get_editor_base_url();
}
$tpl = 'index';
}
示例9:
<?php
$cmd_pid = core::get_params()->pid ? core::get_params()->pid : @$_COOKIE['cplayer'];
if ($cmd_pid) {
$_parent = core::module('moswar')->get_accounts_handle()->set_where('id = %d', $cmd_pid)->set_limit(1)->load()->get_item();
core::lib('renderer')->set_data('current_parent', $_parent->render());
core::lib('renderer')->set_data('mw_accounts', core::module('moswar')->get_accounts_handle()->load()->render());
}
示例10: output_editor
/**
* Editor out
*/
public function output_editor()
{
/*
boolean false
string 'index' (length=5)
null
var_dump($this->get_main_template(), $this->get_page_template());
dd($template, __METHOD__);
*/
if (($m = core::lib('request')->get_ident()->m) && !empty($m)) {
// root template relative
$this->set_data('modtpl_prefix', '../../modules/' . $m . '/editor/templates/');
$this->data['config']['base_url'] = core::module($m)->get_editor_base_url();
$this->data['config']['editor_url'] = core::get_instance()->cfg('site_url') . loader::DIR_EDITOR;
}
if (core::get_params('embed')) {
$this->set_page_template('embed');
// allow embed in ajax
if (loader::in_ajax() && !$this->get_main_template()) {
$this->set_main_template('embed');
}
}
/*
else {
$layout = core::get_instance()->cfg('editor.layout');
$template = $layout ? "layout/{$layout}/" : '';
$template .= 'root';
//$template .= loader::DOT_TPL;
}
*/
}