Permalink
Browse files

Added WYSIWYG in repater support and most other fields which never wo…

…rked in the repeate block, now should work. issue #42
  • Loading branch information...
1 parent 89c6df0 commit 661dcec247f22217dae28405ba4507c973a22637 @bainternet committed Nov 7, 2012
Showing with 32 additions and 9 deletions.
  1. +3 −0 README
  2. +17 −7 Tax-meta-class/Tax-meta-class.php
  3. +11 −1 Tax-meta-class/js/tax-meta-clss.js
  4. +1 −1 class-usage-demo.php
View
3 README
@@ -20,6 +20,9 @@ Other options are available for each field which can be see in the 'Tax-meta-cla
Changelog
---------
+1.9.6
+Added WYSIWYG in repater support and most other fields which never worked in the repeate block, now should work. issue #42
+
1.9.5
Fixed Typo in validation call Props @Screenfeed.
@@ -9,7 +9,7 @@
* This class is derived from My-Meta-Box (https://github.com/bainternet/My-Meta-Box script) which is
* a class for creating custom meta boxes for WordPress.
*
- * @version 1.9.5
+ * @version 1.9.6
* @copyright 2012 Ohad Raz
* @author Ohad Raz (email: admin@bainternet.info)
* @link http://en.bainternet.info
@@ -545,8 +545,12 @@ public function show_field_repeater( $field, $meta ) {
$f['id'] = $id;
if (!$field['inline']){
echo '<tr>';
- }
- call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, is_array($m)? $m : stripslashes($m));
+ }
+ if ($f['type'] == 'wysiwyg')
+ call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, is_array($m)? $m : stripslashes($m),true);
+ else
+ call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, is_array($m)? $m : stripslashes($m));
+
if (!$field['inline']){
echo '</tr>';
}
@@ -597,7 +601,11 @@ public function show_field_repeater( $field, $meta ) {
if (!$field['inline']){
echo '<tr>';
}
- call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, '');
+ if ($f['type'] == 'wysiwyg')
+ call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, '',true);
+ else
+ call_user_func ( array( &$this, 'show_field_' . $f['type'] ), $f, '');
+
if (!$field['inline']){
echo '</tr>';
}
@@ -613,7 +621,9 @@ public function show_field_repeater( $field, $meta ) {
}
echo '" alt="'.__('Remove','tax-meta').'" title="'.__('Remove','tax-meta').'" id="remove-'.$field['id'].'"></div>';
$counter = 'countadd_'.$field['id'];
- $js_code = ob_get_clean ();
+ $js_code = ob_get_clean ();
+ $js_code = str_replace("\n","",$js_code);
+ $js_code = str_replace("\r","",$js_code);
$js_code = str_replace("'","\"",$js_code);
$js_code = str_replace("CurrentCounter","' + ".$counter." + '",$js_code);
echo '<script>
@@ -826,12 +836,12 @@ public function show_field_checkbox( $field, $meta ) {
* @since 1.0
* @access public
*/
- public function show_field_wysiwyg( $field, $meta ) {
+ public function show_field_wysiwyg( $field, $meta ,$in_repeater = false) {
$this->show_field_begin( $field, $meta );
// Add TinyMCE script for WP version < 3.3
global $wp_version;
- if ( version_compare( $wp_version, '3.2.1' ) < 1 ) {
+ if ( version_compare( $wp_version, '3.2.1' ) < 1 || $in_repeater) {
echo "<textarea style='{$field['style']}' class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
}else{
// Use new wp_editor() since WP 3.3
@@ -13,7 +13,17 @@
var $ =jQuery.noConflict();
function update_repeater_fields(){
-
+ /**
+ * WysiWyg editor
+ *
+ * @since 1.9.6
+ */
+ $(".theEditor").each(function(){
+ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
+ tinyMCE.execCommand("mceAddControl", false, $(this).attr('id'));
+ }
+ });
+
/**
* Datepicker Field.
*
View
@@ -3,7 +3,7 @@
Plugin Name: Demo Tax meta class
Plugin URI: http://en.bainternet.info
Description: Tax meta class usage demo
-Version: 1.9.5
+Version: 1.9.6
Author: Bainternet, Ohad Raz
Author URI: http://en.bainternet.info
*/

0 comments on commit 661dcec

Please sign in to comment.