Version Description
- Code cleaning.
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 2.4.5 |
Comparing to | |
See all releases |
Code changes from version 2.4.4 to 2.4.5
- custom-field-template.php +18 -20
- readme.txt +4 -1
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
custom-field-template.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://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 |
Author URI: https://wpgogo.com/
|
8 |
-
Version: 2.4.
|
9 |
Text Domain: custom-field-template
|
10 |
Domain Path: /
|
11 |
*/
|
@@ -364,13 +364,6 @@ class custom_field_template {
|
|
364 |
global $wp_version, $post;
|
365 |
$options = $this->get_custom_field_template_data();
|
366 |
|
367 |
-
if ( !defined('WP_PLUGIN_DIR') )
|
368 |
-
$plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) );
|
369 |
-
else
|
370 |
-
$plugin_dir = dirname( plugin_basename(__FILE__) );
|
371 |
-
|
372 |
-
echo '<link rel="stylesheet" type="text/css" href="' . wp_guess_url() . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/datePicker.css" />'."\n";
|
373 |
-
|
374 |
if ( !empty($options['custom_field_template_use_validation']) ) :
|
375 |
if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
|
376 |
?>
|
@@ -771,6 +764,7 @@ class custom_field_template {
|
|
771 |
if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
|
772 |
wp_enqueue_script('date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') );
|
773 |
wp_enqueue_script('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') );
|
|
|
774 |
wp_enqueue_script('editor');
|
775 |
wp_enqueue_script('quicktags');
|
776 |
|
@@ -951,7 +945,7 @@ type = file';
|
|
951 |
elseif ( $options['hook'][$i]['custom_post_type'] ) :
|
952 |
$custom_post_type = explode(',', $options['hook'][$i]['custom_post_type']);
|
953 |
$custom_post_type = array_filter( $custom_post_type );
|
954 |
-
|
955 |
if ( in_array($post->post_type, $custom_post_type) ) :
|
956 |
if ( !empty($options['hook'][$i]['use_php']) ) :
|
957 |
$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
|
@@ -1158,7 +1152,8 @@ margin-bottom:0pt;
|
|
1158 |
<table class="form-table" style="margin-bottom:5px;">
|
1159 |
<tbody>
|
1160 |
<?php
|
1161 |
-
|
|
|
1162 |
?>
|
1163 |
<tr><td>
|
1164 |
<p><strong>TEMPLATE #<?php echo $i; ?></strong>
|
@@ -2349,7 +2344,7 @@ jQuery(this).addClass("closed");
|
|
2349 |
|
2350 |
if( isset( $post_id ) && $post_id > 0 && $_REQUEST['default'] != true ) {
|
2351 |
$value = $this->get_post_meta( $post_id, $title );
|
2352 |
-
$ct_value = count($value);
|
2353 |
$value = isset($value[ $cftnum ]) ? $value[ $cftnum ] : '';
|
2354 |
}
|
2355 |
|
@@ -2749,7 +2744,8 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
2749 |
$val['category'] = preg_replace('/\s/', '', $val['category']);
|
2750 |
$categories = explode(',', $val['category']);
|
2751 |
$categories = array_filter($categories);
|
2752 |
-
|
|
|
2753 |
$query = "SELECT * FROM `".$wpdb->prefix."term_taxonomy` WHERE term_id IN (".addslashes($val['category']).")";
|
2754 |
$result = $wpdb->get_results($query, ARRAY_A);
|
2755 |
$category_taxonomy = array();
|
@@ -3361,9 +3357,15 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3361 |
if ( isset($data['multiple']) && $data['multiple'] == true && $data['type'] != 'checkbox' && $data['type'] != 'fieldset_open' && !isset($fieldset) ) :
|
3362 |
$counter = isset($_REQUEST[$this->sanitize_name($title)][$tmp_parentSN+$gap]) ? count($_REQUEST[$this->sanitize_name($title)][$tmp_parentSN+$gap]) : 0;
|
3363 |
if ( $data['type'] == 'file' && !empty($_FILES[$this->sanitize_name($title)]) ) $counter = (int)count($_FILES[$this->sanitize_name($title)]['name'][$tmp_parentSN+$gap])+1;
|
3364 |
-
if ( isset($_REQUEST['post_ID']) )
|
3365 |
-
|
3366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3367 |
if ( !$counter ) :
|
3368 |
$counter = $org_counter;
|
3369 |
$counter++;
|
@@ -3954,11 +3956,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3954 |
|
3955 |
if ( isset($_REQUEST['s']) ) :
|
3956 |
$where .= ' AND (';
|
3957 |
-
|
3958 |
-
$s = mb_split('\s', $_REQUEST['s']);
|
3959 |
-
else:
|
3960 |
-
$s = split('\s', $_REQUEST['s']);
|
3961 |
-
endif;
|
3962 |
$i=0;
|
3963 |
foreach ( $s as $v ) :
|
3964 |
if ( !empty($v) ) :
|
5 |
Description: This plugin adds the default custom fields on the Write Post/Page.
|
6 |
Author: Hiroaki Miyashita
|
7 |
Author URI: https://wpgogo.com/
|
8 |
+
Version: 2.4.5
|
9 |
Text Domain: custom-field-template
|
10 |
Domain Path: /
|
11 |
*/
|
364 |
global $wp_version, $post;
|
365 |
$options = $this->get_custom_field_template_data();
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
if ( !empty($options['custom_field_template_use_validation']) ) :
|
368 |
if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
|
369 |
?>
|
764 |
if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
|
765 |
wp_enqueue_script('date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') );
|
766 |
wp_enqueue_script('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') );
|
767 |
+
wp_enqueue_style('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/datePicker.css' );
|
768 |
wp_enqueue_script('editor');
|
769 |
wp_enqueue_script('quicktags');
|
770 |
|
945 |
elseif ( $options['hook'][$i]['custom_post_type'] ) :
|
946 |
$custom_post_type = explode(',', $options['hook'][$i]['custom_post_type']);
|
947 |
$custom_post_type = array_filter( $custom_post_type );
|
948 |
+
$custom_post_type = array_map( 'trim', $custom_post_type );
|
949 |
if ( in_array($post->post_type, $custom_post_type) ) :
|
950 |
if ( !empty($options['hook'][$i]['use_php']) ) :
|
951 |
$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
|
1152 |
<table class="form-table" style="margin-bottom:5px;">
|
1153 |
<tbody>
|
1154 |
<?php
|
1155 |
+
$count = isset($options['custom_fields']) && is_array($options['custom_fields']) ? count($options['custom_fields'])+1 : 1;
|
1156 |
+
for ( $i = 0; $i < $count; $i++ ) {
|
1157 |
?>
|
1158 |
<tr><td>
|
1159 |
<p><strong>TEMPLATE #<?php echo $i; ?></strong>
|
2344 |
|
2345 |
if( isset( $post_id ) && $post_id > 0 && $_REQUEST['default'] != true ) {
|
2346 |
$value = $this->get_post_meta( $post_id, $title );
|
2347 |
+
$ct_value = (!empty($value) && is_array($value)) ? count($value) : 0;
|
2348 |
$value = isset($value[ $cftnum ]) ? $value[ $cftnum ] : '';
|
2349 |
}
|
2350 |
|
2744 |
$val['category'] = preg_replace('/\s/', '', $val['category']);
|
2745 |
$categories = explode(',', $val['category']);
|
2746 |
$categories = array_filter($categories);
|
2747 |
+
$categories = array_map( 'trim', $categories );
|
2748 |
+
|
2749 |
$query = "SELECT * FROM `".$wpdb->prefix."term_taxonomy` WHERE term_id IN (".addslashes($val['category']).")";
|
2750 |
$result = $wpdb->get_results($query, ARRAY_A);
|
2751 |
$category_taxonomy = array();
|
3357 |
if ( isset($data['multiple']) && $data['multiple'] == true && $data['type'] != 'checkbox' && $data['type'] != 'fieldset_open' && !isset($fieldset) ) :
|
3358 |
$counter = isset($_REQUEST[$this->sanitize_name($title)][$tmp_parentSN+$gap]) ? count($_REQUEST[$this->sanitize_name($title)][$tmp_parentSN+$gap]) : 0;
|
3359 |
if ( $data['type'] == 'file' && !empty($_FILES[$this->sanitize_name($title)]) ) $counter = (int)count($_FILES[$this->sanitize_name($title)]['name'][$tmp_parentSN+$gap])+1;
|
3360 |
+
if ( isset($_REQUEST['post_ID']) ) :
|
3361 |
+
$tmp = $this->get_post_meta( $_REQUEST['post_ID'], $title );
|
3362 |
+
$org_counter = !empty($tmp) ? count($tmp) : 0;
|
3363 |
+
elseif ( isset($_REQUEST['post']) ) :
|
3364 |
+
$tmp = $this->get_post_meta( $_REQUEST['post'], $title );
|
3365 |
+
$org_counter = !empty($tmp) ? count($tmp) : 0;
|
3366 |
+
else :
|
3367 |
+
$org_counter = 1;
|
3368 |
+
endif;
|
3369 |
if ( !$counter ) :
|
3370 |
$counter = $org_counter;
|
3371 |
$counter++;
|
3956 |
|
3957 |
if ( isset($_REQUEST['s']) ) :
|
3958 |
$where .= ' AND (';
|
3959 |
+
$s = preg_split('/[\s|\x{3000}]+/u', $_REQUEST['s']);
|
|
|
|
|
|
|
|
|
3960 |
$i=0;
|
3961 |
foreach ( $s as $v ) :
|
3962 |
if ( !empty($v) ) :
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: custom field, custom fields, custom, fields, field, template, meta, custom field template, custom post type, acf, advanced
|
5 |
Requires at least: 2.1
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 2.4.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
The Custom Field Template plugin extends the functionality of custom fields.
|
@@ -114,6 +114,9 @@ See the default template and modify it.
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
117 |
= 2.4.4 =
|
118 |
* Code cleaning.
|
119 |
* Bugfix: media picker for pages.
|
4 |
Tags: custom field, custom fields, custom, fields, field, template, meta, custom field template, custom post type, acf, advanced
|
5 |
Requires at least: 2.1
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 2.4.5
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
The Custom Field Template plugin extends the functionality of custom fields.
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 2.4.5 =
|
118 |
+
* Code cleaning.
|
119 |
+
|
120 |
= 2.4.4 =
|
121 |
* Code cleaning.
|
122 |
* Bugfix: media picker for pages.
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|