/** * Insert re-configured site title * * @return void **/ function wp_title($title, $separator = '', $location = '') { HeadSpace2::reload($this); $sep = $separator; if ($this->separator != '') { $sep = $this->separator; } $replace = $separator; if ($replace == ' ') { $replace = ''; } if (strlen($this->page_title) == 0 && strlen($title) == 0) { $title = ''; } else { if ($this->position == 'after' || $location == 'right') { if (strlen($this->page_title) > 0) { $title = $this->page_title . " " . $sep . " "; } else { $title = trim(str_replace($replace, '', $title)) . " " . $sep . " "; } } else { // Before if (strlen($this->page_title) > 0) { $title = " " . $sep . " " . $this->page_title; } else { $title = $sep . " " . trim(str_replace($replace, '', $title)) . ''; } } } return $title; }
function run() { $pages = get_option('headspace_page_themes'); $options = get_option('headspace_options'); if (isset($options['debug']) && $options['debug'] == true) { HeadSpace2::debug(print_r($pages, true)); } if (isset($_GET['page_id'])) { $url = '/?page_id=' . intval($_GET['page_id']); } else { $url = '/?p=' . intval($_GET['p']); } if (isset($_GET['page_id'])) { $url = '/?page_id=' . intval($_GET['page_id']); } elseif (isset($_GET['p'])) { $url = '/?p=' . intval($_GET['p']); } else { $url = str_replace(get_bloginfo('home'), '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } if (isset($pages[$_SERVER['REQUEST_URI']]) || isset($pages[$url])) { if (isset($pages[$_SERVER['REQUEST_URI']])) { $this->theme = $pages[$_SERVER['REQUEST_URI']]; } else { $this->theme = $pages[$url]; } add_filter('template', array(&$this, 'template')); add_filter('stylesheet', array(&$this, 'template')); } }
/** * Get new blog name * * @return string **/ function option_blogdescription($tagline) { HeadSpace2::reload($this); if (strlen($this->blog_tagline) > 0) { return $this->blog_tagline; } return $tagline; }
/** * Insert re-configured blog name and description into the RSS feed * * @return void **/ function bloginfo_rss($info, $show) { HeadSpace2::reload($this); if ($show == 'description' && $this->rss_desc) { return $this->rss_desc; } return $info; }
function more_link_text($text) { HeadSpace2::reload($this); if ($this->more_text) { return preg_replace('@' . $this->pattern . '@', str_replace('$1', $this->more_text, $this->replace), $text); } return $text . $this->more_text; }
/** * Insert re-configured blog name and description into the RSS feed * * @return void **/ function get_wp_title_rss($show) { HeadSpace2::reload($this); if ($this->rss_title) { return $this->rss_title; } return $show; }
/** * Get new blog name * * @return string **/ function option_blogname($tagline) { global $headspace2; if ($headspace2->ugly_hack !== true) { HeadSpace2::reload($this); } if (strlen($this->blog_name) > 0) { return trim(HeadSpace_Plugin::specialchars($this->blog_name)); } return trim($tagline); }
function head() { if ($this->use_tags && class_exists('HSM_Tags') && $this->metakey == '') { $hs = HeadSpace2::get(); $tags = $hs->modules->get('hsm_tags'); $this->metakey = $tags->normalize_tags($tags->get_the_tags()); } if ($this->metakey) { echo '<meta name="keywords" content="' . $this->metakey . '" />' . "\r\n"; } }
/** * Get new blog name * * @return string **/ function option_blogname($tagline) { global $headspace2; if (isset($headspace2->ugly_hack) && $headspace2->ugly_hack !== true) { HeadSpace2::reload($this); } if (strlen($this->blog_name) > 0) { return trim(esc_html($this->blog_name)); } return trim($tagline); }
function get_custom($field) { $hs2 = HeadSpace2::get(); $data = $hs2->get_current_settings(); if (isset($data['custom_fields'])) { $custom = unserialize($data['custom_fields']); if (!is_array($custom)) { $custom = unserialize($custom); } if (is_array($custom) && isset($custom[$field])) { return $custom[$field]; } } return false; }
function do_link($link, $var) { if ($this->reloaded == false) { HeadSpace2::reload($this); } $post_id = $this->{$var}; if ($post_id > 0) { $post = get_post($post_id); if (!empty($post)) { $link = preg_replace("/href='(.*?)'/", 'href="' . get_permalink($post_id) . '"', $link); $link = preg_replace("/title='(.*?)'/", 'title="' . $post->post_title . '"', $link); } } return $link; }
function content($text) { $hs = HeadSpace2::get(); if ($hs->disabled == false && !is_feed() && !is_search() && $this->visited == false) { $this->visited = true; if ($this->position == 'content_before') { return $this->message . $text; } else { if ($this->position == 'content_after') { return $text . $this->message; } } } return $text; }
function add_tags($text) { HeadSpace2::reload($this); return $text . get_the_tag_list(__('<p>Tags: ', 'headspace'), ', ', '</p>'); }
function admin_site() { $headspace = HeadSpace2::get(); $this->render_admin('site-modules', array('site' => $headspace->site)); }
function hs_auto_tag() { $id = intval($_GET['id']); if (current_user_can('edit_post', $id) && check_ajax_referer('headspace-auto_tag_' . $id)) { $headspace = HeadSpace2::get(); $settings = $headspace->get_post_settings($id); $tags = $headspace->modules->get('hsm_tags'); $tags->load($settings); include ABSPATH . 'wp-admin/admin-functions.php'; $post = get_post($id); $suggestions = $tags->get_suggestions($post->post_content . ' ' . $post->post_title); echo esc_html(implode(', ', $suggestions)); die; } }
/** * Return the current post excerpt * * @return string **/ function get_excerpt($post, $auto = true) { $excerpt = ''; if (is_object($post)) { if ($post->post_excerpt != '') { $excerpt = trim(str_replace('[...]', '', $post->post_excerpt)); } else { if ($auto) { $hs = HeadSpace2::get(); $options = $hs->get_options(); $excerpt = $post->post_content; if (isset($options['excerpt']) && $options['excerpt']) { $hs->disabled = true; $excerpt = apply_filters('the_content', $post->post_content); $hs->disabled = false; } $excerpt_length = apply_filters('excerpt_length', 1000); $excerpt = substr(strip_shortcodes($excerpt), 0, $excerpt_length); } } } $excerpt = strip_tags($excerpt); return $excerpt; }
static function reload(&$obj) { $headspace = HeadSpace2::get(); $obj->load($headspace->get_current_settings()); }
function edit($width, $area) { global $headspace2; $headspace = HeadSpace2::get(); $plugins = get_plugins(); $current = array_filter(get_option('active_plugins')); foreach ($current as $active) { if (isset($plugins[$active])) { unset($plugins[$active]); } } ?> <tr> <th width="<?php echo $width; ?> " align="right" valign="top"><?php _e('Plugins', 'headspace'); ?> </th> <td> <select name="headspace_plugin" id="headspace_plugin"> <?php foreach ($plugins as $name => $details) { ?> <option value="<?php echo $name; ?> "><?php echo $details['Name']; ?> </option> <?php } ?> </select> <a href="#" onclick="return add_plugin ()"><img valign="bottom" src="<?php echo plugins_url('/images/add.png', $headspace2->base_url()); ?> " alt="add"/></a> <ul id="headspace_plugins"> <?php if (!empty($this->plugins)) { ?> <?php foreach ($this->plugins as $name) { ?> <li> <div class="delete"><a href="#" onclick="return delete_plugin(this);"><img src="<?php echo plugins_url('/images/delete.png', $headspace2->base_url()); ?> " alt="delete" width="16" height="16"/></a></div> <?php echo $plugins[$name]['Name']; ?> <input type='hidden' name='headspace_plugins[]' value='<?php echo $name; ?> '/> </li> <?php } ?> <?php } ?> </ul> </td> </tr> <?php }