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";
     }
 }
 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 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 admin_site()
 {
     $headspace = HeadSpace2::get();
     $this->render_admin('site-modules', array('site' => $headspace->site));
 }
Example #5
0
 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;
     }
 }
 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 
    }
Example #8
0
 function add_tags($text)
 {
     $headspace = HeadSpace2::get();
     $headspace->reload($this);
     return $text . get_the_tag_list(__('<p>Tags: ', 'headspace'), ', ', '</p>');
 }
 /**
  * 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;
 }