| 94 | | |
|---|
| 95 | | foreach ($metakeys as $post_meta) { |
|---|
| 96 | | if ($post_meta->meta_value != '') { |
|---|
| 97 | | $post_keys = explode(',', $post_meta->meta_value); |
|---|
| 98 | | foreach($post_keys as $keyword) { |
|---|
| 99 | | $keyword = addslashes(trim($keyword)); |
|---|
| 100 | | if ($keyword != ''){ |
|---|
| 101 | | echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>'; |
|---|
| 102 | | if( !$precheck ){ |
|---|
| 103 | | wp_add_post_tags($post_meta->post_id, $keyword); |
|---|
| 104 | | } |
|---|
| 105 | | } |
|---|
| 106 | | } |
|---|
| 107 | | } |
|---|
| 108 | | if( !$precheck ){ |
|---|
| 109 | | delete_post_meta($post_meta->post_id, 'keywords'); |
|---|
| 110 | | } |
|---|
| | 89 | foreach ( $metakeys as $post_meta ) { |
|---|
| | 90 | if ( $post_meta->meta_value != '' ) { |
|---|
| | 91 | $post_keys = explode(',', $post_meta->meta_value); |
|---|
| | 92 | foreach ( $post_keys as $keyword ) { |
|---|
| | 93 | $keyword = addslashes(trim($keyword)); |
|---|
| | 94 | if ( '' != $keyword ) { |
|---|
| | 95 | echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>'; |
|---|
| | 96 | if ( !$precheck ) |
|---|
| | 97 | wp_add_post_tags($post_meta->post_id, $keyword); |
|---|
| | 98 | } |
|---|
| | 99 | } |
|---|
| | 100 | } |
|---|
| | 101 | if ( !$precheck ) |
|---|
| | 102 | delete_post_meta($post_meta->post_id, 'keywords'); |
|---|
| 131 | | // import Jerome's Keywords tags |
|---|
| 132 | | $tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1); |
|---|
| 133 | | $qry = "SELECT post_id, tag_name FROM $tablename"; |
|---|
| 134 | | $metakeys = $wpdb->get_results($qry); |
|---|
| 135 | | if ( !is_array($metakeys)) { |
|---|
| | 120 | // import Jerome's Keywords tags |
|---|
| | 121 | $tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1); |
|---|
| | 122 | $metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename"); |
|---|
| | 123 | if ( !is_array($metakeys) ) { |
|---|
| 137 | | return false; |
|---|
| 138 | | } |
|---|
| 139 | | else { |
|---|
| 140 | | $count = count($metakeys); |
|---|
| 141 | | echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>'; |
|---|
| 142 | | |
|---|
| 143 | | echo '<ul>'; |
|---|
| 144 | | |
|---|
| 145 | | foreach($metakeys as $post_meta) { |
|---|
| 146 | | $keyword = addslashes(trim($post_meta->tag_name)); |
|---|
| 147 | | |
|---|
| 148 | | if ($keyword != ''){ |
|---|
| 149 | | echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>'; |
|---|
| 150 | | if( !$precheck ){ |
|---|
| 151 | | wp_add_post_tags($post_meta->post_id, $keyword); |
|---|
| 152 | | } |
|---|
| 153 | | } |
|---|
| 154 | | } |
|---|
| 155 | | |
|---|
| 156 | | echo '</ul>'; |
|---|
| 157 | | |
|---|
| | 125 | return false; |
|---|
| | 126 | } else { |
|---|
| | 127 | $count = count($metakeys); |
|---|
| | 128 | echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>'; |
|---|
| | 129 | echo '<ul>'; |
|---|
| | 130 | foreach ( $metakeys as $post_meta ) { |
|---|
| | 131 | $keyword = addslashes(trim($post_meta->tag_name)); |
|---|
| | 132 | if ( $keyword != '' ) { |
|---|
| | 133 | echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>'; |
|---|
| | 134 | if ( !$precheck ) |
|---|
| | 135 | wp_add_post_tags($post_meta->post_id, $keyword); |
|---|
| | 136 | } |
|---|
| | 137 | } |
|---|
| | 138 | echo '</ul>'; |
|---|
| 171 | | /* options from V2.0a (jeromes-keywords.php) */ |
|---|
| 172 | | $options = array( |
|---|
| 173 | | 'version' => '2.0', // keywords options version |
|---|
| 174 | | 'keywords_table' => 'jkeywords', // table where keywords/tags are stored |
|---|
| 175 | | 'query_varname' => 'tag', // HTTP var name used for tag searches |
|---|
| 176 | | 'template' => 'keywords.php', // template file to use for displaying tag queries |
|---|
| | 150 | /* options from V2.0a (jeromes-keywords.php) */ |
|---|
| | 151 | $options = array('version', 'keywords_table', 'query_varname', 'template', 'meta_always_include', 'meta_includecats', 'meta_autoheader', 'search_strict', 'use_feed_cats', 'post_linkformat', 'post_tagseparator', 'post_includecats', 'post_notagstext', 'cloud_linkformat', 'cloud_tagseparator', 'cloud_includecats', 'cloud_sortorder', 'cloud_displaymax', 'cloud_displaymin', 'cloud_scalemax', 'cloud_scalemin'); |
|---|
| 182 | | 'meta_autoheader' => '1', // automatically output meta keywords in header |
|---|
| 183 | | 'search_strict' => '1', // returns only exact tag matches if true |
|---|
| 184 | | 'use_feed_cats' => '1', // insert tags into feeds as categories |
|---|
| 185 | | |
|---|
| 186 | | /* post tag options */ |
|---|
| 187 | | 'post_linkformat' => '', // post tag format (initialized to $link_localsearch) |
|---|
| 188 | | 'post_tagseparator' => ', ', // tag separator character(s) |
|---|
| 189 | | 'post_includecats' => '0', // include categories in post's tag list |
|---|
| 190 | | 'post_notagstext' => 'none', // text to display if no tags found |
|---|
| 191 | | |
|---|
| 192 | | /* tag cloud options */ |
|---|
| 193 | | 'cloud_linkformat' => '', // post tag format (initialized to $link_tagcloud) |
|---|
| 194 | | 'cloud_tagseparator' => ' ', // tag separator character(s) |
|---|
| 195 | | 'cloud_includecats' => '0', // include categories in tag cloud |
|---|
| 196 | | 'cloud_sortorder' => 'natural', // tag sorting: natural, countup/asc, countdown/desc, alpha |
|---|
| 197 | | 'cloud_displaymax' => '0', // maximum # of tags to display (all if set to zero) |
|---|
| 198 | | 'cloud_displaymin' => '0', // minimum tag count to include in tag cloud |
|---|
| 199 | | 'cloud_scalemax' => '0', // maximum value for count scaling (no scaling if zero) |
|---|
| 200 | | 'cloud_scalemin' => '0' // minimum value for count scaling |
|---|
| 201 | | ); |
|---|
| 202 | | |
|---|
| 203 | | $tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1); |
|---|
| 204 | | |
|---|
| 205 | | $wpdb->query('DROP TABLE IF EXISTS ' . $tablename); |
|---|
| 206 | | |
|---|
| 207 | | foreach($options as $optname => $optval) { |
|---|
| 208 | | delete_option('jkeywords_' . $optname); |
|---|
| 209 | | } |
|---|
| | 155 | foreach ( $options as $o ) |
|---|
| | 156 | delete_option('jkeywords_' . $o); |
|---|