Ejemplo n.º 1
0
	/**
	 * PHP4 constructor - Initialize ST
	 *
	 * @return SimpleTags
	 */
	function SimpleTags() {	
		parent::initOptions();

		// Set date for class
		$this->dateformat = get_option('date_format');

		// Add pages in WP_Query
		if ( $this->options['use_tag_pages'] == 1 ) {
			remove_action( 'init', 'create_initial_taxonomies' ); // highest priority
			add_action( 'init', array(&$this, 'createInitialTaxonomies'), 0 ); // Load this function instead initial register taxnomy
			
			add_filter('posts_where', array(&$this, 'prepareQuery'));
		}

		// Remove embedded tags in posts display
		if ( $this->options['use_embed_tags'] == 1 ) {
			add_filter('the_content', array(&$this, 'filterEmbedTags'), 0);
		}

		// Add related posts in post ( all / feedonly / blogonly / homeonly / singularonly / singleonly / pageonly /no )
		if ( $this->options['tt_embedded'] != 'no' || $this->options['tt_feed'] == 1 ) {
			add_filter('the_content', array(&$this, 'inlinePostTags'), 999992);
		}

		// Add post tags in post ( all / feedonly / blogonly / homeonly / singularonly / singleonly / pageonly /no )
		if ( $this->options['rp_embedded'] != 'no' || $this->options['rp_feed'] == 1 ) {
			add_filter('the_content', array(&$this, 'inlineRelatedPosts'), 999993);
		}

		// Embedded tag cloud
		if ( $this->options['allow_embed_tcloud'] == 1 ) {
			add_shortcode( 'st_tag_cloud', array(&$this, 'inlineTagCloud') );
			add_shortcode( 'st-tag-cloud', array(&$this, 'inlineTagCloud') );
			add_filter(    'the_content' , array(&$this, 'old_inlineTagCloud'));
		}

		// Stock Posts ID (useful for autolink and metakeywords)
		add_filter( 'the_posts', array(&$this, 'getPostIds') );

		// Add keywords to header
		if ( ( $this->options['meta_autoheader'] == 1 && !class_exists('Platinum_SEO_Pack') && !class_exists('All_in_One_SEO_Pack') && apply_filters('st_meta_header', true) ) ) {
			add_action('wp_head', array(&$this, 'outputMetaKeywords'));
		}

		// Auto link tags
		if ( $this->options['auto_link_tags'] == '1' ) {
			add_filter('the_content', array(&$this, 'autoLinkTags'), 12);
		}
		return true;
	}
Ejemplo n.º 2
0
	/**
	 * PHP4 Constructor - Intialize Admin
	 *
	 * @return SimpleTagsAdmin
	 */
	function SimpleTagsAdmin() {
		parent::initOptions();
		
		// Admin URL for Pagination and target
		$this->posts_base_url 	= admin_url('edit.php')  . '?page=';
		$this->options_base_url = admin_url('options-general.php') . '?page=';
		
		// Admin Capabilities
		add_action('init', array(&$this, 'initRoles'));
		
		// Admin menu
		add_action('admin_menu', array(&$this, 'adminMenu'));
		add_action('admin_notices', array(&$this, 'displayMessage'));
		
		// Ajax action, JS Helper and admin action
		add_action('admin_init', array(&$this, 'ajaxCheck'));
		add_action('admin_init', array(&$this, 'checkFormMassEdit'));
		
		// Embedded Tags
		if ( $this->options['use_embed_tags'] == 1 ) {
			add_actions( array('save_post', 'publish_post', 'post_syndicated_item'), array(&$this, 'saveEmbedTags') );
		}
		
		// Auto tags
		if ( $this->options['use_auto_tags'] == 1 ) {
			add_actions( array('save_post', 'publish_post', 'post_syndicated_item'), array(&$this, 'saveAutoTags') );
		}
		
		// Save tags from advanced input
		if ( $this->options['use_autocompletion'] == 1 ) {
			add_actions( array('save_post', 'publish_post'), array(&$this, 'saveAdvancedTagsInput') );
			add_action('do_meta_boxes', array(&$this, 'removeOldTagsInput'), 1 );
		}
		
		// Box for post
		add_action('admin_menu', array(&$this, 'helperClickTags_Post'), 1);
		add_action('admin_menu', array(&$this, 'helperSuggestTags_Post'), 1);
		add_action('admin_menu', array(&$this, 'helperAdvancedTags_Post'), 1);
		
		// Box for Page
		if ( $this->options['use_tag_pages'] == 1 ) {
			add_action('admin_menu', array(&$this, 'helperClickTags_Page'), 1);
			add_action('admin_menu', array(&$this, 'helperSuggestTags_Page'), 1);
			add_action('admin_menu', array(&$this, 'helperAdvancedTags_Page'), 1);
		}
		
		// Load JavaScript and CSS
		$this->initJavaScript();
	}