__construct(); } // Get out there and rock and roll the bones: function __construct() { add_action('admin_menu', array($this, 'inserttags_addMenu')); add_action('admin_init', array($this, 'inserttags_page_init')); add_action('save_post', array($this, 'inserttags_convert_content_to_tags')); } // add menu under Settings function inserttags_addMenu() { add_options_page( 'settings insert tags', 'settings insert tags', 'manage_options', 'inserttags', array($this, 'inserttags_option_page') ); } //register Field names: function inserttags_page_init() { register_setting( $option_group = 'inserttags', $option_name = 'inserttags_ignore_words' ); } // Display options page: function inserttags_option_page() { if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'Nu aveti suficiente permisiuni pentru a accesa pagina aceasta!' ) ); } ?>
These words will be ignored when generating tags from title (punctuation removed). To reset, simply delete all values here and the default list will be restored.
'; } // Gets the ignore word list: private function fmzac_getWordsToIgnore() { $vals = array(); $file = dirname(__FILE__).'/tags.txt'; $wordstoignore = explode(',', file_get_contents($file)); foreach($wordstoignore as $word) : $vals[] = $this->fmzac_lowerNoPunc($word); endforeach; return $vals; } // Converts all words into lower-case words, sans punctuation or possessives. private function fmzac_lowerNoPunc($werd) { $werd = strtolower(trim(preg_replace('#[^\p{L}\p{N}]+#u', '', $werd))); return $werd; } } ?>