本文整理汇总了PHP中Controller::get_var方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::get_var方法的具体用法?PHP Controller::get_var怎么用?PHP Controller::get_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::get_var方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Note that the variables added here should possibly *always* be added,
* especially 'user'.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify());
}
if (!$this->template_engine->assigned('page')) {
$page = Controller::get_var('page');
$this->assign('page', isset($page) ? $page : 1);
}
$copyright = Options::get('simplerer__copyright_notice');
if ($copyright == null) {
$copyright = '© Copyright ' . date('Y') . '. All Rights Reserved.';
} else {
$copyright = str_replace('%year', date('Y'), $copyright);
}
$this->assign('copyright', $copyright);
parent::add_template_vars();
}
示例2: action_admin_footer
public function action_admin_footer( $theme )
{
if ( Controller::get_var( 'page' ) == 'publish' ) {
$size = Options::get( 'flickrsilo__flickr_size' );
switch ( $size ) {
case '_s':
$vsizex = 75;
break;
case '_t':
$vsizex = 100;
break;
case '_m':
$vsizex = 240;
break;
case '':
$vsizex = 500;
break;
case '_b':
$vsizex = 1024;
break;
case '_o':
$vsizex = 400;
break;
}
$vsizey = intval( $vsizex/4*3 );
// Translation strings for used in embedding Javascript. This is quite messy, but it leads to cleaner code than doing it inline.
$embed_photo = _t( 'embed_photo' );
$embed_video = _t( 'embed_video' );
$thumbnail = _t( 'thumbnail' );
$title = _t( 'Open in new window' );
echo <<< FLICKR
<script type="text/javascript">
habari.media.output.flickr = {
{$embed_photo}: function(fileindex, fileobj) {
habari.editor.insertSelection('<a href="' + fileobj.flickr_url + '"><img alt="' + fileobj.title + '" src="' + fileobj.url + '"></a>');
}
}
habari.media.output.flickrvideo = {
{$embed_video}: function(fileindex, fileobj) {
habari.editor.insertSelection('<object type="application/x-shockwave-flash" width="{$vsizex}" height="{$vsizey}" data="http://www.flickr.com/apps/video/stewart.swf?v=49235" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="intl_lang=en-us&photo_secret=' + fileobj.secret + '&photo_id=' + fileobj.id + '&show_info_box=true"></param> <param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=49235"></param> <param name="bgcolor" value="#000000"></param> <param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=49235" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&photo_secret=' + fileobj.secret + '&photo_id=' + fileobj.id + '&flickr_show_info_box=true" height="{$vsizey}" width="{$vsizex}"></embed></object>');
},
{$thumbnail}: function(fileindex, fileobj) {
habari.editor.insertSelection('<a href="' + fileobj.flickr_url + '"><img alt="' + fileobj.title + '" src="' + fileobj.url + '"></a>');
}
}
habari.media.preview.flickr = function(fileindex, fileobj) {
var stats = '';
return '<div class="mediatitle"><a href="' + fileobj.flickr_url + '" class="medialink" onclick="$(this).attr(\'target\',\'_blank\');" title="{$title}">media</a>' + fileobj.title + '</div><img src="' + fileobj.thumbnail_url + '"><div class="mediastats"> ' + stats + '</div>';
}
habari.media.preview.flickrvideo = function(fileindex, fileobj) {
var stats = '';
return '<div class="mediatitle"><a href="' + fileobj.flickr_url + '" class="medialink" onclick="$(this).attr(\'target\',\'_blank\');"title="{$title}" >media</a>' + fileobj.title + '</div><img src="' + fileobj.thumbnail_url + '"><div class="mediastats"> ' + stats + '</div>';
}
</script>
FLICKR;
}
}
示例3: get_plugins
/**
* Display the plugin administration page
*/
public function get_plugins()
{
$all_plugins = Plugins::list_all();
$active_plugins = Plugins::get_active();
$sort_active_plugins = array();
$sort_inactive_plugins = array();
foreach ($all_plugins as $file) {
$plugin = array();
$plugin_id = Plugins::id_from_file($file);
$plugin['plugin_id'] = $plugin_id;
$plugin['file'] = $file;
$error = '';
$providing = array();
if (Utils::php_check_file_syntax($file, $error)) {
$plugin['debug'] = false;
$plugin['info'] = Plugins::load_info($file);
if (array_key_exists($plugin_id, $active_plugins)) {
$plugin['verb'] = _t('Deactivate');
$pluginobj = $active_plugins[$plugin_id];
$plugin['active'] = true;
$plugin_actions = array();
$plugin_actions = Plugins::filter('plugin_config', $plugin_actions, $plugin_id);
$plugin['actions'] = array();
foreach ($plugin_actions as $plugin_action => $plugin_action_caption) {
if (is_numeric($plugin_action)) {
$plugin_action = $plugin_action_caption;
}
$action = array('caption' => $plugin_action_caption, 'action' => $plugin_action);
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
if ($action['caption'] == _t('?')) {
if (isset($_GET['configaction'])) {
$urlparams['configaction'] = $_GET['configaction'];
}
if ($_GET['help'] != $plugin_action) {
$urlparams['help'] = $plugin_action;
}
$action['url'] = URL::get('admin', $urlparams);
$plugin['help'] = $action;
} else {
if (isset($_GET['help'])) {
$urlparams['help'] = $_GET['help'];
}
$urlparams['configaction'] = $plugin_action;
$action['url'] = URL::get('admin', $urlparams);
$plugin['actions'][$plugin_action] = $action;
}
}
$plugin['actions']['deactivate'] = array('url' => URL::get('admin', 'page=plugin_toggle&plugin_id=' . $plugin['plugin_id'] . '&action=deactivate'), 'caption' => _t('Deactivate'), 'action' => 'Deactivate');
if (isset($plugin['info']->provides)) {
foreach ($plugin['info']->provides->feature as $feature) {
$providing[(string) $feature] = $feature;
}
}
} else {
// instantiate this plugin
// in order to get its info()
$plugin['active'] = false;
$plugin['verb'] = _t('Activate');
$plugin['actions'] = array('activate' => array('url' => URL::get('admin', 'page=plugin_toggle&plugin_id=' . $plugin['plugin_id'] . '&action=activate'), 'caption' => _t('Activate'), 'action' => 'activate'));
if (isset($plugin['info']->help)) {
if (isset($_GET['configaction'])) {
$urlparams['configaction'] = $_GET['configaction'];
}
if ($_GET['help'] != '_help') {
$urlparams['help'] = '_help';
}
$action['caption'] = _t('?');
$action['action'] = '_help';
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
$plugin['help'] = $action;
}
}
} else {
$plugin['debug'] = true;
$plugin['error'] = $error;
$plugin['active'] = false;
}
if (isset($this->handler_vars['configure']) && $this->handler_vars['configure'] == $plugin['plugin_id']) {
if (isset($plugin['help']) && Controller::get_var('configaction') == $plugin['help']['action']) {
$this->theme->config_plugin_caption = _t('Help');
} else {
if (isset($plugin['actions'][Controller::get_var('configaction')])) {
$this->theme->config_plugin_caption = $plugin['actions'][Controller::get_var('configaction')]['caption'];
} else {
$this->theme->config_plugin_caption = Controller::get_var('configaction');
}
}
unset($plugin['actions'][Controller::get_var('configaction')]);
$this->theme->config_plugin = $plugin;
} else {
if ($plugin['active']) {
$sort_active_plugins[$plugin_id] = $plugin;
} else {
$sort_inactive_plugins[$plugin_id] = $plugin;
}
//.........这里部分代码省略.........
示例4: add_template_vars
public function add_template_vars()
{
//Theme Options
$this->assign('header_text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.');
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify()->loggedin);
}
/* if( !$this->template_engine->assigned( 'page' ) ) {
$this->assign('page', isset( $page ) ? $page : 1 );
}*/
if (!$this->template_engine->assigned('all_tags')) {
// List of all the tags
$tags = Tags::get();
$this->assign('all_tags', $tags);
}
//visiting page/2, /3 will offset to the next page of posts in the sidebar
$page = Controller::get_var('page');
$pagination = Options::get('pagination');
if ($page == '') {
$page = 1;
}
$this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
parent::add_template_vars();
$this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
$this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
}
示例5: theme_title
public function theme_title($theme)
{
$title = '';
$hv = count($this->handler_vars) != 0 ? $this->handler_vars : Controller::get_handler()->handler_vars;
$stitle = Options::get('title');
if ($this->request->display_entries_by_date && count($hv) > 0) {
$date = '';
$date .= isset($hv['year']) ? $hv['year'] : '';
$date .= isset($hv['month']) ? '-' . $hv['month'] : '';
$date .= isset($hv['day']) ? '-' . $hv['day'] : '';
$title = $date . ' - ' . $stitle;
} elseif ($this->request->display_entries_by_tag && isset($hv['tag'])) {
$title = $theme->tag . ' - ' . $stitle;
} elseif (($this->request->display_entry || $this->request->display_page) && isset($this->posts)) {
$title = strip_tags($this->posts->title) . ' - ' . $stitle;
} elseif ($this->request->display_search) {
// Set title to the search criteria, or to EMPTY if there were none.
$q = Controller::get_var('criteria');
$title = $q != '' ? htmlspecialchars($q) . ' - ' . $stitle . _t(' Search', 'sp') : sprintf(_t('Empty %1$s Search', 'sp'), $stitle);
} else {
$title = $stitle;
}
if ($this->page > 1) {
$title .= _t(' › Page ') . $this->page;
}
return $title;
}
示例6: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Note that the variables added here should possibly *always* be added,
* especially 'user'.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
$this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
$this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify());
}
if (!$this->template_engine->assigned('page')) {
$this->assign('page', isset($page) ? $page : 1);
}
if (!$this->template_engine->assigned('feed_alternate')) {
$matched_rule = URL::get_matched_rule();
switch ($matched_rule->name) {
case 'display_entry':
case 'display_page':
$feed_alternate = URL::get('entry', array('slug' => Controller::get_var('slug')));
break;
case 'display_entries_by_tag':
$feed_alternate = URL::get('tag_collection', array('tag' => Controller::get_var('tag')));
break;
case 'index_page':
default:
$feed_alternate = URL::get('collection', array('index' => '1'));
}
$this->assign('feed_alternate', $feed_alternate);
}
parent::add_template_vars();
}
示例7: add_template_vars
/**
* Add some variables to the template output
*/
public function add_template_vars()
{
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
$page = Controller::get_var('page');
$page = isset($page) ? $page : 1;
if (!$this->template_engine->assigned('page')) {
$this->assign('page', $page);
}
$this->assign('show_previously', false);
$this->assign('show_latest', false);
$action = Controller::get_action();
if ($action == 'display_home' || $action == 'display_entries') {
$offset = (int) (($page + 1 - 1) * Options::get('pagination'));
$this->assign('previously', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $offset, 'limit' => self::PREVIOUSLY_ITEMS)));
$this->assign('show_previously', true);
}
if ($action != 'display_home') {
$this->assign('latest', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => 0, 'limit' => self::LATEST_ITEMS)));
$this->assign('show_latest', true);
}
$this->assign('controller_action', $action);
parent::add_template_vars();
}
示例8: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Note that the variables added here should possibly *always* be added,
* especially 'user'.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify());
}
if (!$this->template_engine->assigned('tags')) {
$this->assign('tags', Tags::get());
}
if (!$this->template_engine->assigned('page')) {
$this->assign('page', isset($page) ? $page : 1);
}
if (!$this->template_engine->assigned('feed_alternate')) {
$matched_rule = URL::get_matched_rule();
switch ($matched_rule->name) {
case 'display_entry':
case 'display_page':
$feed_alternate = URL::get('atom_entry', array('slug' => Controller::get_var('slug')));
break;
case 'display_entries_by_tag':
$feed_alternate = URL::get('atom_feed_tag', array('tag' => Controller::get_var('tag')));
break;
case 'display_home':
default:
$feed_alternate = URL::get('atom_feed', array('index' => '1'));
}
$this->assign('feed_alternate', $feed_alternate);
}
// Specify pages you want in your navigation here
$this->assign('nav_pages', Posts::get(array('content_type' => 'page', 'status' => 'published', 'nolimit' => 1)));
parent::add_template_vars();
}
示例9: action_form_publish
public function action_form_publish($form, $post)
{
$selector = $form->append('wrapper', 'type_selector');
$selector->class = 'container';
// Utils::debug( 'bob' );
if (Controller::get_var('to_type') != NULL && $post->content_type != Controller::get_var('to_type')) {
/* set type */
$post->content_type = Post::type(Controller::get_var('to_type'));
$post->update();
Utils::redirect(URL::get('admin', 'page=publish&id=' . $post->id));
// Refresh view
}
foreach (Post::list_active_post_types() as $type) {
if ($type != 0) {
if ($post->id == 0) {
$url = URL::get('admin', 'page=publish&content_type=' . Post::type_name($type));
} else {
$url = URL::get('admin', 'page=publish&to_type=' . Post::type_name($type) . '&id=' . $post->id);
}
$html = '<a href="' . $url . '"';
if (Post::type_name($type) == $post->content_type || $type == $post->content_type) {
$html .= ' class="active"';
}
$html .= '>' . Post::type_name($type) . '</a>';
$selector->append('static', 'type_selector_' . $type, $html);
}
}
$selector->move_before($selector, $form);
return $form;
}
示例10: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Note that the variables added here should possibly *always* be added,
* especially 'user'.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
//Theme Options
$this->assign('home_tab', 'Home');
//Set to whatever you want your first tab text to be.
$this->assign('show_author', false);
//Display author in posts
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('page')) {
$page = Controller::get_var('page');
$this->assign('page', isset($page) ? $page : 1);
}
parent::add_template_vars();
//from mzingi
//visiting page/2, /3 will offset to the next page of posts in the sidebar
$page = Controller::get_var('page');
$pagination = Options::get('pagination');
if ($page == '') {
$page = 1;
}
$this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
//from mzingi
//for recent comments loop in sidebar.php
$this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
}
示例11: filter_hadminstrip
/**
* Filters the hadminstrip via Plugin API to add the edit menu item.
*
* @param array $menu The hadminstrip array
* @return array The modified hadminstrip array
*/
public function filter_hadminstrip($menu)
{
if (Controller::get_var('slug')) {
$menu['write'] = array('Edit', URL::get('admin', 'page=publish&slug=' . Controller::get_var('slug')));
}
return $menu;
}
示例12: action_admin_theme_post_admin_cctypes
/**
* Respond to post requests on the admin_cctypes template
*
* @param AdminHandler $handler The admin handler object
* @param Theme $theme The admin theme object
*/
function action_admin_theme_post_admin_cctypes($handler, $theme)
{
$action = Controller::get_var('cct_action');
switch ($action) {
case 'addtype':
Post::add_new_type($_POST['newtype']);
$typeid = Post::type($_POST['newtype']);
$handled = Options::get('cctypes_types');
if (!is_array($handled)) {
$handled = array();
}
$handled[$typeid] = $typeid;
array_unique($handled);
Options::set('cctypes_types', $handled);
Session::notice(_t('Added post type "' . $_POST['newtype'] . '".'));
break;
case 'deletetype':
$typename = Post::type_name($_POST['deltype']);
Post::deactivate_post_type($_POST['deltype']);
$handled = Options::get('cctypes_types');
if (isset($handled[$_POST['deltype']])) {
unset($handled[$_POST['deltype']]);
}
Options::set('cctypes_types', $handled);
Session::notice(_t('Deactivated post type "' . $typename . '".'));
}
Utils::redirect();
}
示例13: filter_habminbar
/**
* Filters the habminbar via Plugin API to add the edit menu item.
*
* @param array $menu The Habminbar array
* @return array The modified Habminbar array
*/
public function filter_habminbar( $menu )
{
if ( Controller::get_var('slug') ) {
$post = Post::get('slug=' . Controller::get_var('slug'));
$menu['write']= array( 'Edit', URL::get( 'admin', 'page=publish&id=' . $post->id ) );
}
return $menu;
}
示例14: theme_route_event_ics
public function theme_route_event_ics($theme, $handler)
{
$slug = Controller::get_var('slug');
$theme->post = Post::get(array('slug' => $slug));
header('Content-type: text/x-vcalendar; charset=utf-8');
header('content-disposition: inline; filename=' . $slug . '.ics');
ob_end_clean();
$theme->display('eventone.ics');
}
示例15: filter_admin_access_tokens
public function filter_admin_access_tokens($require_any, $page, $type)
{
if ($page == 'admin') {
if (Controller::get_var('page') == 'tests') {
$require_any = array('manage_plugins' => true);
}
}
return $require_any;
}