Meta Manager - Version 1.0.2

Version Description

  • Bug fix: Error occurred while deleting term.
Download this release

Release Info

Developer jim912
Plugin Icon wp plugin Meta Manager
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (2) hide show
  1. meta-manager.php +29 -18
  2. readme.txt +5 -2
meta-manager.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
  * @package Meta Manager
4
- * @version 0.1
5
  */
6
  /*
7
  Plugin Name: Meta Manager
8
  Plugin URI: http://www.warna.info/
9
  Description: Outputs meta description and meta keywords in the element head.
10
  Author: Hitoshi Omagari
11
- Version: 1.0.1
12
  Author URI: http://www.warna.info/
13
  */
14
 
@@ -23,7 +23,7 @@ class Meta_Manager {
23
  var $term_keywords;
24
  var $term_description;
25
 
26
- function __construct() {
27
  if ( is_admin() ) {
28
  add_action( 'add_meta_boxes' , array( &$this, 'add_post_meta_box' ), 10, 2 );
29
  add_action( 'wp_insert_post' , array( &$this, 'update_post_meta' ) );
@@ -48,7 +48,7 @@ function __construct() {
48
  }
49
 
50
 
51
- function taxonomy_update_hooks() {
52
  $taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ) );
53
  if ( ! empty( $taxonomies ) ) {
54
  foreach ( $taxonomies as $taxonomy ) {
@@ -62,7 +62,7 @@ function taxonomy_update_hooks() {
62
  }
63
 
64
 
65
- function plugin_action_links( $links, $file ) {
66
  $status = get_query_var( 'status' ) ? get_query_var( 'status' ) : 'all';
67
  $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
68
  $s = get_query_var( 's' );
@@ -80,7 +80,7 @@ function plugin_action_links( $links, $file ) {
80
 
81
 
82
 
83
- function deactivation() {
84
  if ( isset( $_GET['deloption'] ) && $_GET['deloption'] ) {
85
  delete_option( 'meta_keywords' );
86
  delete_option( 'meta_description' );
@@ -91,7 +91,7 @@ function deactivation() {
91
  }
92
 
93
 
94
- function add_keywords_form() {
95
  ?>
96
  <div class="form-field">
97
  <label for="meta_keywords">メタキーワード</label>
@@ -105,7 +105,7 @@ function add_keywords_form() {
105
  }
106
 
107
 
108
- function edit_keywords_form( $tag ) {
109
  ?>
110
  <tr class="form-field">
111
  <th scope="row" valign="top"><label for="meta_keywords">メタキーワード</label></th>
@@ -119,7 +119,7 @@ function edit_keywords_form( $tag ) {
119
  }
120
 
121
 
122
- function update_term_meta( $term_id ) {
123
  $post_keywords = stripslashes_deep( $_POST['meta_keywords'] );
124
  $post_keywords = $this->get_unique_keywords( $post_keywords );
125
  $post_description = stripslashes_deep( $_POST['meta_description'] );
@@ -134,13 +134,24 @@ function update_term_meta( $term_id ) {
134
  }
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
- function add_post_meta_box( $post_type, $post ) {
139
  add_meta_box( 'post_meta_box', 'メタ情報', array( &$this, 'post_meta_box' ), $post_type, 'normal', 'high');
140
  }
141
 
142
 
143
- function post_meta_box() {
144
  global $post;
145
  $post_keywords = get_post_meta( $post->ID, '_keywords', true ) ? get_post_meta( $post->ID, '_keywords', true ) : '';
146
  $post_description = get_post_meta( $post->ID, '_description', true ) ? get_post_meta( $post->ID, '_description', true ) : '';
@@ -155,7 +166,7 @@ function post_meta_box() {
155
  }
156
 
157
 
158
- function print_metabox_styles() {
159
  ?>
160
  <style type="text/css" charset="utf-8">
161
  #post_keywords,
@@ -167,7 +178,7 @@ function print_metabox_styles() {
167
  }
168
 
169
 
170
- function update_post_meta( $post_ID ) {
171
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
172
  if ( isset( $_POST['_keywords'] ) ) {
173
  $post_keywords = stripslashes_deep( $_POST['_keywords'] );
@@ -181,7 +192,7 @@ function update_post_meta( $post_ID ) {
181
  }
182
 
183
 
184
- function output_meta() {
185
  $meta = $this->get_meta();
186
  $output = '';
187
  if ( $meta['keywords'] ) {
@@ -303,12 +314,12 @@ private function get_unique_keywords() {
303
  }
304
 
305
 
306
- function add_setting_menu() {
307
  add_options_page( 'Meta Manager', 'Meta Manager', 'manage_options', basename( __FILE__ ), array( &$this, 'setting_page' ) );
308
  }
309
 
310
 
311
- function setting_page() {
312
  $meta_keywords = get_option( 'meta_keywords' ) ? get_option( 'meta_keywords' ) : '';
313
  $meta_description = get_option( 'meta_description' ) ? get_option( 'meta_description' ) : '';
314
  $taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), false );
@@ -386,7 +397,7 @@ function setting_page() {
386
  }
387
 
388
 
389
- function update_settings() {
390
  if ( isset( $_POST['meta_manager_update'] ) ) {
391
  $post_data = stripslashes_deep( $_POST );
392
  check_admin_referer( 'meta_manager' );
@@ -415,7 +426,7 @@ function update_settings() {
415
  }
416
 
417
 
418
- function print_icon_style() {
419
  $url = preg_replace( '/^https?:/', '', plugin_dir_url( __FILE__ ) ) . 'images/icon32.png';
420
  ?>
421
  <style type="text/css" charset="utf-8">
1
  <?php
2
  /**
3
  * @package Meta Manager
4
+ * @version 1.0.2
5
  */
6
  /*
7
  Plugin Name: Meta Manager
8
  Plugin URI: http://www.warna.info/
9
  Description: Outputs meta description and meta keywords in the element head.
10
  Author: Hitoshi Omagari
11
+ Version: 1.0.2
12
  Author URI: http://www.warna.info/
13
  */
14
 
23
  var $term_keywords;
24
  var $term_description;
25
 
26
+ public function __construct() {
27
  if ( is_admin() ) {
28
  add_action( 'add_meta_boxes' , array( &$this, 'add_post_meta_box' ), 10, 2 );
29
  add_action( 'wp_insert_post' , array( &$this, 'update_post_meta' ) );
48
  }
49
 
50
 
51
+ public function taxonomy_update_hooks() {
52
  $taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ) );
53
  if ( ! empty( $taxonomies ) ) {
54
  foreach ( $taxonomies as $taxonomy ) {
62
  }
63
 
64
 
65
+ public function plugin_action_links( $links, $file ) {
66
  $status = get_query_var( 'status' ) ? get_query_var( 'status' ) : 'all';
67
  $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
68
  $s = get_query_var( 's' );
80
 
81
 
82
 
83
+ public function deactivation() {
84
  if ( isset( $_GET['deloption'] ) && $_GET['deloption'] ) {
85
  delete_option( 'meta_keywords' );
86
  delete_option( 'meta_description' );
91
  }
92
 
93
 
94
+ public function add_keywords_form() {
95
  ?>
96
  <div class="form-field">
97
  <label for="meta_keywords">メタキーワード</label>
105
  }
106
 
107
 
108
+ public function edit_keywords_form( $tag ) {
109
  ?>
110
  <tr class="form-field">
111
  <th scope="row" valign="top"><label for="meta_keywords">メタキーワード</label></th>
119
  }
120
 
121
 
122
+ public function update_term_meta( $term_id ) {
123
  $post_keywords = stripslashes_deep( $_POST['meta_keywords'] );
124
  $post_keywords = $this->get_unique_keywords( $post_keywords );
125
  $post_description = stripslashes_deep( $_POST['meta_description'] );
134
  }
135
  }
136
 
137
+ public function delete_term_meta( $term_id ) {
138
+ if ( isset( $this->term_keywords[$term_id] ) ) {
139
+ unset( $this->term_keywords[$term_id] );
140
+ update_option( 'term_keywords', $this->term_keywords );
141
+ }
142
+ if ( isset( $this->term_description[$term_id] ) ) {
143
+ unset( $this->term_description[$term_id] );
144
+ update_option( 'term_description', $this->term_description );
145
+ }
146
+ }
147
+
148
 
149
+ public function add_post_meta_box( $post_type, $post ) {
150
  add_meta_box( 'post_meta_box', 'メタ情報', array( &$this, 'post_meta_box' ), $post_type, 'normal', 'high');
151
  }
152
 
153
 
154
+ public function post_meta_box() {
155
  global $post;
156
  $post_keywords = get_post_meta( $post->ID, '_keywords', true ) ? get_post_meta( $post->ID, '_keywords', true ) : '';
157
  $post_description = get_post_meta( $post->ID, '_description', true ) ? get_post_meta( $post->ID, '_description', true ) : '';
166
  }
167
 
168
 
169
+ public function print_metabox_styles() {
170
  ?>
171
  <style type="text/css" charset="utf-8">
172
  #post_keywords,
178
  }
179
 
180
 
181
+ public function update_post_meta( $post_ID ) {
182
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
183
  if ( isset( $_POST['_keywords'] ) ) {
184
  $post_keywords = stripslashes_deep( $_POST['_keywords'] );
192
  }
193
 
194
 
195
+ public function output_meta() {
196
  $meta = $this->get_meta();
197
  $output = '';
198
  if ( $meta['keywords'] ) {
314
  }
315
 
316
 
317
+ public function add_setting_menu() {
318
  add_options_page( 'Meta Manager', 'Meta Manager', 'manage_options', basename( __FILE__ ), array( &$this, 'setting_page' ) );
319
  }
320
 
321
 
322
+ public function setting_page() {
323
  $meta_keywords = get_option( 'meta_keywords' ) ? get_option( 'meta_keywords' ) : '';
324
  $meta_description = get_option( 'meta_description' ) ? get_option( 'meta_description' ) : '';
325
  $taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), false );
397
  }
398
 
399
 
400
+ public function update_settings() {
401
  if ( isset( $_POST['meta_manager_update'] ) ) {
402
  $post_data = stripslashes_deep( $_POST );
403
  check_admin_referer( 'meta_manager' );
426
  }
427
 
428
 
429
+ public function print_icon_style() {
430
  $url = preg_replace( '/^https?:/', '', plugin_dir_url( __FILE__ ) ) . 'images/icon32.png';
431
  ?>
432
  <style type="text/css" charset="utf-8">
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jim912
3
  Tags: SEO, keywords, description
4
  Requires at least: 3.0
5
- Tested up to: 3.3
6
- Stable tag: 1.0.1
7
 
8
  Outputs meta description and meta keywords in the element head.
9
 
@@ -12,6 +12,9 @@ Outputs meta description and meta keywords in the element head.
12
  Notice! Current version japanese only, yet.
13
 
14
  == Changelog ==
 
 
 
15
  = 1.0.1 =
16
  * Compatible with WordPress 3.3
17
 
2
  Contributors: jim912
3
  Tags: SEO, keywords, description
4
  Requires at least: 3.0
5
+ Tested up to: 3.3.2
6
+ Stable tag: 1.0.2
7
 
8
  Outputs meta description and meta keywords in the element head.
9
 
12
  Notice! Current version japanese only, yet.
13
 
14
  == Changelog ==
15
+ = 1.0.2 =
16
+ * Bug fix: Error occurred while deleting term.
17
+
18
  = 1.0.1 =
19
  * Compatible with WordPress 3.3
20