public function action_admin_header($theme) { if ($theme->page == 'configure_block' && $_GET['inline'] == 1) { Plugins::act('add_jwysiwyg_admin'); Stack::add('admin_stylesheet', array('#block_admin { display: none; } textarea { height: 250px; width: 540px; }', 'screen')); } }
/** * 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 ( ) { parent::add_template_vars(); $this->home_tab = 'Blog'; $this->show_author = false; $this->add_template( 'k2_text', dirname( __FILE__ ) . '/formcontrol_text.php' ); if ( !isset( $this->pages ) ) { $this->pages = Posts::get( array( 'content_type' => 'page', 'status' => 'published', 'nolimit' => true ) ); } if ( User::identify()->loggedin ) { Stack::add( 'template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery' ); } if ( ( $this->request->display_entry || $this->request->display_page ) && isset( $this->post ) && $this->post->title != '' ) { $this->page_title = $this->post->title . ' - ' . Options::get('title'); } else { $this->page_title = Options::get('title'); } }
/** * Add the tracking code to the template_header_javascript Stack. * * @todo determine if there is a better action to use * @return null */ public function action_init_theme_any($theme) { $code = $this->tracking_code(); if ($code != null) { Stack::add('template_header_javascript', $code, 'googleanalytics'); } }
public function filter_theme_call_header($return, $theme) { if (User::identify() != FALSE) { Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery'); } return $return; }
function test_stack_order() { Stack::add( 'test_stack', 'a', 'a' ); Stack::add( 'test_stack', 'b after(a)', 'b', 'a' ); $sorted = Stack::get_sorted_stack('test_stack'); $this->assert_equal( implode(', ', $sorted), 'a, b after(a)' ); Stack::add( 'test_stack', 'c after(b,d,f)', 'c', array('b','d','f') ); $sorted = Stack::get_sorted_stack('test_stack'); $this->assert_equal( implode(', ', $sorted), 'a, b after(a), c after(b,d,f)' ); Stack::add( 'test_stack', 'd after(b)', 'd', 'b' ); $sorted = Stack::get_sorted_stack('test_stack'); $this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), c after(b,d,f)' ); Stack::add( 'test_stack', 'e after(b)', 'e', 'b' ); $sorted = Stack::get_sorted_stack('test_stack'); $this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), c after(b,d,f), e after(b)' ); Stack::add( 'test_stack', 'f after(b)', 'f', 'b' ); $sorted = Stack::get_sorted_stack('test_stack'); $this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), f after(b), e after(b), c after(b,d,f)' ); Stack::add( 'test_stack', 'g after(e)', 'g', 'e'); $sorted = Stack::get_sorted_stack('test_stack'); $this->output(implode(', ', $sorted)); $this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), f after(b), c after(b,d,f), e after(b), g after(e)' ); }
/** * Actually add the required javascript to the publish page * @param Theme $theme The admin theme instance **/ public function action_admin_header($theme) { if( $theme->page == 'publish' ) { Stack::add( 'admin_header_javascript', 'multicomplete' ); Stack::add( 'admin_header_javascript', 'tags_auto' ); } }
public function action_template_header($theme) { Stack::add('template_header_javascript', Site::get_url('scripts') . "/jquery.js", 'jquery'); Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.bigframe.js", 'jquery.bigframe', 'jquery'); Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.dimensions.js", 'jquery.dimensions', 'jquery'); Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.tooltip.js", 'jquery.tooltip', 'jquery'); }
/** * Add the Javascript file needed by this plugin to the theme's header. */ public function action_add_template_vars() { $jq_js_file = Site::get_url('scripts', TRUE) . 'jquery.js'; $ss_js_file = Site::get_url('user', TRUE) . 'plugins/' . basename(dirname(__FILE__)) . '/styleswitcher.js'; Stack::add('template_header_javascript', $jq_js_file, 'jquery'); Stack::add('template_header_javascript', $ss_js_file, 'styleswitcher'); }
function action_admin_header() { $url = URL::get('auth_ajax', 'context=extendedlog'); $script = <<<SCRIPT \$(function(){ \tvar initi = itemManage.initItems; \titemManage.initItems = function(){ \t\tiniti(); \t\t\$('.page-logs .manage .item .less,.page-logs .manage .item .message.minor').hide(); \t\t\$('.page-logs .manage .item .more').show().css({clear: 'both', marginLeft: '40px', fontWeight: 'bold', width: '100%'}); \t\t\$('.page-logs .manage .item').click(function(){ \t\t\t\$('.extendedlog').remove(); \t\t\t\$(this).after('<div class="extendedlog"><div class="textarea" style="white-space:pre;font-family:consolas,courier new,monospace;border:1px solid #999;padding:20px;margin:20px 0px;height:100px;overflow-y:auto;">Loading...</div></div>'); \t\t\t\$('.extendedlog .textarea').resizeable(); \t\t\t\$.post( \t\t\t\t'{$url}', \t\t\t\t{ \t\t\t\t\tlog_id: \$('.checkbox input', \$(this)).attr('id').match(/\\[([0-9]+)\\]/)[1] \t\t\t\t}, \t\t\t\tfunction(result){ \t\t\t\t\t\$('.extendedlog .textarea').html(result) \t\t\t\t} \t\t\t); \t\t}); \t} }); SCRIPT; Stack::add('admin_header_javascript', $script, 'extendedlog', array('jquery', 'admin')); }
public function action_init_theme() { Format::apply('tag_and_list', 'post_tags_out', ', ', ', '); Format::apply_with_hook_params('more', 'post_content_out', 'More ›', null, 1); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/screen.css', 'screen, projection'), 'screen'); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/style.css', 'screen, projection'), 'style'); }
/** * Handles get requests for the dashboard * @todo update check should probably be cron'd and cached, not re-checked every load */ public function get_dashboard() { // Not sure how best to determine this yet, maybe set an option on install, maybe do this: $firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published'))); if ($firstpostdate) { $this->theme->active_time = DateTime::create($firstpostdate); } // check to see if we have updates to display $this->theme->updates = Options::get('updates_available', array()); // collect all the stats we display on the dashboard $user = User::identify(); $this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'post_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total('approved', false), 'tag_count' => Tags::vocabulary()->count_total(), 'user_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('draft'), 'user_id' => $user->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total('unapproved', false) : Comments::count_by_author(User::identify()->id, Comment::status('unapproved')), 'spam_comment_count' => $user->can('manage_all_comments') ? Comments::count_total('spam', false) : Comments::count_by_author($user->id, Comment::status('spam')), 'user_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => $user->id))); // check for first run $u = User::identify(); $uinfo = $u->info; if (!isset($uinfo->experience_level)) { $this->theme->first_run = true; $u->info->experience_level = 'user'; $u->info->commit(); } else { $this->theme->first_run = false; } $this->get_additem_form(); Stack::add('admin_header_javascript', 'dashboard-js'); $this->display('dashboard'); }
/** * Add appropriate CSS to this plugin's configuration form */ public function action_admin_header($theme) { $vars = Controller::get_handler_vars(); if ($theme->admin_page == 'plugins' && isset($vars['configure']) && $vars['configure'] === $this->plugin_id) { Stack::add('admin_stylesheet', array($this->get_url() . '/metaseo.css', 'screen')); } }
/** * Add the required javascript to the publish page * @param Theme $theme The admin theme instance **/ public function action_admin_header($theme) { if ($theme->page == 'publish') { Stack::add('admin_header_javascript', $this->get_url(true) . 'tagtray.js', 'tagtray', 'jquery'); Stack::add('admin_footer_javascript', 'resetTags();', 'tagtray', 'tagtray'); Stack::add('admin_stylesheet', $this->get_url(true) . 'tagtray.css', 'tagtray'); } }
public function action_init_theme() { Stack::add('template_header_javascript', $this->get_url() . '/ident/jquery-1.3.2.min.js', 'jquery'); Stack::add('template_header_javascript', $this->get_url() . '/js/jquery-ui-1.7.2.custom.min.js', 'jqueryui', 'jquery'); Stack::add('template_header_javascript', $this->get_url() . '/ident/ident-0.1.js', 'ident_lib'); Stack::add('template_header_javascript', $this->get_url() . '/js/main.js', 'ident_main', 'jquery'); Stack::add('template_stylesheet', array($this->get_url() . '/css/dialog.css', 'screen'), 'ident_dialog'); }
public function action_template_header($theme) { Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery'); Stack::add('template_header_javascript', Site::get_url('theme') . '/thickbox-compressed.js', 'thickbox'); Stack::add('template_header_javascript', Site::get_url('theme') . '/swfobject.js', 'swfobject'); Stack::add('template_header_javascript', Site::get_url('theme') . '/features.js', 'features'); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/thickbox.css', 'screen'), 'thickbox'); }
public function action_template_header($theme) { // Add the stylesheets to the stack for output Stack::add('template_stylesheet', array(Site::get_url('theme') . '/style.css', 'screen')); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/print.css', 'print')); Stack::add('template_header_javascript', 'jquery'); Stack::add('template_header_javascript', Site::get_url('them') . '/menu.js', 'select-menu', array('jquery')); }
public function action_init_theme_any() { if ($this->show_sudo()) { Stack::add('template_header_javascript', Site::get_url('vendor', '/jquery.js'), 'jquery'); Stack::add('template_header_javascript', Site::get_url('vendor', '/jquery-ui.min.js'), 'jquery-ui'); Stack::add('template_header_javascript', $this->get_url('/sudo.js'), 'sudo', 'jquery'); } }
public function action_init() { Post::add_new_type('poll'); $this->add_template('widget', dirname(__FILE__) . '/widget.php'); $this->add_template('poll.single', dirname(__FILE__) . '/poll.single.php'); Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery'); Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/widget.css', 'screen'), 'pollwigitcss'); }
/** * Load assets and add the CSS ones to the header on the template_stylesheet action hook. * @return void */ public function action_template_header_10() { $assets = $this->load_assets(); foreach ($assets['less'] as $less) { Stack::add('template_stylesheet', array($less, 'screen,projection,print', array('rel' => 'stylesheet/less'))); } Stack::add('template_footer_javascript', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', 'jquery'); }
public function action_init_theme() { Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/magicarchives.css', 'screen'), 'magicarchives'); Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery'); Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/magicarchives.js', 'magicarchives', array('jquery', 'ajax_manager')); Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/ajax_manager.js', 'ajax_manager', 'jquery'); Stack::add('template_header_javascript', 'magicArchives.endpoint=\'' . URL::get('ajax', array('context' => 'archive_posts')) . '\'', 'magicurl', 'magicarchives'); }
/** * Add required Javascript */ public function theme_header($theme) { // Add the jQuery library Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery'); Stack::add('template_header_javascript', $this->get_url() . '/instant_search.js', 'instant_search', array('jquery')); // Add the callback URL. $url = "InstantSearch.url = '" . URL::get('ajax', array('context' => 'instant_search')) . "';"; Stack::add('template_header_javascript', $url, 'instant_search_url', 'instant_search'); }
public function action_admin_header($theme) { // This is such a hack it's not even funny // But I am laughing inside. Laughing in a bad way. Stack::remove('admin_stylesheet', 'admin'); $css = file_get_contents(Site::get_dir('admin_theme') . '/css/admin.css'); $css = preg_replace('@#page input\\[type=button\\], #page input\\[type=submit\\], #page button {([^}]+)}@', '', $css, 1); $css = preg_replace('@#page input\\[type=button\\]:hover, #page input\\[type=submit\\]:hover, #page button:hover {([^}]+)}@', '', $css, 1); Stack::add('admin_stylesheet', array(preg_replace('@../images/@', Site::get_url('admin_theme') . '/images/', $css), 'screen'), 'admin', 'jquery'); }
/** * Called upon construct. Sets control properties */ public function _extend() { Stack::add('template_header_javascript', 'visualsearch'); Stack::add('template_stylesheet', 'visualsearch-css'); Stack::add('template_stylesheet', 'visualsearch-datauri-css'); $config = new \stdClass(); $config->facets = array('type', 'status', 'author', 'from', 'to', 'tag'); $config->values = array('type' => array('entry', 'page'), 'status' => array('draft', 'published', 'scheduled'), 'author' => array('admin'), 'tag' => array('habari', 'exploding', 'sausages')); $this->properties['data-facet-config'] = $config; $this->add_template_class('div', 'facet_ui'); }
public function action_admin_header() { $script = <<<SCRIPT \t\t//Need to call this on ajax comment reload \t\t\$(function(){ \$('.comments .item:has(.commenter_redirected)').addClass('redirected')}); SCRIPT; $style = <<<STYLE \t\t#comments .redirected .author { color: red; font-style: italic; } STYLE; Stack::add('admin_header_javascript', $script, 'urlapprove', array('jquery', 'admin')); Stack::add('admin_stylesheet', array($style, 'screen'), 'urlapprove'); }
public function action_template_header() { Stack::add('template_stylesheet', array($this->get_url(true) . 'prettify.css', 'screen')); Stack::add('template_header_javascript', Site::get_url('scripts', true) . 'jquery.js', 'jquery'); Stack::add('template_header_javascript', $this->get_url(true) . 'prettify.js', 'prettify', 'jquery'); Stack::add('template_header_javascript', '$(function(){ $("code.prettyprint").each(function(){ l=$("br.pretty", this).length+1;oz="";for(z=1;z<=l;z++) oz+=z+"<br>"; $(this).wrap("<div class=\\"linewrapper\\"><code>").before("<code class=\\"prettylines\\">"+oz+"</code>"); }); PR_TAB_WIDTH = 2;prettyPrint()});', 'prettify_inline', array('jquery', 'prettify')); }
public function action_admin_header($theme) { if ('comments' == $theme->page) { $edit_url = URL::get('auth_ajax', array('context' => 'in_edit')); $urls = <<<AJAX_URLS habari.url.ajaxInEdit='{$edit_url}'; AJAX_URLS; Stack::add('admin_header_javascript', $urls, 'inline_edit_urls', array('jquery')); Stack::add('admin_header_javascript', $this->get_url(true) . 'inline_edit.js', 'inline_edit', array('jquery')); Stack::add('admin_stylesheet', array($this->get_url(true) . 'inline_edit.css', 'screen'), 'inline_edit'); } }
/** * Handle register_success action */ public function action_plugin_act_register_success($handler) { if (!User::identify()->loggedin) { Utils::redirect(URL::get('register_page'), false); } $handler->theme->user = User::identify(); Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery', array('jquery')); // Stack::add( 'template_header_javascript', Site::get_url('admin_theme') . "/js/admin.js", 'admin', array('jquery', 'registration') ); Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/registration.js', 'registration', array('jquery')); Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/registration.css', 'screen'), 'registration', array()); $handler->theme->display('registration.success'); }
/** * Load the stack with the scripts and css we need * @param Theme $theme The current theme */ public function action_admin_header($theme) { // Since this is the core admin theme, all of these named StackItems should have been added via Stack::action_register_stackitems() Stack::add('admin_header_javascript', 'jquery.color'); Stack::add('admin_header_javascript', 'jquery-nested-sortable'); Stack::add('admin_header_javascript', 'humanmsg'); Stack::add('admin_header_javascript', 'jquery.hotkeys'); Stack::add('admin_header_javascript', 'locale-js'); Stack::add('admin_header_javascript', 'media'); Stack::add('admin_header_javascript', 'admin-js'); Stack::add('admin_header_javascript', 'crc32'); Stack::add('admin_stylesheet', 'admin-css'); Stack::add('admin_stylesheet', 'jquery.ui-css'); }
function action_template_header($theme) { // Add the HTML5 shiv for IE < 9 Stack::add('template_header_javascript', array('http://cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.js', null, '<!--[if lt IE 9]>%s<![endif]-->'), 'html5_shiv'); // Add this line to your config.php to show an error and a notice, and // to process the raw LESS code via javascript instead of the rendered CSS: define('DEBUG_THEME', 1); if (defined('DEBUG_THEME')) { Session::error('This is a <b>sample error</b>'); Session::notice('This is a <b>sample notice</b> for ' . $_SERVER['REQUEST_URI']); Stack::add('template_header_javascript', $theme->get_url('/less/less-1.3.0.min.js'), 'less'); Stack::add('template_stylesheet', array($theme->get_url('/less/style.less'), null, array('type' => null, 'rel' => 'stylesheet/less')), 'style'); } else { Stack::add('template_stylesheet', $theme->get_url('/css/style.css'), 'style'); } }
/** * Add output in the admin header * Adds the necessary javascript to make periodic ajax calls to the admin. */ public function action_admin_header() { $ajaxurl = URL::get('auth_ajax', array('context' => 'keep_session')); $script = <<<HEADER_JS \$(document).ready(function(){ \twindow.setInterval( \t\tfunction(){ \t\t\t\$.post('{$ajaxurl}'); \t\t}, \t\t1000 * 60 * 5 // 5 minutes \t); }); HEADER_JS; Stack::add('admin_header_javascript', $script, 'keep_login', array('jquery')); }