Smart Custom Fields - Version 1.5.0

Version Description

  • Update wysiwyg field.
Download this release

Release Info

Developer inc2734
Plugin Icon wp plugin Smart Custom Fields
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.0 to 1.5.0

classes/fields/class.field-wysiwyg.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Field_Wysiwyg
4
- * Version : 1.1.1
5
  * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
- * Modified : March 19, 2015
8
  * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
@@ -81,6 +81,11 @@ class Smart_Custom_Fields_Field_Wysiwyg extends Smart_Custom_Fields_Field_Base {
81
  public function get_field( $index, $value ) {
82
  $name = $this->get_field_name_in_editor( $index );
83
  $disabled = $this->get_disable_attribute( $index );
 
 
 
 
 
84
  return sprintf(
85
  '<div class="wp-editor-wrap">
86
  <div class="wp-media-buttons">%s</div>
@@ -91,7 +96,7 @@ class Smart_Custom_Fields_Field_Wysiwyg extends Smart_Custom_Fields_Field_Base {
91
  $this->media_buttons(),
92
  esc_attr( $name ),
93
  disabled( true, $disabled, false ),
94
- wp_richedit_pre( $value )
95
  );
96
  }
97
 
@@ -124,7 +129,7 @@ class Smart_Custom_Fields_Field_Wysiwyg extends Smart_Custom_Fields_Field_Base {
124
  </tr>
125
  <?php
126
  }
127
-
128
  /**
129
  * メディアボタンを返す
130
  *
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Field_Wysiwyg
4
+ * Version : 1.1.2
5
  * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
+ * Modified : September 2, 2015
8
  * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
81
  public function get_field( $index, $value ) {
82
  $name = $this->get_field_name_in_editor( $index );
83
  $disabled = $this->get_disable_attribute( $index );
84
+ if ( function_exists( 'format_for_editor' ) ) {
85
+ $value = format_for_editor( $value );
86
+ } else {
87
+ $value = wp_richedit_pre( $value );
88
+ }
89
  return sprintf(
90
  '<div class="wp-editor-wrap">
91
  <div class="wp-media-buttons">%s</div>
96
  $this->media_buttons(),
97
  esc_attr( $name ),
98
  disabled( true, $disabled, false ),
99
+ $value
100
  );
101
  }
102
 
129
  </tr>
130
  <?php
131
  }
132
+
133
  /**
134
  * メディアボタンを返す
135
  *
js/editor.js CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
  * editor.js
3
- * Version : 1.1.1
4
  * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
- * Modified : April 24, 2015
7
  * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
@@ -24,13 +24,23 @@ jQuery( function( $ ) {
24
  $( this ).attr( 'id', 'smart-cf-wysiwyg-' + cnt + i );
25
  var editor_id = $( this ).attr( 'id' );
26
  $( this ).parents( '.wp-editor-wrap' ).find( 'a.add_media' ).attr( 'data-editor', editor_id );
27
- tinymce.init( {
28
- content_css: ['../wp-includes/js/tinymce/skins/wordpress/wp-content.css', '../wp-content/plugins/smart-custom-fields/css/wysiwyg.css'],
29
- menubar: false,
30
- plugins: "hr,wplink,fullscreen,wordpress,textcolor,paste,charmap",
31
- toolbar1: "bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_adv,fullscreen",
32
- toolbar2: "formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help,code"
33
- } );
 
 
 
 
 
 
 
 
 
 
34
  tinymce.execCommand( 'mceAddEditor', false, editor_id );
35
  }
36
  } );
@@ -224,4 +234,4 @@ jQuery( function( $ ) {
224
  } );
225
 
226
  } );
227
- } );
1
  /**
2
  * editor.js
3
+ * Version : 1.2.0
4
  * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
+ * Modified : September 2, 2015
7
  * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
24
  $( this ).attr( 'id', 'smart-cf-wysiwyg-' + cnt + i );
25
  var editor_id = $( this ).attr( 'id' );
26
  $( this ).parents( '.wp-editor-wrap' ).find( 'a.add_media' ).attr( 'data-editor', editor_id );
27
+ var init;
28
+ console.log( tinyMCEPreInit.mceInit.content );
29
+ console.log( typeof tinyMCEPreInit.mceInit.content );
30
+ if ( typeof tinyMCEPreInit.mceInit.content !== 'undefined' ) {
31
+ init = tinyMCEPreInit.mceInit.content;
32
+ } else {
33
+ init = {
34
+ content_css: ['../wp-includes/js/tinymce/skins/wordpress/wp-content.css', '../wp-content/plugins/smart-custom-fields/css/wysiwyg.css'],
35
+ menubar: false,
36
+ plugins: "hr,wplink,fullscreen,wordpress,textcolor,paste,charmap",
37
+ toolbar1: "bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_adv,fullscreen",
38
+ toolbar2: "formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help,code",
39
+ convert_urls: false
40
+ };
41
+ }
42
+ console.log( init );
43
+ tinymce.init( init );
44
  tinymce.execCommand( 'mceAddEditor', false, editor_id );
45
  }
46
  } );
234
  } );
235
 
236
  } );
237
+ } );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Smart Custom Fields ===
2
- Contributors: inc2734, toro_unit
3
  Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
  Tested up to: 4.2.1
7
- Stable tag: 1.4.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -86,6 +86,9 @@ You can send your own language pack to me.
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 1.4.0 =
90
  * refactoring controllers.
91
  * Add term custom fields.
@@ -160,4 +163,4 @@ You can send your own language pack to me.
160
  * Textarea does not filter the_content filter in SCF::get() and SCF::gets().
161
 
162
  = 1.0.0 =
163
- * Initial release.
1
  === Smart Custom Fields ===
2
+ Contributors: inc2734, toro_unit, mimosafa
3
  Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
  Tested up to: 4.2.1
7
+ Stable tag: 1.5.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
86
 
87
  == Changelog ==
88
 
89
+ = 1.5.0 =
90
+ * Update wysiwyg field.
91
+
92
  = 1.4.0 =
93
  * refactoring controllers.
94
  * Add term custom fields.
163
  * Textarea does not filter the_content filter in SCF::get() and SCF::gets().
164
 
165
  = 1.0.0 =
166
+ * Initial release.
smart-custom-fields.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
- * Version: 1.4.0
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
@@ -60,7 +60,7 @@ class Smart_Custom_Fields {
60
  }
61
  }
62
  do_action( SCF_Config::PREFIX . 'fields-loaded' );
63
-
64
  add_action( 'init' , array( $this, 'register_post_type' ) );
65
  add_action( 'init' , array( $this, 'ajax_request' ) );
66
  add_action( 'admin_menu' , array( $this, 'admin_menu' ) );
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
+ * Version: 1.5.0
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
60
  }
61
  }
62
  do_action( SCF_Config::PREFIX . 'fields-loaded' );
63
+
64
  add_action( 'init' , array( $this, 'register_post_type' ) );
65
  add_action( 'init' , array( $this, 'ajax_request' ) );
66
  add_action( 'admin_menu' , array( $this, 'admin_menu' ) );