Version Description
- Change taxonomy hooks
Download this release
Release Info
Developer | jim912 |
Plugin | Meta Manager |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- images/icon32.png +0 -0
- images/ps_logo.png +0 -0
- meta-manager.php +441 -0
- readme.txt +37 -0
images/icon32.png
ADDED
Binary file
|
images/ps_logo.png
ADDED
Binary file
|
meta-manager.php
ADDED
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.0
|
12 |
+
Author URI: http://www.warna.info/
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Meta_Manager {
|
16 |
+
var $default = array(
|
17 |
+
'includes_taxonomies' => array(),
|
18 |
+
'excerpt_as_description' => true,
|
19 |
+
'include_term' => true,
|
20 |
+
);
|
21 |
+
|
22 |
+
var $setting;
|
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' ) );
|
30 |
+
add_action( 'admin_menu' , array( &$this, 'add_setting_menu' ) );
|
31 |
+
add_action( 'admin_print_styles-settings_page_meta-manager', array( &$this, 'print_icon_style' ) );
|
32 |
+
add_action( 'plugins_loaded' , array( &$this, 'update_settings' ) );
|
33 |
+
add_filter( 'plugin_action_links' , array( &$this, 'plugin_action_links' ), 10, 2 );
|
34 |
+
add_action( 'admin_print_styles-post.php' , array( &$this, 'print_metabox_styles' ) );
|
35 |
+
add_action( 'admin_print_styles-post-new.php' , array( &$this, 'print_metabox_styles' ) );
|
36 |
+
register_deactivation_hook( __FILE__ , array( &$this, 'deactivation' ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
add_action( 'wp_loaded', array( &$this, 'taxonomy_update_hooks' ) );
|
40 |
+
add_action( 'wp_head', array( &$this, 'output_meta' ), 0 );
|
41 |
+
|
42 |
+
$this->term_keywords = get_option( 'term_keywords' );
|
43 |
+
$this->term_description = get_option( 'term_description' );
|
44 |
+
if ( ! $this->setting = get_option( 'meta_manager_settings' ) ) {
|
45 |
+
$this->setting = $this->default;
|
46 |
+
}
|
47 |
+
|
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 ) {
|
55 |
+
add_action( $taxonomy . '_add_form_fields', array( $this, 'add_keywords_form' ) );
|
56 |
+
add_action( $taxonomy . '_edit_form_fields', array( &$this, 'edit_keywords_form' ), 0, 2 );
|
57 |
+
add_action( 'created_' . $taxonomy, array( &$this, 'update_term_meta' ) );
|
58 |
+
add_action( 'edited_' . $taxonomy, array( &$this, 'update_term_meta' ) );
|
59 |
+
add_action( 'delete_' . $taxonomy, array( &$this, 'delete_term_meta' ) );
|
60 |
+
add_action( 'elete_' . $taxonomy, array( &$this, 'delete_term_meta' ) );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
function plugin_action_links( $links, $file ) {
|
67 |
+
$status = get_query_var( 'status' ) ? get_query_var( 'status' ) : 'all';
|
68 |
+
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
|
69 |
+
$s = get_query_var( 's' );
|
70 |
+
$this_plugin = plugin_basename(__FILE__);
|
71 |
+
if ( $file == $this_plugin ) {
|
72 |
+
$link = trailingslashit( get_bloginfo( 'wpurl' ) ) . 'wp-admin/options-general.php?page=meta-manager.php';
|
73 |
+
$tax_regist_link = '<a href="' . $link . '">設定</a>';
|
74 |
+
array_unshift( $links, $tax_regist_link ); // before other links
|
75 |
+
$link = wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this_plugin . '&plugin_status=' . $status . '&paged=' . $paged . '&deloption=1&s=' . $s, 'deactivate-plugin_' . $this_plugin );
|
76 |
+
$del_setting_deactivation_link = '<a href="' . $link . '">設定を削除して停止</a>';
|
77 |
+
array_push( $links, $del_setting_deactivation_link );
|
78 |
+
}
|
79 |
+
return $links;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
function deactivation() {
|
85 |
+
if ( isset( $_GET['deloption'] ) && $_GET['deloption'] ) {
|
86 |
+
delete_option( 'meta_keywords' );
|
87 |
+
delete_option( 'meta_description' );
|
88 |
+
delete_option( 'meta_manager_settings' );
|
89 |
+
delete_post_meta_by_key( '_keywords' );
|
90 |
+
delete_post_meta_by_key( '_description' );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
function add_keywords_form() {
|
96 |
+
?>
|
97 |
+
<div class="form-field">
|
98 |
+
<label for="meta_keywords">メタキーワード</label>
|
99 |
+
<textarea name="meta_keywords" id="meta_keywords" rows="3" cols="40"></textarea>
|
100 |
+
</div>
|
101 |
+
<div class="form-field">
|
102 |
+
<label for="meta_description">メタディスクリプション</label>
|
103 |
+
<textarea name="meta_description" id="meta_description" rows="5" cols="40"></textarea>
|
104 |
+
</div>
|
105 |
+
<?php
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
function edit_keywords_form( $tag ) {
|
110 |
+
?>
|
111 |
+
<tr class="form-field">
|
112 |
+
<th scope="row" valign="top"><label for="meta_keywords">メタキーワード</label></th>
|
113 |
+
<td><input type="text" name="meta_keywords" id="meta_keywords" size="40" value="<?php echo isset( $this->term_keywords[$tag->term_id] ) ? esc_html( $this->term_keywords[$tag->term_id] ) : ''; ?>" />
|
114 |
+
</tr>
|
115 |
+
<tr class="form-field">
|
116 |
+
<th scope="row" valign="top"><label for="meta_description">メタディスクリプション</label></th>
|
117 |
+
<td><textarea name="meta_description" id="meta_description" cols="40" rows="5"><?php echo isset( $this->term_description[$tag->term_id] ) ? esc_html( $this->term_description[$tag->term_id] ) : ''; ?></textarea>
|
118 |
+
</tr>
|
119 |
+
<?php
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
function update_term_meta( $term_id ) {
|
124 |
+
$post_keywords = stripslashes_deep( $_POST['meta_keywords'] );
|
125 |
+
$post_keywords = $this->get_unique_keywords( $post_keywords );
|
126 |
+
$post_description = stripslashes_deep( $_POST['meta_description'] );
|
127 |
+
|
128 |
+
if ( ! isset( $this->term_keywords[$term_id] ) || $this->term_keywords[$term_id] != $post_keywords ) {
|
129 |
+
$this->term_keywords[$term_id] = $post_keywords;
|
130 |
+
update_option( 'term_keywords', $this->term_keywords );
|
131 |
+
}
|
132 |
+
if ( ! isset( $this->term_description[$term_id] ) || $this->term_description[$term_id] != $post_description ) {
|
133 |
+
$this->term_description[$term_id] = $post_description;
|
134 |
+
update_option( 'term_description', $this->term_description );
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
function add_post_meta_box( $post_type, $post ) {
|
140 |
+
add_meta_box( 'post_meta_box', 'メタ情報', array( &$this, 'post_meta_box' ), $post_type, 'normal', 'high');
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
function post_meta_box() {
|
145 |
+
global $post;
|
146 |
+
$post_keywords = get_post_meta( $post->ID, '_keywords', true ) ? get_post_meta( $post->ID, '_keywords', true ) : '';
|
147 |
+
$post_description = get_post_meta( $post->ID, '_description', true ) ? get_post_meta( $post->ID, '_description', true ) : '';
|
148 |
+
?>
|
149 |
+
<dl>
|
150 |
+
<dt>メタキーワード</dt>
|
151 |
+
<dd><input type="text" name="_keywords" id="post_keywords" size="100" value="<?php echo esc_html( $post_keywords ); ?>" /></dd>
|
152 |
+
<dt>メタディスクリプション</dt>
|
153 |
+
<dd><textarea name="_description" id="post_description" cols="100" rows="3"><?php echo esc_html( $post_description ); ?></textarea></dd>
|
154 |
+
</dl>
|
155 |
+
<?php
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
function print_metabox_styles() {
|
160 |
+
?>
|
161 |
+
<style type="text/css" charset="utf-8">
|
162 |
+
#post_keywords,
|
163 |
+
#post_description {
|
164 |
+
width: 98%;
|
165 |
+
}
|
166 |
+
</style>
|
167 |
+
<?php
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
function update_post_meta( $post_ID ) {
|
172 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
|
173 |
+
if ( isset( $_POST['_keywords'] ) ) {
|
174 |
+
$post_keywords = stripslashes_deep( $_POST['_keywords'] );
|
175 |
+
$post_keywords = $this->get_unique_keywords( $post_keywords );
|
176 |
+
update_post_meta( $post_ID, '_keywords', $post_keywords );
|
177 |
+
}
|
178 |
+
if ( isset( $_POST['_description'] ) ) {
|
179 |
+
$post_keywords = stripslashes_deep( $_POST['_description'] );
|
180 |
+
update_post_meta( $post_ID, '_description', $post_keywords );
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
|
185 |
+
function output_meta() {
|
186 |
+
$meta = $this->get_meta();
|
187 |
+
$output = '';
|
188 |
+
if ( $meta['keywords'] ) {
|
189 |
+
$output .= '<meta name="keywords" content="' . esc_attr( $meta['keywords'] ) . '" />' . "\n";
|
190 |
+
}
|
191 |
+
if ( $meta['description'] ) {
|
192 |
+
$output .= '<meta name="description" content="' . esc_attr( $meta['description'] ) . '" />' . "\n";
|
193 |
+
}
|
194 |
+
echo $output;
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
private function get_meta() {
|
199 |
+
$meta = array();
|
200 |
+
$option = array();
|
201 |
+
$meta['keywords'] = get_option( 'meta_keywords' ) ? get_option( 'meta_keywords' ) : '';
|
202 |
+
$meta['description'] = get_option( 'meta_description' ) ? get_option( 'meta_description' ) : '';
|
203 |
+
if ( is_singular() ) {
|
204 |
+
$option = $this->get_post_meta();
|
205 |
+
} elseif ( is_tax() || is_category() || is_tag() ) {
|
206 |
+
$option = $this->get_term_meta();
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( ! empty( $option ) && $option['keywords'] ) {
|
210 |
+
$meta['keywords'] = $this->get_unique_keywords( $option['keywords'], $meta['keywords'] );
|
211 |
+
} else {
|
212 |
+
$meta['keywords'] = $this->get_unique_keywords( $meta['keywords'] );
|
213 |
+
}
|
214 |
+
|
215 |
+
if ( ! empty( $option ) && $option['description'] ) {
|
216 |
+
$meta['description'] = $option['description'];
|
217 |
+
}
|
218 |
+
$meta['description'] = mb_substr( $meta['description'], 0, 120, 'UTF-8' );
|
219 |
+
return $meta;
|
220 |
+
}
|
221 |
+
|
222 |
+
private function get_post_meta() {
|
223 |
+
global $post;
|
224 |
+
$post_meta = array();
|
225 |
+
$post_meta['keywords'] = get_post_meta( $post->ID, '_keywords', true ) ? get_post_meta( $post->ID, '_keywords', true ) : '';
|
226 |
+
if ( ! empty( $this->setting['includes_taxonomies'] ) ) {
|
227 |
+
foreach ( $this->setting['includes_taxonomies'] as $taxonomy ) {
|
228 |
+
$taxonomy = get_taxonomy( $taxonomy );
|
229 |
+
if ( in_array( $post->post_type, $taxonomy->object_type ) ) {
|
230 |
+
$terms = get_the_terms( $post->ID, $taxonomy->name );
|
231 |
+
if ( $terms ) {
|
232 |
+
$add_keywords = array();
|
233 |
+
foreach ( $terms as $term ) {
|
234 |
+
$add_keywords[] = $term->name;
|
235 |
+
}
|
236 |
+
$add_keywords = implode( ',', $add_keywords );
|
237 |
+
if ( $post_meta['keywords'] ) {
|
238 |
+
$post_meta['keywords'] .= ',' . $add_keywords;
|
239 |
+
} else {
|
240 |
+
$post_meta['keywords'] = $add_keywords;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
$post_meta['description'] = get_post_meta( $post->ID, '_description', true ) ? get_post_meta( $post->ID, '_description', true ) : '';
|
247 |
+
if ( $this->setting['excerpt_as_description'] && ! $post_meta['description'] ) {
|
248 |
+
if ( trim( $post->post_excerpt ) ) {
|
249 |
+
$post_meta['description'] = $post->post_excerpt;
|
250 |
+
} else {
|
251 |
+
$excerpt = apply_filters( 'the_content', $post->post_content );
|
252 |
+
$excerpt = strip_shortcodes( $excerpt );
|
253 |
+
$excerpt = str_replace( ']]>', ']]>', $excerpt );
|
254 |
+
$excerpt = strip_tags( $excerpt );
|
255 |
+
$post_meta['description'] = trim( preg_replace( '/[\n\r\t ]+/', ' ', $excerpt), ' ' );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
return $post_meta;
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
private function get_term_meta() {
|
263 |
+
$term_meta = array();
|
264 |
+
if ( is_tax() ) {
|
265 |
+
$taxonomy = get_query_var( 'taxonomy' );
|
266 |
+
$slug = get_query_var( 'term' );
|
267 |
+
$term = get_term_by( 'slug', $slug, $taxonomy );
|
268 |
+
$term_id = $term->term_id;
|
269 |
+
} elseif ( is_category() ) {
|
270 |
+
$term_id = get_query_var( 'cat' );
|
271 |
+
$term = get_category( $term_id );
|
272 |
+
} elseif ( is_tag() ) {
|
273 |
+
$slug = get_query_var( 'tag' );
|
274 |
+
$term = get_term_by( 'slug', $slug, 'post_tag' );
|
275 |
+
$term_id = $term->term_id;
|
276 |
+
}
|
277 |
+
|
278 |
+
$term_meta['keywords'] = isset( $this->term_keywords[$term_id] ) ? $this->term_keywords[$term_id] : '';
|
279 |
+
if ( $this->setting['include_term'] ) {
|
280 |
+
$term_meta['keywords'] = $term->name . ',' . $term_meta['keywords'];
|
281 |
+
}
|
282 |
+
$term_meta['description'] = isset( $this->term_description[$term_id] ) ? $this->term_description[$term_id] : '';
|
283 |
+
return $term_meta;
|
284 |
+
}
|
285 |
+
|
286 |
+
|
287 |
+
private function get_unique_keywords() {
|
288 |
+
$args = func_get_args();
|
289 |
+
$keywords = array();
|
290 |
+
if ( ! empty( $args ) ) {
|
291 |
+
foreach ( $args as $arg ) {
|
292 |
+
if ( is_string( $arg ) ) {
|
293 |
+
$keywords[] = trim( $arg, ', ' );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
$keywords = implode( ',', $keywords );
|
297 |
+
$keywords = preg_replace( '/[, ]*,[, ]*/', ',', $keywords );
|
298 |
+
$keywords = explode( ',', $keywords );
|
299 |
+
$keywords = array_map( 'trim', $keywords );
|
300 |
+
$keywords = array_unique( $keywords );
|
301 |
+
}
|
302 |
+
$keywords = implode( ',', $keywords );
|
303 |
+
return $keywords;
|
304 |
+
}
|
305 |
+
|
306 |
+
|
307 |
+
function add_setting_menu() {
|
308 |
+
add_options_page( 'Meta Manager', 'Meta Manager', 'manage_options', basename( __FILE__ ), array( &$this, 'setting_page' ) );
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
function setting_page() {
|
313 |
+
$meta_keywords = get_option( 'meta_keywords' ) ? get_option( 'meta_keywords' ) : '';
|
314 |
+
$meta_description = get_option( 'meta_description' ) ? get_option( 'meta_description' ) : '';
|
315 |
+
$taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), false );
|
316 |
+
?>
|
317 |
+
<div class="wrap">
|
318 |
+
<?php screen_icon( 'meta_manager-icon32' ); ?><h2>Meta Manager</h2>
|
319 |
+
<form action="" method="post">
|
320 |
+
<?php wp_nonce_field( 'meta_manager' ); ?>
|
321 |
+
<h3>サイトワイド設定</h3>
|
322 |
+
<table class="form-table">
|
323 |
+
<tr>
|
324 |
+
<th>共通キーワード</th>
|
325 |
+
<td>
|
326 |
+
<label for="meta_keywords">
|
327 |
+
<input type="text" name="meta_keywords" id="meta_keywords" size="100" value="<?php echo esc_html( $meta_keywords ); ?>" />
|
328 |
+
</label>
|
329 |
+
</td>
|
330 |
+
</tr>
|
331 |
+
<tr>
|
332 |
+
<th>基本ディスクリプション</th>
|
333 |
+
<td>
|
334 |
+
<label for="meta_description">
|
335 |
+
<textarea name="meta_description" id="meta_description" cols="100" rows="3"><?php echo esc_html( $meta_description ); ?></textarea>
|
336 |
+
</label>
|
337 |
+
</td>
|
338 |
+
</tr>
|
339 |
+
</table>
|
340 |
+
<h3>記事設定</h3>
|
341 |
+
<table class="form-table">
|
342 |
+
<?php if ( $taxonomies ) : $cnt = 1; ?>
|
343 |
+
<tr>
|
344 |
+
<th>記事のキーワードに含める分類</th>
|
345 |
+
<td>
|
346 |
+
<?php foreach ( $taxonomies as $tax_slug => $taxonomy ) : ?>
|
347 |
+
<label for="includes_taxonomies-<?php echo $cnt; ?>">
|
348 |
+
<input type="checkbox" name="includes_taxonomies[]" id="includes_taxonomies-<?php echo $cnt; ?>" value="<?php echo esc_html( $tax_slug ); ?>"<?php echo in_array( $tax_slug, $this->setting['includes_taxonomies'] ) ? ' checked="checked"' : ''; ?> />
|
349 |
+
<?php echo esc_html( $taxonomy->labels->singular_name ); ?>
|
350 |
+
</label>
|
351 |
+
<?php $cnt++; endforeach; ?>
|
352 |
+
</td>
|
353 |
+
</tr>
|
354 |
+
<?php endif; ?>
|
355 |
+
<tr>
|
356 |
+
<th>記事のメタディスクリプション</th>
|
357 |
+
<td>
|
358 |
+
<label for="excerpt_as_description">
|
359 |
+
<input type="checkbox" name="excerpt_as_description" id="excerpt_as_description" value="1"<?php echo $this->setting['excerpt_as_description'] ? ' checked="checked"' : ''; ?> />
|
360 |
+
抜粋を記事のディスクリプションとして利用する
|
361 |
+
</label>
|
362 |
+
</td>
|
363 |
+
</tr>
|
364 |
+
</table>
|
365 |
+
<h3>タクソノミー設定</h3>
|
366 |
+
<table class="form-table">
|
367 |
+
<tr>
|
368 |
+
<th>タクソノミーのメタキーワード</th>
|
369 |
+
<td>
|
370 |
+
<label for="include_term">
|
371 |
+
<input type="checkbox" name="include_term" id="include_term" value="1"<?php echo $this->setting['include_term'] ? ' checked="checked"' : ''; ?> />
|
372 |
+
分類名をキーワードに含める
|
373 |
+
</label>
|
374 |
+
</td>
|
375 |
+
</tr>
|
376 |
+
|
377 |
+
</table>
|
378 |
+
<p><input type="submit" name="meta_manager_update" value="<?php _e( 'Save Changes' ); ?>" class="button-primary" /></p>
|
379 |
+
</form>
|
380 |
+
<div id="developper_information">
|
381 |
+
<div id="poweredby">
|
382 |
+
<a href="http://www.prime-strategy.co.jp/" target="_blank"><img src="<?php echo preg_replace( '/^https?:/', '', plugin_dir_url( __FILE__ ) ) . 'images/ps_logo.png'; ?>" alt="Powered by Prime Strategy" /></a>
|
383 |
+
</div>
|
384 |
+
</div>
|
385 |
+
</div>
|
386 |
+
<?php
|
387 |
+
}
|
388 |
+
|
389 |
+
|
390 |
+
function update_settings() {
|
391 |
+
if ( isset( $_POST['meta_manager_update'] ) ) {
|
392 |
+
$post_data = stripslashes_deep( $_POST );
|
393 |
+
check_admin_referer( 'meta_manager' );
|
394 |
+
$setting = array();
|
395 |
+
foreach ( $this->default as $key => $def ) {
|
396 |
+
if ( ! isset( $post_data[$key] ) ) {
|
397 |
+
if ( $key == 'includes_taxonomies' ) {
|
398 |
+
$setting['includes_taxonomies'] = array();
|
399 |
+
} else {
|
400 |
+
$setting[$key] = false;
|
401 |
+
}
|
402 |
+
} else {
|
403 |
+
if ( $key == 'includes_taxonomies' ) {
|
404 |
+
$setting['includes_taxonomies'] = $post_data['includes_taxonomies'];
|
405 |
+
} else {
|
406 |
+
$setting[$key] = true;
|
407 |
+
}
|
408 |
+
}
|
409 |
+
}
|
410 |
+
$meta_keywords = $this->get_unique_keywords( $post_data['meta_keywords'] );
|
411 |
+
update_option( 'meta_keywords', $meta_keywords );
|
412 |
+
update_option( 'meta_description', $post_data['meta_description'] );
|
413 |
+
update_option( 'meta_manager_settings', $setting );
|
414 |
+
$this->setting = $setting;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
function print_icon_style() {
|
420 |
+
$url = preg_replace( '/^https?:/', '', plugin_dir_url( __FILE__ ) ) . 'images/icon32.png';
|
421 |
+
?>
|
422 |
+
<style type="text/css" charset="utf-8">
|
423 |
+
#icon-meta_manager-icon32 {
|
424 |
+
background: url( <?php echo esc_url( $url ); ?> ) no-repeat center;
|
425 |
+
}
|
426 |
+
#developper_information {
|
427 |
+
margin: 20px 30px 10px;
|
428 |
+
}
|
429 |
+
#developper_information .content {
|
430 |
+
padding: 10px 20px;
|
431 |
+
}
|
432 |
+
#poweredby {
|
433 |
+
text-align: right;
|
434 |
+
}
|
435 |
+
</style>
|
436 |
+
<?php
|
437 |
+
}
|
438 |
+
|
439 |
+
|
440 |
+
} // class end
|
441 |
+
$meta_manager = new Meta_Manager;
|
readme.txt
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Meta Manager ===
|
2 |
+
Contributors: jim912
|
3 |
+
Tags: SEO, keywords, description
|
4 |
+
Requires at least: 3.0
|
5 |
+
Tested up to: 3.2.1
|
6 |
+
Stable tag: 1.0.0
|
7 |
+
|
8 |
+
Outputs meta description and meta keywords in the element head.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
Outputs meta description and meta keywords in the element head.
|
12 |
+
Notice! Curren version japanese only.
|
13 |
+
|
14 |
+
== Changelog ==
|
15 |
+
|
16 |
+
= 1.0.0 =
|
17 |
+
* Change taxonomy hooks
|
18 |
+
|
19 |
+
= 0.2.0 =
|
20 |
+
* CSS update
|
21 |
+
* Chage keywords order
|
22 |
+
* duplicate keyword check
|
23 |
+
* add delete plugin setting option
|
24 |
+
|
25 |
+
= 0.1.0 =
|
26 |
+
* Public release
|
27 |
+
|
28 |
+
|
29 |
+
== Links ==
|
30 |
+
"[PS Auto Sitemap](http://wordpress.org/extend/plugins/ps-auto-sitemap/ "WordPress sitemap plugin")" is a plugin automatically generates a site map page from your WordPress site.
|
31 |
+
It is easy to install for beginners and easy to customize for experts.
|
32 |
+
It can change the settings of the display of the lists from administration page, several neat CSS skins for the site map tree are prepared.
|
33 |
+
|
34 |
+
"[PS Disable Auto Formatting](http://wordpress.org/extend/plugins/ps-disable-auto-formatting/ "WordPress formatting plugin")"
|
35 |
+
Stops the automatic forming and the HTML tag removal in the html mode of WordPress, and generates a natural paragraph and changing line.
|
36 |
+
|
37 |
+
"[CMS service with WordPress](http://www.web-strategy.jp/ "CMS service with WordPress")" provides you service that uses WordPress as a CMS.
|