Version Description
- Bugfix: inappropriate output with the cftsearch shortcode.
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- custom-field-template.php +17 -16
- readme.txt +9 -5
custom-field-template.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
|
|
4 |
Plugin URI: http://wpgogo.com/development/custom-field-template.html
|
5 |
Description: This plugin adds the default custom fields on the Write Post/Page.
|
6 |
Author: Hiroaki Miyashita
|
7 |
-
Version: 2.0.
|
8 |
Author URI: http://wpgogo.com/
|
9 |
*/
|
10 |
|
@@ -67,7 +67,6 @@ class custom_field_template {
|
|
67 |
add_shortcode( 'cft', array(&$this, 'output_custom_field_values') );
|
68 |
add_shortcode( 'cftsearch', array(&$this, 'search_custom_field_values') );
|
69 |
endif;
|
70 |
-
|
71 |
}
|
72 |
|
73 |
function custom_field_template_init() {
|
@@ -909,7 +908,7 @@ type = file';
|
|
909 |
endforeach;
|
910 |
endif;
|
911 |
elseif ( $options['hook'][$i]['post_type']=='post' ) :
|
912 |
-
if (
|
913 |
if ( !empty($options['hook'][$i]['use_php']) ) :
|
914 |
$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
|
915 |
endif;
|
@@ -1404,21 +1403,21 @@ ex. `radio` and `select`:</dt><dd>$values = array('dog', 'cat', 'monkey'); $defa
|
|
1404 |
<tr><th><strong>HOOK #<?php echo $i; ?></strong></th></tr>
|
1405 |
<tr><td>
|
1406 |
<p><label for="custom_field_template_hook_position[<?php echo $i; ?>]"><?php echo sprintf(__('Position', 'custom-field-template'), $i); ?></label>:<br />
|
1407 |
-
<input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="1" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==1 ) echo ' checked="checked"'; ?> /> <?php _e('Before the content', 'custom-field-template');
|
1408 |
-
<input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="0" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==0) echo ' checked="checked"'; ?> /> <?php _e('After the content', 'custom-field-template');
|
1409 |
-
<input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="2" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==2) echo ' checked="checked"'; ?> /> <?php echo sprintf(__('Inside the content ([cfthook hook=%d])', 'custom-field-template'), $i);
|
1410 |
</p>
|
1411 |
<p><label for="custom_field_template_hook_post_type[<?php echo $i; ?>]"><?php echo sprintf(__('Post Type', 'custom-field-template'), $i); ?></label>:<br />
|
1412 |
-
<input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value=""<?php if ( !isset($options['hook'][$i]['post_type']) ) : echo ' checked="checked"'; endif; ?> /> <?php _e('Both', 'custom-field-template');
|
1413 |
-
<input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value="post"<?php if ( isset($options['hook'][$i]['post_type']) && $options['hook'][$i]['post_type']=='post') : echo ' checked="checked"'; endif; ?> /> <?php _e('Post', 'custom-field-template');
|
1414 |
-
<input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value="page"<?php if ( isset($options['hook'][$i]['post_type']) && $options['hook'][$i]['post_type']=='page') : echo ' checked="checked"'; endif; ?> /> <?php _e('Page', 'custom-field-template'); ?></p>
|
1415 |
<p><label for="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]"><?php echo sprintf(__('Custom Post Type (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
|
1416 |
<input type="text" name="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]" value="<?php if ( isset($options['hook'][$i]['custom_post_type']) ) echo esc_attr(stripcslashes($options['hook'][$i]['custom_post_type'])); ?>" size="80" /></p>
|
1417 |
<p><label for="custom_field_template_hook_category[<?php echo $i; ?>]"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
|
1418 |
<input type="text" name="custom_field_template_hook_category[<?php echo $i; ?>]" id="custom_field_template_hook_category[<?php echo $i; ?>]" value="<?php if ( isset($options['hook'][$i]['category']) ) echo esc_attr(stripcslashes($options['hook'][$i]['category'])); ?>" size="80" /></p>
|
1419 |
<p><label for="custom_field_template_hook_content[<?php echo $i; ?>]"><?php echo sprintf(__('Content', 'custom-field-template'), $i); ?></label>:<br /><textarea name="custom_field_template_hook_content[<?php echo $i; ?>]" class="large-text resizable" rows="5" cols="80"><?php if ( isset($options['hook'][$i]['content']) ) echo stripcslashes($options['hook'][$i]['content']); ?></textarea></p>
|
1420 |
-
<p><input type="checkbox" name="custom_field_template_hook_use_php[<?php echo $i; ?>]" id="custom_field_template_hook_use_php[<?php echo $i; ?>]" value="1" <?php if ( !empty($options['hook'][$i]['use_php']) ) { echo ' checked="checked"'; } ?> /> <?php _e('Use PHP', 'custom-field-template'); ?></p>
|
1421 |
-
<p><input type="checkbox" name="custom_field_template_hook_feed[<?php echo $i; ?>]" id="custom_field_template_hook_feed[<?php echo $i; ?>]" value="1" <?php if ( !empty($options['hook'][$i]['feed']) ) { echo ' checked="checked"'; } ?> /> <?php _e('Apply to feeds', 'custom-field-template'); ?></p>
|
1422 |
</td></tr>
|
1423 |
<?php
|
1424 |
endfor;
|
@@ -1744,7 +1743,7 @@ hideKey = true<br />
|
|
1744 |
<h3><?php _e('CMS x WP', 'custom-field-template'); ?></h3>
|
1745 |
<div class="inside">
|
1746 |
<p><?php _e('There are much more plugins which are useful for developing business websites such as membership sites or ec sites. You could totally treat WordPress as CMS by use of CMS x WP plugins.', 'custom-field-template'); ?></p>
|
1747 |
-
<p style="text-align:center"><a href="http://www.cmswp.jp/" target="_blank"><img src="<?php echo get_option('
|
1748 |
</div>
|
1749 |
</div>
|
1750 |
<?php
|
@@ -2939,7 +2938,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
2939 |
function edit_meta_value( $id, $post ) {
|
2940 |
global $wpdb, $wp_version, $current_user;
|
2941 |
$options = $this->get_custom_field_template_data();
|
2942 |
-
|
2943 |
if( !isset( $id ) || isset($_REQUEST['post_ID']) )
|
2944 |
$id = $_REQUEST['post_ID'];
|
2945 |
|
@@ -3142,7 +3141,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3142 |
else
|
3143 |
$tags_input = $tags_value;
|
3144 |
if ( substr($wp_version, 0, 3) >= '2.8' )
|
3145 |
-
wp_set_post_terms( $id, $tags_value, $tags_key );
|
3146 |
else if ( substr($wp_version, 0, 3) >= '2.3' )
|
3147 |
wp_set_post_tags( $id, $tags_value );
|
3148 |
endforeach;
|
@@ -3364,6 +3363,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3364 |
), $attr));
|
3365 |
|
3366 |
$metakey = $key;
|
|
|
3367 |
if ( $metakey ) :
|
3368 |
if ( $value_count && $value ) :
|
3369 |
return number_format($options['value_count'][$metakey][$value]);
|
@@ -3382,7 +3382,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3382 |
$val = wp_get_attachment_image($val, $image_size);
|
3383 |
endif;
|
3384 |
endif;
|
3385 |
-
$output .= $before_value . $val . $after_value . "\n";
|
3386 |
endforeach;
|
3387 |
if ( $after_list ) : $output .= $after_list . "\n"; endif;
|
3388 |
return do_shortcode($output);
|
@@ -3918,7 +3918,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3918 |
$sql = " meta.meta_value " . $_REQUEST['order'];
|
3919 |
endif;
|
3920 |
endif;
|
3921 |
-
|
3922 |
return $sql;
|
3923 |
endif;
|
3924 |
|
@@ -4013,6 +4013,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
4013 |
global $wpdb;
|
4014 |
$options = $this->get_custom_field_template_data();
|
4015 |
unset($options['value_count']);
|
|
|
4016 |
|
4017 |
if ( is_array($options['custom_fields']) ) :
|
4018 |
for($j=0;$j<count($options['custom_fields']);$j++) :
|
4 |
Plugin URI: http://wpgogo.com/development/custom-field-template.html
|
5 |
Description: This plugin adds the default custom fields on the Write Post/Page.
|
6 |
Author: Hiroaki Miyashita
|
7 |
+
Version: 2.0.6
|
8 |
Author URI: http://wpgogo.com/
|
9 |
*/
|
10 |
|
67 |
add_shortcode( 'cft', array(&$this, 'output_custom_field_values') );
|
68 |
add_shortcode( 'cftsearch', array(&$this, 'search_custom_field_values') );
|
69 |
endif;
|
|
|
70 |
}
|
71 |
|
72 |
function custom_field_template_init() {
|
908 |
endforeach;
|
909 |
endif;
|
910 |
elseif ( $options['hook'][$i]['post_type']=='post' ) :
|
911 |
+
if ( is_single() ) :
|
912 |
if ( !empty($options['hook'][$i]['use_php']) ) :
|
913 |
$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
|
914 |
endif;
|
1403 |
<tr><th><strong>HOOK #<?php echo $i; ?></strong></th></tr>
|
1404 |
<tr><td>
|
1405 |
<p><label for="custom_field_template_hook_position[<?php echo $i; ?>]"><?php echo sprintf(__('Position', 'custom-field-template'), $i); ?></label>:<br />
|
1406 |
+
<label><input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="1" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==1 ) echo ' checked="checked"'; ?> /> <?php _e('Before the content', 'custom-field-template'); ?></label>
|
1407 |
+
<label><input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="0" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==0) echo ' checked="checked"'; ?> /> <?php _e('After the content', 'custom-field-template'); ?></label>
|
1408 |
+
<label><input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="2" <?php if( isset($options['hook'][$i]['position']) && $options['hook'][$i]['position']==2) echo ' checked="checked"'; ?> /> <?php echo sprintf(__('Inside the content ([cfthook hook=%d])', 'custom-field-template'), $i); ?></label>
|
1409 |
</p>
|
1410 |
<p><label for="custom_field_template_hook_post_type[<?php echo $i; ?>]"><?php echo sprintf(__('Post Type', 'custom-field-template'), $i); ?></label>:<br />
|
1411 |
+
<label><input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value=""<?php if ( !isset($options['hook'][$i]['post_type']) ) : echo ' checked="checked"'; endif; ?> /> <?php _e('Both', 'custom-field-template'); ?></label>
|
1412 |
+
<label><input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value="post"<?php if ( isset($options['hook'][$i]['post_type']) && $options['hook'][$i]['post_type']=='post') : echo ' checked="checked"'; endif; ?> /> <?php _e('Post', 'custom-field-template'); ?></label>
|
1413 |
+
<label><input type="radio" name="custom_field_template_hook_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_post_type[<?php echo $i; ?>]" value="page"<?php if ( isset($options['hook'][$i]['post_type']) && $options['hook'][$i]['post_type']=='page') : echo ' checked="checked"'; endif; ?> /> <?php _e('Page', 'custom-field-template'); ?></label></p>
|
1414 |
<p><label for="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]"><?php echo sprintf(__('Custom Post Type (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
|
1415 |
<input type="text" name="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]" id="custom_field_template_hook_custom_post_type[<?php echo $i; ?>]" value="<?php if ( isset($options['hook'][$i]['custom_post_type']) ) echo esc_attr(stripcslashes($options['hook'][$i]['custom_post_type'])); ?>" size="80" /></p>
|
1416 |
<p><label for="custom_field_template_hook_category[<?php echo $i; ?>]"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
|
1417 |
<input type="text" name="custom_field_template_hook_category[<?php echo $i; ?>]" id="custom_field_template_hook_category[<?php echo $i; ?>]" value="<?php if ( isset($options['hook'][$i]['category']) ) echo esc_attr(stripcslashes($options['hook'][$i]['category'])); ?>" size="80" /></p>
|
1418 |
<p><label for="custom_field_template_hook_content[<?php echo $i; ?>]"><?php echo sprintf(__('Content', 'custom-field-template'), $i); ?></label>:<br /><textarea name="custom_field_template_hook_content[<?php echo $i; ?>]" class="large-text resizable" rows="5" cols="80"><?php if ( isset($options['hook'][$i]['content']) ) echo stripcslashes($options['hook'][$i]['content']); ?></textarea></p>
|
1419 |
+
<p><label><input type="checkbox" name="custom_field_template_hook_use_php[<?php echo $i; ?>]" id="custom_field_template_hook_use_php[<?php echo $i; ?>]" value="1" <?php if ( !empty($options['hook'][$i]['use_php']) ) { echo ' checked="checked"'; } ?> /> <?php _e('Use PHP', 'custom-field-template'); ?></label></p>
|
1420 |
+
<p><label><input type="checkbox" name="custom_field_template_hook_feed[<?php echo $i; ?>]" id="custom_field_template_hook_feed[<?php echo $i; ?>]" value="1" <?php if ( !empty($options['hook'][$i]['feed']) ) { echo ' checked="checked"'; } ?> /> <?php _e('Apply to feeds', 'custom-field-template'); ?></label></p>
|
1421 |
</td></tr>
|
1422 |
<?php
|
1423 |
endfor;
|
1743 |
<h3><?php _e('CMS x WP', 'custom-field-template'); ?></h3>
|
1744 |
<div class="inside">
|
1745 |
<p><?php _e('There are much more plugins which are useful for developing business websites such as membership sites or ec sites. You could totally treat WordPress as CMS by use of CMS x WP plugins.', 'custom-field-template'); ?></p>
|
1746 |
+
<p style="text-align:center"><a href="http://www.cmswp.jp/" target="_blank"><img src="<?php echo get_option('siteurl') . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/'; ?>cmswp.jpg" width="125" height="125" alt="CMSxWP" /></a><br /><a href="http://www.cmswp.jp/" target="_blank"><?php _e('WordPress plugin sales site: CMS x WP', 'custom-field-template'); ?></a></p>
|
1747 |
</div>
|
1748 |
</div>
|
1749 |
<?php
|
2938 |
function edit_meta_value( $id, $post ) {
|
2939 |
global $wpdb, $wp_version, $current_user;
|
2940 |
$options = $this->get_custom_field_template_data();
|
2941 |
+
|
2942 |
if( !isset( $id ) || isset($_REQUEST['post_ID']) )
|
2943 |
$id = $_REQUEST['post_ID'];
|
2944 |
|
3141 |
else
|
3142 |
$tags_input = $tags_value;
|
3143 |
if ( substr($wp_version, 0, 3) >= '2.8' )
|
3144 |
+
wp_set_post_terms( $id, $tags_value, $tags_key, true );
|
3145 |
else if ( substr($wp_version, 0, 3) >= '2.3' )
|
3146 |
wp_set_post_tags( $id, $tags_value );
|
3147 |
endforeach;
|
3363 |
), $attr));
|
3364 |
|
3365 |
$metakey = $key;
|
3366 |
+
$output = '';
|
3367 |
if ( $metakey ) :
|
3368 |
if ( $value_count && $value ) :
|
3369 |
return number_format($options['value_count'][$metakey][$value]);
|
3382 |
$val = wp_get_attachment_image($val, $image_size);
|
3383 |
endif;
|
3384 |
endif;
|
3385 |
+
$output .= (isset($before_value) ? $before_value : '') . $val . (isset($after_value) ? $after_value : '') . "\n";
|
3386 |
endforeach;
|
3387 |
if ( $after_list ) : $output .= $after_list . "\n"; endif;
|
3388 |
return do_shortcode($output);
|
3918 |
$sql = " meta.meta_value " . $_REQUEST['order'];
|
3919 |
endif;
|
3920 |
endif;
|
3921 |
+
|
3922 |
return $sql;
|
3923 |
endif;
|
3924 |
|
4013 |
global $wpdb;
|
4014 |
$options = $this->get_custom_field_template_data();
|
4015 |
unset($options['value_count']);
|
4016 |
+
set_time_limit(0);
|
4017 |
|
4018 |
if ( is_array($options['custom_fields']) ) :
|
4019 |
for($j=0;$j<count($options['custom_fields']);$j++) :
|
readme.txt
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
=== Custom Field Template ===
|
2 |
Contributors: Hiroaki Miyashita
|
3 |
Donate link: http://wpgogo.com/development/custom-field-template.html
|
4 |
-
Tags: custom, fields, field, template, meta, custom field
|
5 |
Requires at least: 2.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.0.
|
|
|
8 |
|
9 |
-
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -85,7 +86,7 @@ Localization
|
|
85 |
|
86 |
If you have translated into your language, please let me know.
|
87 |
|
88 |
-
* [Japanese Manual](http://ja.wpcft.com/)
|
89 |
|
90 |
== Installation ==
|
91 |
|
@@ -110,6 +111,9 @@ See the default template and modify it.
|
|
110 |
|
111 |
== Changelog ==
|
112 |
|
|
|
|
|
|
|
113 |
= 2.0.5 =
|
114 |
* Template Format for the edit screen. `[key]` will be converted to the input field. `[[key]]` is for the default key output. The `fieldset` type has not been supported yet.
|
115 |
* `wrap` attribute for the textarea type.
|
1 |
=== Custom Field Template ===
|
2 |
Contributors: Hiroaki Miyashita
|
3 |
Donate link: http://wpgogo.com/development/custom-field-template.html
|
4 |
+
Tags: custom field, custom fields, custom, fields, field, template, meta, custom field template, custom post type
|
5 |
Requires at least: 2.1
|
6 |
+
Tested up to: 3.5
|
7 |
+
Stable tag: 2.0.6
|
8 |
+
License: GPLv2 or later
|
9 |
|
10 |
+
The Custom Field Template plugin extends the functionality of custom fields.
|
11 |
|
12 |
== Description ==
|
13 |
|
86 |
|
87 |
If you have translated into your language, please let me know.
|
88 |
|
89 |
+
* [Japanese Custom Field Template Manual](http://ja.wpcft.com/)
|
90 |
|
91 |
== Installation ==
|
92 |
|
111 |
|
112 |
== Changelog ==
|
113 |
|
114 |
+
= 2.0.6 =
|
115 |
+
* Bugfix: inappropriate output with the cftsearch shortcode.
|
116 |
+
|
117 |
= 2.0.5 =
|
118 |
* Template Format for the edit screen. `[key]` will be converted to the input field. `[[key]]` is for the default key output. The `fieldset` type has not been supported yet.
|
119 |
* `wrap` attribute for the textarea type.
|