Example #1
0
function sb_admin_load()
{
    global $sb_admin;
    // Load the scripts for handling metaboxes
    wp_enqueue_script('common');
    wp_enqueue_script('wp-lists');
    wp_enqueue_script('postbox');
    // Load StartBox-specific scripts and styles
    wp_enqueue_script('colorbox');
    wp_enqueue_script('jquery-ajaxuploader', SCRIPTS_URL . '/jquery.ajaxupload.js');
    wp_enqueue_script('jquery-colorpicker', SCRIPTS_URL . '/colorpicker/js/colorpicker.js');
    wp_enqueue_script('sb-admin', SCRIPTS_URL . '/admin.js', array('jquery-colorpicker'));
    wp_enqueue_style('colorpicker', SCRIPTS_URL . '/colorpicker/css/colorpicker.css');
    wp_enqueue_style('sb-admin', STYLES_URL . '/admin.css');
    wp_enqueue_style('colorbox');
    // Load scripts for TinyMCE (Credit: Lee Doel)
    if (user_can_richedit()) {
        wp_enqueue_script('editor');
        wp_enqueue_script('media-upload');
        wp_enqueue_style('thickbox');
        add_action('admin_head', 'wp_tiny_mce');
    }
    if (sb_get_option('reset')) {
        sb_set_default_options();
        wp_redirect(admin_url('admin.php?page=sb_admin&reset=true'));
    }
}
 public static function parse_settings($editor_id, $settings)
 {
     $set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     if (empty($set['editor_height'])) {
         return $set;
     }
     if ('content' === $editor_id) {
         // A cookie (set when a user resizes the editor) overrides the height.
         $cookie = (int) get_user_setting('ed_size');
         // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
         if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) {
             parse_str($_COOKIE['TinyMCE_content_size'], $cookie);
             $cookie = $cookie['ch'];
         }
         if ($cookie) {
             $set['editor_height'] = $cookie;
         }
     }
     if ($set['editor_height'] < 50) {
         $set['editor_height'] = 50;
     } elseif ($set['editor_height'] > 5000) {
         $set['editor_height'] = 5000;
     }
     return $set;
 }
Example #3
0
 /**
  * Parse default arguments for the editor instance.
  *
  * @param string $editor_id ID for the current editor instance.
  * @param array  $settings {
  *     Array of editor arguments.
  *
  *     @type bool       $wpautop           Whether to use wpautop(). Default true.
  *     @type bool       $media_buttons     Whether to show the Add Media/other media buttons.
  *     @type string     $default_editor    When both TinyMCE and Quicktags are used, set which
  *                                         editor is shown on page load. Default empty.
  *     @type bool       $drag_drop_upload  Whether to enable drag & drop on the editor uploading. Default false.
  *                                         Requires the media modal.
  *     @type string     $textarea_name     Give the textarea a unique name here. Square brackets
  *                                         can be used here. Default $editor_id.
  *     @type int        $textarea_rows     Number rows in the editor textarea. Default 20.
  *     @type string|int $tabindex          Tabindex value to use. Default empty.
  *     @type string     $tabfocus_elements The previous and next element ID to move the focus to
  *                                         when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
  *     @type string     $editor_css        Intended for extra styles for both Visual and Text editors.
  *                                         Should include <style> tags, and can use "scoped". Default empty.
  *     @type string     $editor_class      Extra classes to add to the editor textarea elemen. Default empty.
  *     @type bool       $teeny             Whether to output the minimal editor config. Examples include
  *                                         Press This and the Comment editor. Default false.
  *     @type bool       $dfw               Whether to replace the default fullscreen with "Distraction Free
  *                                         Writing". DFW requires specific DOM elements and css). Default false.
  *     @type bool|array $tinymce           Whether to load TinyMCE. Can be used to pass settings directly to
  *                                         TinyMCE using an array. Default true.
  *     @type bool|array $quicktags         Whether to load Quicktags. Can be used to pass settings directly to
  *                                         Quicktags using an array. Default true.
  * }
  * @return array Parsed arguments array.
  */
 public static function parse_settings($editor_id, $settings)
 {
     $set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     if (self::$this_tinymce) {
         if (false !== strpos($editor_id, '[')) {
             self::$this_tinymce = false;
             _deprecated_argument('wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.');
         }
     }
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     if (empty($set['editor_height'])) {
         return $set;
     }
     if ('content' === $editor_id) {
         // A cookie (set when a user resizes the editor) overrides the height.
         $cookie = (int) get_user_setting('ed_size');
         if ($cookie) {
             $set['editor_height'] = $cookie;
         }
     }
     if ($set['editor_height'] < 50) {
         $set['editor_height'] = 50;
     } elseif ($set['editor_height'] > 5000) {
         $set['editor_height'] = 5000;
     }
     return $set;
 }
Example #4
0
	/**
	 * Categorize constructor
	 *
	 * @return void	 
	 **/
	function __construct () {
		parent::__construct();

		if (!empty($_GET['id']) && !isset($_GET['a'])) {

			wp_enqueue_script('postbox');
			if ( user_can_richedit() ) {
				wp_enqueue_script('editor');
				wp_enqueue_script('quicktags');
				add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 20 );
			}

			ecart_enqueue_script('colorbox');
			ecart_enqueue_script('editors');
			ecart_enqueue_script('category-editor');
			ecart_enqueue_script('priceline');
			ecart_enqueue_script('ocupload');
			ecart_enqueue_script('swfupload');
			ecart_enqueue_script('ecart-swfupload-queue');

			do_action('ecart_category_editor_scripts');
			add_action('admin_head',array(&$this,'layout'));
		} elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') {
			ecart_enqueue_script('category-arrange');
			do_action('ecart_category_arrange_scripts');
			add_action('admin_print_scripts',array(&$this,'arrange_cols'));
		} elseif (!empty($_GET['a']) && $_GET['a'] == 'products') {
			ecart_enqueue_script('products-arrange');
			do_action('ecart_category_products_arrange_scripts');
			add_action('admin_print_scripts',array(&$this,'products_cols'));
		} else add_action('admin_print_scripts',array(&$this,'columns'));
		do_action('ecart_category_admin_scripts');
		add_action('load-ecart_page_ecart-categories',array(&$this,'workflow'));
	}
 public function display_field($field, $group_index = 1, $field_index = 1)
 {
     global $mf_domain;
     $class = '';
     $max = '';
     if (isset($field['options']['max_length'])) {
         $max = sprintf('maxlength="%d"', $field['options']['height'] * $field['options']['width']);
     }
     $value = $field['input_value'];
     $output = '';
     $output .= '<div class="multiline_custom_field">';
     if (mf_settings::get('hide_visual_editor') == '1') {
         $field['options']['hide_visual'] = 1;
     }
     if ($field['options']['hide_visual'] == 0 && user_can_richedit()) {
         $output .= sprintf('<div class="tab_multi_mf">');
         $output .= sprintf('<a onclick="del_editor(\'%s\');" class="edButtonHTML_mf">HTML</a>', $field['input_id']);
         $output .= sprintf('<a onclick="add_editor(\'%s\');" class="edButtonHTML_mf current" >Visual</a>', $field['input_id']);
         $output .= sprintf('</div><br /><br />');
         $class = 'pre_editor add_editor_mf';
         if (mf_settings::get('dont_remove_tags') != '1') {
             $value = apply_filters('the_editor_content', $value);
         }
     }
     if ($field['options']['hide_visual'] == 0 && user_can_richedit()) {
         printf('<div style="display: none1" id="wp-%s-media-buttons" class="wp-media-buttons mf_media_button_div" >', $field['input_id']);
         require_once ABSPATH . 'wp-admin/includes/media.php';
         media_buttons($field['input_id']);
         printf('</div>');
     }
     $output .= sprintf('<textarea %s class="mf_editor %s" id="%s" name="%s" rows="%s" cols="%s" %s >%s</textarea>', $field['input_validate'], $class, $field['input_id'], $field['input_name'], $field['options']['height'], $field['options']['width'], $max, $value);
     $output .= '</div>';
     return $output;
 }
	public static function parse_settings($editor_id, $settings) {
		$set = wp_parse_args( $settings,  array(
			'wpautop' => true, // use wpautop?
			'media_buttons' => true, // show insert/upload button(s)
			'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
			'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
			'tabindex' => '',
			'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
			'editor_class' => '', // add extra class(es) to the editor textarea
			'teeny' => false, // output the minimal editor config used in Press This
			'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
			'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
			'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
		) );

		self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
		self::$this_quicktags = (bool) $set['quicktags'];

		if ( self::$this_tinymce )
			self::$has_tinymce = true;

		if ( self::$this_quicktags )
			self::$has_quicktags = true;

		return $set;
	}
Example #7
0
	/**
	 * Store constructor
	 *
	 * @return void	 
	 **/
	function __construct () {
		parent::__construct();
		if (!empty($_GET['id'])) {
			wp_enqueue_script('jquery-ui-draggable');
			wp_enqueue_script('suggest');
			wp_enqueue_script('postbox');
			if ( user_can_richedit() ) {
				wp_enqueue_script('editor');
				wp_enqueue_script('quicktags');
				add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 20 );
			}

			ecart_enqueue_script('colorbox');
			ecart_enqueue_script('editors');
			ecart_enqueue_script('scalecrop');
			ecart_enqueue_script('calendar');
			ecart_enqueue_script('product-editor');
			ecart_enqueue_script('priceline');
			ecart_enqueue_script('ocupload');
			ecart_enqueue_script('swfupload');
			ecart_enqueue_script('ecart-swfupload-queue');
			do_action('ecart_product_editor_scripts');
			add_action('admin_head',array(&$this,'layout'));
		} elseif (!empty($_GET['f']) && $_GET['f'] == 'i') {
			do_action('ecart_inventory_manager_scripts');
			add_action('admin_print_scripts',array(&$this,'inventory_cols'));
		} else add_action('admin_print_scripts',array(&$this,'columns'));
		add_action('load-ecart_page_ecart-products',array(&$this,'workflow'));
		do_action('ecart_product_admin_scripts');

		// Load the search model for indexing
		require_once(ECART_MODEL_PATH."/Search.php");
		new ContentParser();
		add_action('ecart_product_saved',array(&$this,'index'),99,1);
	}
 public function load_admin_scripts($hook)
 {
     global $sc_settings_page;
     if ($hook != $sc_settings_page) {
         return;
     }
     wp_enqueue_script('word-count');
     wp_enqueue_script('post');
     if (user_can_richedit()) {
         wp_enqueue_script('editor');
     }
     add_thickbox();
     wp_enqueue_script('media-upload');
     wp_enqueue_media();
     wp_enqueue_style('wp-color-picker');
     wp_enqueue_script('wp-color-picker');
     wp_enqueue_script('jquery-ui-slider');
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-effects-core');
     wp_enqueue_script('jquery-effects-slide');
     wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
     // Codemirror
     // wp_enqueue_script( 'codemirror-js', plugins_url( '/assets/codemirror-compressed.js', SC_ADS_DIR ), false, false, true  );
     // wp_enqueue_script( 'codemirror-closebrackets-js', plugins_url( '/assets/codemirror-closebrackets.js', SC_ADS_DIR ), false, false, true  );
     // wp_enqueue_style( 'codemirror-css',  plugins_url( '/assets/codemirror.css', SC_ADS_DIR ) );
     // Admin Assets
     wp_enqueue_script('sc-ads-admin-js', plugins_url('/assets/admin-scripts.js', SC_ADS_DIR), array('jquery', 'wp-color-picker'), false, true);
     wp_enqueue_style('sc-ads-admin-css', plugins_url('/assets/admin-style.css', SC_ADS_DIR));
 }
 function admin_scripts()
 {
     add_action('admin_print_footer_scripts', 'wp_tiny_mce', 25);
     if (user_can_richedit()) {
         wp_enqueue_script('editor');
     }
 }
 /**
  * @test
  */
 public function render_set_correct_default_editor()
 {
     $field_options = array('type' => 'tinymce', 'label' => 'A TinyMCE input', 'default_editor' => 'tmce');
     /* @var $base_field SiteOrigin_Widget_Field_Textarea */
     $field = new SiteOrigin_Widget_Field_TinyMCE('tinymce_input', 'tinymce_input_id', 'tinymce_input_name', $field_options);
     $field_output = get_field_render_output($field);
     $this->assertTrue(user_can_richedit());
     $this->assertContains('tmce-active', $field_output);
 }
Example #11
0
 /**
  * Displays the input control for the field.
  *
  * @since 0.5.0
  * @param string $val the current value of the field
  * @param bool $echo whether to echo the output (default is true)
  * @return string the HTML output of the field control
  */
 public function display($val, $echo = true)
 {
     $wp_editor_settings = array('textarea_name' => $this->args['name'], 'textarea_rows' => $this->args['rows'], 'editor_class' => $this->args['class'], 'default_editor' => user_can_richedit() ? 'tinymce' : 'html', 'wpautop' => true, 'media_buttons' => true, 'quicktags' => array('buttons' => 'strong,em,u,link,block,del,ins,img,ul,ol,li,code,close'), 'tinymce' => array('toolbar1' => 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,spellchecker,wp_adv'));
     ob_start();
     wp_editor($val, $this->args['id'], $wp_editor_settings);
     $output = ob_get_clean();
     if ($echo) {
         echo $output;
     }
     return $output;
 }
Example #12
0
 public static function parse_settings($editor_id, $settings)
 {
     $set = nxt_parse_args($settings, array('nxtautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     return $set;
 }
 /**
  * Kick things off for the shortcode generator
  *
  * @since 1.3.0.2
  */
 public function init()
 {
     if ($this->shortcode_tag) {
         $this->self = get_class($this);
         $this->errors = array();
         $this->required = array();
         // Generate the fields, errors, and requirements
         $fields = $this->get_fields();
         $defaults = array('btn_close' => esc_html__('Close', 'give'), 'btn_okay' => esc_html__('Insert Shortcode', 'give'), 'errors' => $this->errors, 'fields' => $fields, 'label' => '[' . $this->shortcode_tag . ']', 'required' => $this->required, 'title' => esc_html__('Insert Shortcode', 'give'));
         if (user_can_richedit()) {
             Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
         }
     }
 }
Example #14
0
 /**
  * Parse default arguments for the editor instance.
  *
  * @param string $editor_id ID for the current editor instance.
  * @param array  $settings {
  *     Array of editor arguments.
  *
  *     @type bool       $wpautop           Whether to use wpautop(). Default true.
  *     @type bool       $media_buttons     Whether to show the Add Media/other media buttons.
  *     @type string     $default_editor    When both TinyMCE and Quicktags are used, set which
  *                                         editor is shown on page load. Default empty.
  *     @type bool       $drag_drop_upload  Whether to enable drag & drop on the editor uploading. Default false.
  *                                         Requires the media modal.
  *     @type string     $textarea_name     Give the textarea a unique name here. Square brackets
  *                                         can be used here. Default $editor_id.
  *     @type int        $textarea_rows     Number rows in the editor textarea. Default 20.
  *     @type string|int $tabindex          Tabindex value to use. Default empty.
  *     @type string     $tabfocus_elements The previous and next element ID to move the focus to
  *                                         when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
  *     @type string     $editor_css        Intended for extra styles for both Visual and Text editors.
  *                                         Should include `<style>` tags, and can use "scoped". Default empty.
  *     @type string     $editor_class      Extra classes to add to the editor textarea elemen. Default empty.
  *     @type bool       $teeny             Whether to output the minimal editor config. Examples include
  *                                         Press This and the Comment editor. Default false.
  *     @type bool       $dfw               Whether to replace the default fullscreen with "Distraction Free
  *                                         Writing". DFW requires specific DOM elements and css). Default false.
  *     @type bool|array $tinymce           Whether to load TinyMCE. Can be used to pass settings directly to
  *                                         TinyMCE using an array. Default true.
  *     @type bool|array $quicktags         Whether to load Quicktags. Can be used to pass settings directly to
  *                                         Quicktags using an array. Default true.
  * }
  * @return array Parsed arguments array.
  */
 public static function parse_settings($editor_id, $settings)
 {
     /**
      * Filter the wp_editor() settings.
      *
      * @since 4.0.0
      *
      * @see _WP_Editors()::parse_settings()
      *
      * @param array  $settings  Array of editor arguments.
      * @param string $editor_id ID for the current editor instance.
      */
     $settings = apply_filters('wp_editor_settings', $settings, $editor_id);
     $set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, '_content_editor_dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     if (self::$this_tinymce) {
         if (false !== strpos($editor_id, '[')) {
             self::$this_tinymce = false;
             _deprecated_argument('wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.');
         }
     }
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     if (empty($set['editor_height'])) {
         return $set;
     }
     if ('content' === $editor_id && empty($set['tinymce']['wp_autoresize_on'])) {
         // A cookie (set when a user resizes the editor) overrides the height.
         $cookie = (int) get_user_setting('ed_size');
         // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
         if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) {
             parse_str($_COOKIE['TinyMCE_content_size'], $cookie);
             $cookie = $cookie['ch'];
         }
         if ($cookie) {
             $set['editor_height'] = $cookie;
         }
     }
     if ($set['editor_height'] < 50) {
         $set['editor_height'] = 50;
     } elseif ($set['editor_height'] > 5000) {
         $set['editor_height'] = 5000;
     }
     return $set;
 }
Example #15
0
	public static function parse_settings($editor_id, $settings) {
		$set = wp_parse_args( $settings,  array(
			'wpautop' => true, // use wpautop?
			'media_buttons' => true, // show insert/upload button(s)
			'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
			'textarea_rows' => 20,
			'tabindex' => '',
			'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE
			'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped".
			'editor_class' => '', // add extra class(es) to the editor textarea
			'teeny' => false, // output the minimal editor config used in Press This
			'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
			'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
			'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
		) );

		self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
		self::$this_quicktags = (bool) $set['quicktags'];

		if ( self::$this_tinymce )
			self::$has_tinymce = true;

		if ( self::$this_quicktags )
			self::$has_quicktags = true;

		if ( empty( $set['editor_height'] ) )
			return $set;

		if ( 'content' === $editor_id ) {
			// A cookie (set when a user resizes the editor) overrides the height.
			$cookie = (int) get_user_setting( 'ed_size' );

			// Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
			if ( ! $cookie && isset( $_COOKIE['TinyMCE_content_size'] ) ) {
				parse_str( $_COOKIE['TinyMCE_content_size'], $cookie );
 				$cookie = $cookie['ch'];
			}

			if ( $cookie )
				$set['editor_height'] = $cookie;
		}

		if ( $set['editor_height'] < 50 )
			$set['editor_height'] = 50;
		elseif ( $set['editor_height'] > 5000 )
			$set['editor_height'] = 5000;

		return $set;
	}
Example #16
0
 /**
  * Store constructor
  *
  * @author Jonathan Davis
  * @since 1.1
  * @version 1.2
  *
  * @return void
  **/
 public function __construct()
 {
     parent::__construct();
     Shopping::restore('worklist', $this->worklist);
     if ('off' == shopp_setting('inventory')) {
         array_splice($this->views, 4, 1);
     }
     if (isset($_GET['view']) && in_array($_GET['view'], $this->views)) {
         $this->view = $_GET['view'];
     }
     if (get_current_screen()) {
         get_current_screen()->post_type = ShoppProduct::$posttype;
     }
     if (!empty($_GET['id'])) {
         wp_enqueue_script('jquery-ui-draggable');
         wp_enqueue_script('postbox');
         wp_enqueue_script('wp-lists');
         if (user_can_richedit()) {
             wp_enqueue_script('editor');
             wp_enqueue_script('quicktags');
             add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
         }
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('editors');
         shopp_enqueue_script('scalecrop');
         shopp_enqueue_script('calendar');
         shopp_enqueue_script('product-editor');
         shopp_enqueue_script('priceline');
         shopp_enqueue_script('ocupload');
         shopp_enqueue_script('swfupload');
         shopp_enqueue_script('jquery-tmpl');
         shopp_enqueue_script('suggest');
         shopp_enqueue_script('search-select');
         do_action('shopp_product_editor_scripts');
         add_action('admin_head', array(&$this, 'layout'));
     } else {
         add_action('load-' . $this->screen, array($this, 'loader'));
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     if ('inventory' == $this->view && shopp_setting_enabled('inventory')) {
         do_action('shopp_inventory_manager_scripts');
     }
     add_action('load-' . $this->screen, array($this, 'workflow'));
     do_action('shopp_product_admin_scripts');
     new ContentParser();
     add_action('shopp_product_saved', array($this, 'index'), 99, 1);
 }
 function admin_js()
 {
     if (isset($_GET) and isset($_GET['page']) and ($_GET['page'] == 'formidable-entries' or $_GET['page'] == 'formidable-entry-templates' or $_GET['page'] == 'formidable-import')) {
         if (!function_exists('wp_editor')) {
             add_action('admin_print_footer_scripts', 'wp_tiny_mce', 25);
             add_filter('tiny_mce_before_init', array(&$this, 'remove_fullscreen'));
             if (user_can_richedit()) {
                 wp_enqueue_script('editor');
                 wp_enqueue_script('media-upload');
             }
             wp_enqueue_script('common');
             wp_enqueue_script('post');
         }
         if ($_GET['page'] == 'formidable-entries') {
             wp_enqueue_script('jquery-ui-datepicker');
         }
     }
 }
function kws_rich_text_tags()
{
    global $wpdb, $user, $current_user, $pagenow, $wp_version;
    load_plugin_textdomain('rich-text-tags', false, '/rich-text-tags/languages');
    // I18n
    // ADD EVENTS
    if ($pagenow == 'edit-tags.php' || $pagenow == 'categories.php') {
        if (!user_can_richedit()) {
            return;
        }
        $taxonomies = get_taxonomies();
        foreach ($taxonomies as $tax) {
            add_action($tax . '_edit_form_fields', 'kws_add_form');
            add_action($tax . '_add_form_fields', 'kws_add_form');
        }
        add_action('init', 'kws_rt_taxonomy_load_mce');
        if ($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && empty($_REQUEST['taxonomy'])) {
            add_action('edit_term', 'kws_rt_taxonomy_save');
        }
    }
}
function kws_rich_text_tags()
{
    global $wpdb, $user, $current_user, $pagenow, $wp_version;
    load_plugin_textdomain('rich-text-tags', false, '/rich-text-tags/languages');
    // I18n
    // ADD EVENTS
    if ($pagenow == 'edit-tags.php' || $pagenow == 'categories.php' || $pagenow == 'media.php' || $pagenow == 'profile.php' || $pagenow == 'user-edit.php') {
        if (!user_can_richedit()) {
            return;
        }
        wp_enqueue_script('kws_rte', plugins_url('kws_rt_taxonomy.js', __FILE__), array('jquery'));
        wp_enqueue_style('editor-buttons');
        $taxonomies = get_taxonomies();
        foreach ($taxonomies as $tax) {
            add_action($tax . '_edit_form_fields', 'kws_add_form');
            add_action($tax . '_add_form_fields', 'kws_add_form');
        }
        add_filter('attachment_fields_to_edit', 'kws_add_form_media', 1, 2);
        add_filter('media_post_single_attachment_fields_to_edit', 'kws_add_form_media', 1, 2);
        if ($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && empty($_REQUEST['taxonomy'])) {
            add_action('edit_term', 'kws_rt_taxonomy_save');
        }
        foreach (array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description') as $filter) {
            remove_filter($filter, 'wp_filter_kses');
        }
        add_action('show_user_profile', 'kws_add_form', 1);
        add_action('edit_user_profile', 'kws_add_form', 1);
        add_action('edit_user_profile_update', 'kws_rt_taxonomy_save');
        if (empty($_REQUEST['action'])) {
            add_filter('get_terms', 'kws_shorten_term_description');
        }
    }
    // Enable shortcodes in category, taxonomy, tag descriptions
    if (function_exists('term_description')) {
        add_filter('term_description', 'do_shortcode');
    } else {
        add_filter('category_description', 'do_shortcode');
    }
}
Example #20
0
 /**
  * Categorize constructor
  *
  * @return void
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     Shopping::restore('worklist', $this->worklist);
     if ('shopp-tags' == $_GET['page']) {
         wp_redirect(add_query_arg(array('taxonomy' => ProductTag::$taxon), admin_url('edit-tags.php')));
         return;
     }
     if (!empty($_GET['id']) && !isset($_GET['a'])) {
         wp_enqueue_script('postbox');
         wp_enqueue_script('swfupload-all');
         if (user_can_richedit()) {
             wp_enqueue_script('editor');
             wp_enqueue_script('quicktags');
             add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
         }
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('editors');
         shopp_enqueue_script('category-editor');
         shopp_enqueue_script('priceline');
         shopp_enqueue_script('ocupload');
         shopp_enqueue_script('swfupload');
         shopp_enqueue_script('shopp-swfupload-queue');
         do_action('shopp_category_editor_scripts');
         add_action('admin_head', array($this, 'layout'));
     } elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') {
         shopp_enqueue_script('category-arrange');
         do_action('shopp_category_arrange_scripts');
         add_action('admin_print_scripts', array($this, 'arrange_cols'));
     } elseif (!empty($_GET['a']) && $_GET['a'] == 'products') {
         shopp_enqueue_script('products-arrange');
         do_action('shopp_category_products_arrange_scripts');
         add_action('admin_print_scripts', array($this, 'products_cols'));
     } else {
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     do_action('shopp_category_admin_scripts');
     add_action('load-' . $this->screen, array($this, 'workflow'));
 }
Example #21
0
 function rtfm_article()
 {
     global $post;
     $current_user = wp_get_current_user();
     // the user turned off the wysiwyg warning in its preferences
     $usermeta =& $this->m_cache->get_usermeta($current_user->ID);
     if ($usermeta->hide_wysiwyg_warning()) {
         return false;
     }
     if (!isset($post->author) || $post->post_author == $current_user->ID) {
         // the editor is equal to the writer of the article
         if (!current_user_can(ExecPhp_CAPABILITY_EXECUTE_ARTICLES)) {
             return false;
         }
         if (!current_user_can(ExecPhp_CAPABILITY_WRITE_PHP)) {
             return true;
         }
     } else {
         // the editor is different to the writer of the article
         $poster = new WP_User($post->post_author);
         if (!$poster->has_cap(ExecPhp_CAPABILITY_EXECUTE_ARTICLES)) {
             return false;
         }
         // no check for posters write cap because the editor may want to
         // insert code after the poster created the article
     }
     if (!current_user_can(ExecPhp_CAPABILITY_WRITE_PHP)) {
         return true;
     }
     if (user_can_richedit()) {
         return true;
     }
     if (get_option('use_balanceTags')) {
         return true;
     }
     return false;
 }
Example #22
0
/**
 * Sanitize post field based on context.
 *
 * Possible context values are:  'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The
 * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display'
 * when calling filters.
 *
 * @since 2.3.0
 * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
 *  $post_id if $context == 'edit' and field name prefix == 'post_'.
 *
 * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'.
 * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'.
 * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
 *
 * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything
 *  other than 'raw', 'edit' and 'db' and field name prefix == 'post_'.
 * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw',
 *  'edit' and 'db' and field name prefix != 'post_'.
 *
 * @param string $field The Post Object field name.
 * @param mixed $value The Post Object value.
 * @param int $post_id Post ID.
 * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display',
 *               'attribute' and 'js'.
 * @return mixed Sanitized value.
 */
function sanitize_post_field($field, $value, $post_id, $context)
{
    $int_fields = array('ID', 'post_parent', 'menu_order');
    if (in_array($field, $int_fields)) {
        $value = (int) $value;
    }
    // Fields which contain arrays of ints.
    $array_int_fields = array('ancestors');
    if (in_array($field, $array_int_fields)) {
        $value = array_map('absint', $value);
        return $value;
    }
    if ('raw' == $context) {
        return $value;
    }
    $prefixed = false;
    if (false !== strpos($field, 'post_')) {
        $prefixed = true;
        $field_no_prefix = str_replace('post_', '', $field);
    }
    if ('edit' == $context) {
        $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
        if ($prefixed) {
            $value = apply_filters("edit_{$field}", $value, $post_id);
            // Old school
            $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
        } else {
            $value = apply_filters("edit_post_{$field}", $value, $post_id);
        }
        if (in_array($field, $format_to_edit)) {
            if ('post_content' == $field) {
                $value = format_to_edit($value, user_can_richedit());
            } else {
                $value = format_to_edit($value);
            }
        } else {
            $value = esc_attr($value);
        }
    } else {
        if ('db' == $context) {
            if ($prefixed) {
                $value = apply_filters("pre_{$field}", $value);
                $value = apply_filters("{$field_no_prefix}_save_pre", $value);
            } else {
                $value = apply_filters("pre_post_{$field}", $value);
                $value = apply_filters("{$field}_pre", $value);
            }
        } else {
            // Use display filters by default.
            if ($prefixed) {
                $value = apply_filters($field, $value, $post_id, $context);
            } else {
                $value = apply_filters("post_{$field}", $value, $post_id, $context);
            }
        }
    }
    if ('attribute' == $context) {
        $value = esc_attr($value);
    } else {
        if ('js' == $context) {
            $value = esc_js($value);
        }
    }
    return $value;
}
Example #23
0
_e('Text to display as new posts are retrieved', 'infinite-scroll');
?>
</span>	
    		</div> 
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
_e('Finished Message', 'infinite-scroll');
?>
		
		</th>
		<td>
			<div id="<?php 
echo user_can_richedit() ? 'postdivrich' : 'postdiv';
?>
" class="postarea">
    			<?php 
$this->parent->admin->editor('finishedMsg');
?>
			<span class="description"><?php 
_e('Text to display when no additional posts are available', 'infinite-scroll');
?>
</span>	
    		</div>
		</td>
	</tr>

	<tr valign="top">
		<th scope="row">
Example #24
0
function qtrans_modifyRichEditor($old_content)
{
    global $q_config;
    $init_editor = true;
    if ($GLOBALS['wp_version'] != QT_SUPPORTED_WP_VERSION) {
        if (!(isset($_REQUEST['qtranslateincompatiblemessage']) && $_REQUEST['qtranslateincompatiblemessage'] == "shown")) {
            echo '<p class="updated" id="qtrans_imsg">' . __('The qTranslate Editor has disabled itself because it hasn\'t been tested with your Wordpress version yet. This is done to prevent Wordpress from malfunctioning. You can reenable it by <a href="javascript:qtrans_editorInit();" title="Activate qTranslate" id="qtrans_imsg_link">clicking here</a> (may cause <b>data loss</b>! Use at own risk!). To remove this message permanently, please update qTranslate to the <a href="http://www.qianqin.de/qtranslate/download/">corresponding version</a>.', 'qtranslate') . '</p>';
        }
        $init_editor = false;
    }
    // save callback hook
    preg_match("/<textarea[^>]*id='([^']+)'/", $old_content, $matches);
    $id = $matches[1];
    preg_match("/cols='([^']+)'/", $old_content, $matches);
    $cols = $matches[1];
    preg_match("/rows='([^']+)'/", $old_content, $matches);
    $rows = $matches[1];
    // don't do anything if not editing the content
    if ($id != "content") {
        return $old_content;
    }
    // don't do anything to the editor if it's not rich
    if (!user_can_richedit()) {
        //echo '<p class="updated">'.__('The qTranslate Editor could not be loaded because WYSIWYG/TinyMCE is not activated in your profile.').'</p>';
        return $old_content;
    }
    $content = "";
    $content_append = "";
    // create editing field for selected languages
    $old_content = substr($old_content, 0, 26) . "<textarea id='qtrans_textarea_" . $id . "' name='qtrans_textarea_" . $id . "' tabindex='2' rows='" . $rows . "' cols='" . $cols . "' style='display:none' onblur='qtrans_save(this.value);'></textarea>" . substr($old_content, 26);
    // do some crazy js to alter the admin view
    $content .= "<script type=\"text/javascript\">\n// <![CDATA[\n";
    $content .= "function qtrans_editorInit1() {\n";
    // include needed js functions
    $content .= $q_config['js']['qtrans_is_array'];
    $content .= $q_config['js']['qtrans_xsplit'];
    $content .= $q_config['js']['qtrans_split'];
    $content .= $q_config['js']['qtrans_integrate'];
    $content .= $q_config['js']['qtrans_use'];
    $content .= $q_config['js']['qtrans_switch'];
    $content .= $q_config['js']['qtrans_assign'];
    $content .= $q_config['js']['qtrans_save'];
    $content .= $q_config['js']['qtrans_integrate_title'];
    $content .= $q_config['js']['qtrans_get_active_language'];
    // insert language, visual and html buttons
    $el = qtrans_getSortedLanguages();
    foreach ($el as $language) {
        $content .= qtrans_insertTitleInput($language);
    }
    $el = qtrans_getSortedLanguages(true);
    foreach ($el as $language) {
        $content .= qtrans_createEditorToolbarButton($language, $id);
    }
    $content = apply_filters('qtranslate_toolbar', $content);
    // hide old title bar
    $content .= "document.getElementById('titlediv').style.display='none';\n";
    $content .= "}\n";
    $content .= "// ]]>\n</script>\n";
    $content_append .= "<script type=\"text/javascript\">\n// <![CDATA[\n";
    // disable old editor here if editor is to be initialized
    if ($init_editor) {
        $content_append .= $q_config['js']['qtrans_disable_old_editor'];
    }
    $content_append .= "function qtrans_editorInit2() {\n";
    // disable old editor here if editor is not to be initialized
    if (!$init_editor) {
        $content_append .= $q_config['js']['qtrans_disable_old_editor'];
    }
    // hijack tinymce control
    $content_append .= $q_config['js']['qtrans_disable_old_editor'];
    // show default language tab
    $content_append .= "document.getElementById('qtrans_select_" . $q_config['default_language'] . "').className='edButton active';\n";
    // show default language
    $content_append .= "var ta = document.getElementById('" . $id . "');\n";
    $content_append .= "qtrans_assign('qtrans_textarea_" . $id . "',qtrans_use('" . $q_config['default_language'] . "',ta.value));\n";
    $content_append .= "}\n";
    $content_append .= "function qtrans_editorInit3() {\n";
    // make tinyMCE get the correct data
    $content_append .= $q_config['js']['qtrans_tinyMCEOverload'];
    $content_append .= "}\n";
    $content_append .= "function qtrans_editorInit() {\n";
    $content_append .= "qtrans_editorInit1();\n";
    $content_append .= "qtrans_editorInit2();\n";
    $content_append .= "jQuery('#qtrans_imsg').hide();\n";
    $content_append .= "qtrans_editorInit3();\n";
    $content_append .= "}\n";
    if ($init_editor) {
        $content_append .= $q_config['js']['qtrans_wpOnload'];
    } else {
        $content_append .= "var qtmsg = document.getElementById('qtrans_imsg');\n";
        $content_append .= "var et = document.getElementById('editor-toolbar');\n";
        $content_append .= "et.parentNode.insertBefore(qtmsg, et);\n";
    }
    $content_append = apply_filters('qtranslate_modify_editor_js', $content_append);
    $content_append .= "// ]]>\n</script>\n";
    return $content . $old_content . $content_append;
}
</select>
</div>
</fieldset>
<?php endif; ?>

<?php do_action('dbx_post_sidebar'); ?>

</div>
</div>

<fieldset id="titlediv">
	<legend><?php _e('Title') ?></legend>
	<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
</fieldset>

<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Post') ?>

<?php if ( 'publish' == $post->post_status ) { ?>
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View &raquo;'); ?></a>
<?php } elseif ( 'edit' == $action ) { ?>
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview &raquo;'); ?></a>
<?php } ?>
</legend>

	<?php the_editor($post->post_content); ?>
</fieldset>

<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
Example #26
0
function get_compat_media_markup($attachment_id, $args = null)
{
    $post = get_post($attachment_id);
    $default_args = array('errors' => null, 'in_modal' => false);
    $user_can_edit = current_user_can('edit_post', $attachment_id);
    $args = wp_parse_args($args, $default_args);
    /** This filter is documented in wp-admin/includes/media.php */
    $args = apply_filters('get_media_item_args', $args);
    $form_fields = array();
    if ($args['in_modal']) {
        foreach (get_attachment_taxonomies($post) as $taxonomy) {
            $t = (array) get_taxonomy($taxonomy);
            if (!$t['public'] || !$t['show_ui']) {
                continue;
            }
            if (empty($t['label'])) {
                $t['label'] = $taxonomy;
            }
            if (empty($t['args'])) {
                $t['args'] = array();
            }
            $terms = get_object_term_cache($post->ID, $taxonomy);
            if (false === $terms) {
                $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
            }
            $values = array();
            foreach ($terms as $term) {
                $values[] = $term->slug;
            }
            $t['value'] = join(', ', $values);
            $t['taxonomy'] = true;
            $form_fields[$taxonomy] = $t;
        }
    }
    // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
    // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    $form_fields = array_merge_recursive($form_fields, (array) $args['errors']);
    /** This filter is documented in wp-admin/includes/media.php */
    $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
    unset($form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url']);
    /** This filter is documented in wp-admin/includes/media.php */
    $media_meta = apply_filters('media_meta', '', $post);
    $defaults = array('input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), 'show_in_edit' => true, 'show_in_modal' => true);
    $hidden_fields = array();
    $item = '';
    foreach ($form_fields as $id => $field) {
        if ($id[0] == '_') {
            continue;
        }
        $name = "attachments[{$attachment_id}][{$id}]";
        $id_attr = "attachments-{$attachment_id}-{$id}";
        if (!empty($field['tr'])) {
            $item .= $field['tr'];
            continue;
        }
        $field = array_merge($defaults, $field);
        if (!$field['show_in_edit'] && !$args['in_modal'] || !$field['show_in_modal'] && $args['in_modal']) {
            continue;
        }
        if ($field['input'] == 'hidden') {
            $hidden_fields[$name] = $field['value'];
            continue;
        }
        $readonly = !$user_can_edit && !empty($field['taxonomy']) ? " readonly='readonly' " : '';
        $required = $field['required'] ? '<span class="alignright"><abbr title="required" class="required">*</abbr></span>' : '';
        $aria_required = $field['required'] ? " aria-required='true' " : '';
        $class = 'compat-field-' . $id;
        $class .= $field['required'] ? ' form-required' : '';
        $item .= "\t\t<tr class='{$class}'>";
        $item .= "\t\t\t<th scope='row' class='label'><label for='{$id_attr}'><span class='alignleft'>{$field['label']}</span>{$required}<br class='clear' /></label>";
        $item .= "</th>\n\t\t\t<td class='field'>";
        if (!empty($field[$field['input']])) {
            $item .= $field[$field['input']];
        } elseif ($field['input'] == 'textarea') {
            if ('post_content' == $id && user_can_richedit()) {
                // sanitize_post() skips the post_content when user_can_richedit.
                $field['value'] = htmlspecialchars($field['value'], ENT_QUOTES);
            }
            $item .= "<textarea id='{$id_attr}' name='{$name}' {$aria_required}>" . $field['value'] . '</textarea>';
        } else {
            $item .= "<input type='text' class='text' id='{$id_attr}' name='{$name}' value='" . esc_attr($field['value']) . "' {$readonly} {$aria_required} />";
        }
        if (!empty($field['helps'])) {
            $item .= "<p class='help'>" . join("</p>\n<p class='help'>", array_unique((array) $field['helps'])) . '</p>';
        }
        $item .= "</td>\n\t\t</tr>\n";
        $extra_rows = array();
        if (!empty($field['errors'])) {
            foreach (array_unique((array) $field['errors']) as $error) {
                $extra_rows['error'][] = $error;
            }
        }
        if (!empty($field['extra_rows'])) {
            foreach ($field['extra_rows'] as $class => $rows) {
                foreach ((array) $rows as $html) {
                    $extra_rows[$class][] = $html;
                }
            }
        }
        foreach ($extra_rows as $class => $rows) {
            foreach ($rows as $html) {
                $item .= "\t\t<tr><td></td><td class='{$class}'>{$html}</td></tr>\n";
            }
        }
    }
    if (!empty($form_fields['_final'])) {
        $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
    }
    if ($item) {
        $item = '<table class="compat-attachment-fields">' . $item . '</table>';
    }
    foreach ($hidden_fields as $hidden_field => $value) {
        $item .= '<input type="hidden" name="' . esc_attr($hidden_field) . '" value="' . esc_attr($value) . '" />' . "\n";
    }
    if ($item) {
        $item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr($post->menu_order) . '" />' . $item;
    }
    return array('item' => $item, 'meta' => $media_meta);
}
Example #27
0
/**
 * Sanitize post field based on context.
 *
 * Possible context values are:  'raw', 'edit', 'db', 'display', 'attribute' and
 * 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts
 * are treated like 'display' when calling filters.
 *
 * @since 2.3.0
 * @since 4.4.0 Like `sanitize_post()`, `$context` defaults to 'display'.
 *
 * @param string $field   The Post Object field name.
 * @param mixed  $value   The Post Object value.
 * @param int    $post_id Post ID.
 * @param string $context Optional. How to sanitize post fields. Looks for 'raw', 'edit',
 *                        'db', 'display', 'attribute' and 'js'. Default 'display'.
 * @return mixed Sanitized value.
 */
function sanitize_post_field($field, $value, $post_id, $context = 'display')
{
    $int_fields = array('ID', 'post_parent', 'menu_order');
    if (in_array($field, $int_fields)) {
        $value = (int) $value;
    }
    // Fields which contain arrays of integers.
    $array_int_fields = array('ancestors');
    if (in_array($field, $array_int_fields)) {
        $value = array_map('absint', $value);
        return $value;
    }
    if ('raw' == $context) {
        return $value;
    }
    $prefixed = false;
    if (false !== strpos($field, 'post_')) {
        $prefixed = true;
        $field_no_prefix = str_replace('post_', '', $field);
    }
    if ('edit' == $context) {
        $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
        if ($prefixed) {
            /**
             * Filter the value of a specific post field to edit.
             *
             * The dynamic portion of the hook name, `$field`, refers to the post
             * field name.
             *
             * @since 2.3.0
             *
             * @param mixed $value   Value of the post field.
             * @param int   $post_id Post ID.
             */
            $value = apply_filters("edit_{$field}", $value, $post_id);
            /**
             * Filter the value of a specific post field to edit.
             *
             * The dynamic portion of the hook name, `$field_no_prefix`, refers to
             * the post field name.
             *
             * @since 2.3.0
             *
             * @param mixed $value   Value of the post field.
             * @param int   $post_id Post ID.
             */
            $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
        } else {
            $value = apply_filters("edit_post_{$field}", $value, $post_id);
        }
        if (in_array($field, $format_to_edit)) {
            if ('post_content' == $field) {
                $value = format_to_edit($value, user_can_richedit());
            } else {
                $value = format_to_edit($value);
            }
        } else {
            $value = esc_attr($value);
        }
    } elseif ('db' == $context) {
        if ($prefixed) {
            /**
             * Filter the value of a specific post field before saving.
             *
             * The dynamic portion of the hook name, `$field`, refers to the post
             * field name.
             *
             * @since 2.3.0
             *
             * @param mixed $value Value of the post field.
             */
            $value = apply_filters("pre_{$field}", $value);
            /**
             * Filter the value of a specific field before saving.
             *
             * The dynamic portion of the hook name, `$field_no_prefix`, refers
             * to the post field name.
             *
             * @since 2.3.0
             *
             * @param mixed $value Value of the post field.
             */
            $value = apply_filters("{$field_no_prefix}_save_pre", $value);
        } else {
            $value = apply_filters("pre_post_{$field}", $value);
            /**
             * Filter the value of a specific post field before saving.
             *
             * The dynamic portion of the hook name, `$field`, refers to the post
             * field name.
             *
             * @since 2.3.0
             *
             * @param mixed $value Value of the post field.
             */
            $value = apply_filters("{$field}_pre", $value);
        }
    } else {
        // Use display filters by default.
        if ($prefixed) {
            /**
             * Filter the value of a specific post field for display.
             *
             * The dynamic portion of the hook name, `$field`, refers to the post
             * field name.
             *
             * @since 2.3.0
             *
             * @param mixed  $value   Value of the prefixed post field.
             * @param int    $post_id Post ID.
             * @param string $context Context for how to sanitize the field. Possible
             *                        values include 'raw', 'edit', 'db', 'display',
             *                        'attribute' and 'js'.
             */
            $value = apply_filters($field, $value, $post_id, $context);
        } else {
            $value = apply_filters("post_{$field}", $value, $post_id, $context);
        }
    }
    if ('attribute' == $context) {
        $value = esc_attr($value);
    } elseif ('js' == $context) {
        $value = esc_js($value);
    }
    return $value;
}
Example #28
0
 /**
  * Return an instance of this class.
  *
  * @since	 1.0.0
  *
  * @return	object	A single instance of this class.
  */
 public static function get_instance()
 {
     if (@user_can_richedit()) {
         // If the single instance hasn't been set, set it now.
         if (null == self::$instance) {
             self::$instance = new self();
         }
     } else {
         add_action('edit_form_after_title', 'add_notice_of_disabled_rich_editor');
     }
     return self::$instance;
 }
Example #29
0
    public function form_options($id)
    {
        $row = $this->model->get_row_data($id);
        $themes = $this->model->get_theme_rows_data();
        $queries = $this->model->get_queries_rows_data($id);
        $userGroups = get_editable_roles();
        $page_title = $row->title . ' form options';
        $label_id = array();
        $label_label = array();
        $label_type = array();
        $label_all = explode('#****#', $row->label_order_current);
        $label_all = array_slice($label_all, 0, count($label_all) - 1);
        foreach ($label_all as $key => $label_each) {
            $label_id_each = explode('#**id**#', $label_each);
            array_push($label_id, $label_id_each[0]);
            $label_order_each = explode('#**label**#', $label_id_each[1]);
            array_push($label_label, $label_order_each[0]);
            array_push($label_type, $label_order_each[1]);
        }
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        ?>
    <script>
      gen = "<?php 
        echo $row->counter;
        ?>
";
      form_view_max = 20;
      function set_preview() {
        jQuery("#preview_form").attr("href", '<?php 
        echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&test_theme=' + jQuery("#theme").val() + '&width=1000&height=500&TB_iframe=1');
        jQuery("#edit_css").attr("href", '<?php 
        echo add_query_arg(array('action' => 'FormMakerEditCSS', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&id=' + jQuery("#theme").val() + '&width=800&height=500&TB_iframe=1');
      }
		function set_condition() {
			field_condition = '';
			for(i=0;i<500;i++) {
				conditions = '';
				if(document.getElementById("condition"+i)) {
					field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*";
					field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*";
					field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*";
					for(k=0;k<500;k++) {
						if(document.getElementById("condition_div"+i+"_"+k)) {
							conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***";
							conditions+=document.getElementById("is_select"+i+"_"+k).value+"***";
							if(document.getElementById("field_value"+i+"_"+k).tagName=="SELECT" ) {
								if(document.getElementById("field_value"+i+"_"+k).getAttribute('multiple')) {
									var sel = document.getElementById("field_value"+i+"_"+k);
									var selValues = '';
									for(m=0; m < sel.length; m++) {
										if(sel.options[m].selected)
										
										selValues += sel.options[m].value+"@@@";
									}
									conditions+=selValues;
								} else {
									conditions+=document.getElementById("field_value"+i+"_"+k).value;
								}								
							}
							else
								conditions+=document.getElementById("field_value"+i+"_"+k).value;
							conditions+="*:*next_condition*:*";
						}
					}
					field_condition+=conditions;
					field_condition+="*:*new_condition*:*";
				}
			}
			document.getElementById('condition').value = field_condition;
		}      
    
		function show_verify_options(s){
			if(s){
				jQuery(".verification_div").removeAttr( "style" );
				jQuery(".expire_link").removeAttr( "style" );
					
			} else{
				jQuery(".verification_div").css( 'display', 'none' );
				jQuery(".expire_link").css( 'display', 'none' );
			}
		}      
    </script>
    <style>
    .CodeMirror {
      border: 1px solid #ccc;
      font-size: 12px;
      margin-bottom: 6px;
      background: white;
    }
    </style>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form options.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-3.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" method="post" action="admin.php?page=manage_fm" style="float: left; width: 99%;" name="adminForm" id="adminForm">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <h2><?php 
        echo $page_title;
        ?>
</h2>
      <div style="float: right; margin: 0 5px 0 0;">
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'save_options')" value="Save"/>
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'apply_options')" value="Apply"/>
        <input class="button-secondary" type="submit" onclick="fm_set_input_value('task', 'cancel_options')" value="Cancel"/>
      </div>
      <div class="submenu-box" style="width: 99%; float: left; margin: 15px 0 0 0;">
        <div class="submenu-pad">
          <ul id="submenu" class="configuration">
            <li>
              <a id="general" class="fm_fieldset_tab" onclick="form_maker_options_tabs('general')" href="#">General Options</a>
            </li>
            <li>
              <a id="custom" class="fm_fieldset_tab" onclick="form_maker_options_tabs('custom')" href="#">Email Options</a>
            </li>
            <li>
              <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#">Actions after Submission</a>
            </li>
            <li>
              <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
            </li>
            <li>
              <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
            </li>
            <li>
              <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
            </li>
            <li>
              <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >MySQL Mapping</a>
            </li>
          </ul>
        </div>
      </div>
      <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">General Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Published</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="published" id="published_yes" value="1" <?php 
        echo $row->published ? "checked" : "";
        ?>
 /><label for="published_yes">Yes</label>
              <input type="radio" name="published" id="published_no" value="0" <?php 
        echo !$row->published ? "checked" : "";
        ?>
 /><label for="published_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Save data(to database)</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="savedb" id="savedb_yes" value="1" <?php 
        echo $row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_yes">Yes</label>
              <input type="radio" name="savedb" id="savedb_no" value="0" <?php 
        echo !$row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="theme">Theme</label>
            </td>
            <td class="fm_options_value">
              <select id="theme" name="theme" style="width:260px;" onChange="set_preview()">
                <?php 
        foreach ($themes as $theme) {
            ?>
                  <option value="<?php 
            echo $theme->id;
            ?>
" <?php 
            echo $theme->id == $row->theme ? 'selected' : '';
            ?>
><?php 
            echo $theme->title;
            ?>
</option>
                  <?php 
        }
        ?>
              </select>
              
              <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerEditCSS', 'id' => $row->theme, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="edit_css" title="Edit CSS" onclick="return false;">
                Edit CSS
              </a>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="requiredmark">Required fields mark</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="requiredmark" name="requiredmark" value="<?php 
        echo $row->requiredmark;
        ?>
" style="width:250px;" />
            </td>
          </tr>
        </table>
        <div class="error_fm" style="padding: 5px; font-size: 14px;">Front end submissions are disabled in free version.</div>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Front end submissions access level</legend>
          <table>
            <tr>
              <td class="key">
                <label for="name">
                  Allow User to see submissions:
                </label>
              </td>
              <td>
                <?php 
        $checked_UserGroup = explode(',', $row->user_id_wd);
        $i = 0;
        foreach ($userGroups as $val => $uG) {
            echo '<input disabled="disabled" type="checkbox" value="' . $val . '"  id="user_' . $i . '"';
            if (in_array($val, $checked_UserGroup)) {
                echo 'checked="checked"';
            }
            echo 'onchange="acces_level(' . count($userGroups) . ')"/><label for="user_' . $i . '">' . $uG["name"] . '</label><br>';
            $i++;
        }
        ?>
                <input disabled="disabled" type="checkbox" value="guest"  id="user_<?php 
        echo $i;
        ?>
" onchange="acces_level(<?php 
        echo count($userGroups);
        ?>
)"<?php 
        echo in_array('guest', $checked_UserGroup) ? 'checked="checked"' : '';
        ?>
/><label for="user_<?php 
        echo $i;
        ?>
">Guest</label>
                <input disabled="disabled" type="hidden" name="user_id_wd" value="<?php 
        echo $row->user_id_wd;
        ?>
" id="user_id_wd" />
              </td>
            </tr>              
          </table>
        </fieldset>
        <?php 
        $labels_for_submissions = $this->model->get_labels($id);
        $payment_info = $this->model->is_paypal($id);
        $labels_id_for_submissions = array();
        $label_titles_for_submissions = array();
        $labels_type_for_submissions = array();
        if ($labels_for_submissions) {
            $label_id_for_submissions = array();
            $label_order_original_for_submissions = array();
            $label_type_for_submissions = array();
            if (strpos($row->label_order, 'type_paypal_')) {
                $row->label_order = $row->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
            }
            $label_all_for_submissions = explode('#****#', $row->label_order);
            $label_all_for_submissions = array_slice($label_all_for_submissions, 0, count($label_all_for_submissions) - 1);
            foreach ($label_all_for_submissions as $key => $label_each) {
                $label_id_each = explode('#**id**#', $label_each);
                array_push($label_id_for_submissions, $label_id_each[0]);
                $label_order_each = explode('#**label**#', $label_id_each[1]);
                array_push($label_order_original_for_submissions, $label_order_each[0]);
                array_push($label_type_for_submissions, $label_order_each[1]);
            }
            foreach ($label_id_for_submissions as $key => $label) {
                if (in_array($label, $labels_for_submissions)) {
                    array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
                    array_push($labels_id_for_submissions, $label);
                    array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
                }
            }
        }
        $stats_labels = array();
        $stats_labels_ids = array();
        foreach ($labels_type_for_submissions as $key => $label_type_cur) {
            if ($label_type_cur == "type_checkbox" || $label_type_cur == "type_radio" || $label_type_cur == "type_own_select" || $label_type_cur == "type_country" || $label_type_cur == "type_paypal_select" || $label_type_cur == "type_paypal_radio" || $label_type_cur == "type_paypal_checkbox" || $label_type_cur == "type_paypal_shipping") {
                $stats_labels_ids[] = $labels_id_for_submissions[$key];
                $stats_labels[] = $label_titles_for_submissions[$key];
            }
        }
        ?>
        <script type="text/javascript">
          function inArray(needle, myarray) {
            var length = myarray.length;
            for(var i = 0; i < length; i++) {
                if(myarray[i] == needle) return true;
            }
            return false;
          }

          function checked_labels(class_name) {
            var checked_ids ='';            
            jQuery('.'+class_name).each(function() {
              if(this.checked) {
                checked_ids += this.value+',';		
              }
            });              
            if(class_name == 'filed_label') {
              document.getElementById("frontend_submit_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              else
                document.getElementById("all_fields").checked = false;
            }
            else {
              document.getElementById("frontend_submit_stat_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;
              else
                document.getElementById("all_stats_fields").checked = false;
            }
          }
          
          jQuery(document).ready(function () {
            jQuery('.filed_label').each(function() {
              if(document.getElementById("frontend_submit_fields").value == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              if(inArray(this.value, document.getElementById("frontend_submit_fields").value.split(","))) {
                this.checked = true;
              }
            });

            jQuery('.stats_filed_label').each(function() {
              if(document.getElementById("frontend_submit_stat_fields").value == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;          
              if(inArray(this.value, document.getElementById("frontend_submit_stat_fields").value.split(","))) {
                this.checked = true;		
              }              
            });
              
            jQuery(document).on('change','input[name="all_fields"]',function() {
                jQuery('.filed_label').prop("checked" , this.checked);
            });

            jQuery(document).on('change','input[name="all_stats_fields"]',function() {
                jQuery('.stats_filed_label').prop("checked" , this.checked);
            });
          });
        </script>

        <style>
          li{
          list-style-type: none;
          }

          .simple_table
          {
          padding-left: 0px !important;
          }

          .simple_table input, .simple_table label, .simple_table img
          {
          display:inline-block !important;
          float:none !important;
          }
        </style>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Fields to hide in frontend submissions</legend>
          <?php 
        if (count($label_titles_for_submissions)) {
            ?>
            <table style="margin-left:-3px;">
              <tr>
                <td> 
                  <label>Select fields:</label>
                </td>
                <td  class="simple_table">
                  <ul id="form_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_fields" id="all_fields" value="submit_id,<?php 
            echo implode(',', $labels_id_for_submissions) . "," . ($payment_info ? "payment_info" : "");
            ?>
" onclick="checked_labels('filed_label')"/>
                    <label for="all_fields">Select All</label>
                    </li>
                    <?php 
            echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"submit_id\" name=\"submit_id\" value=\"submit_id\" class=\"filed_label\"  onclick=\"checked_labels('filed_label')\"><label for=\"submit_id\">ID</label></li>";
            for ($i = 0, $n = count($label_titles_for_submissions); $i < $n; $i++) {
                $field_label = $label_titles_for_submissions[$i];
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"filed_label" . $i . "\" name=\"filed_label" . $i . "\" value=\"" . $labels_id_for_submissions[$i] . "\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
            }
            if ($payment_info) {
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"payment_info\" name=\"payment_info\" value=\"payment_info\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"payment_info\">Payment Info</label></li>";
            }
            ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_fields" value="<?php 
            echo $row->frontend_submit_fields;
            ?>
" id="frontend_submit_fields" />
                </td>	
              </tr>
              <?php 
            if ($stats_labels) {
                ?>
              <tr id="stats">
                <td> 
                  <label>Stats fields:</label>
                </td>
                <td class="simple_table">
                  <ul id="stats_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_stats_fields" id="all_stats_fields" value="<?php 
                echo implode(',', $stats_labels_ids) . ",";
                ?>
" onclick="checked_labels('stats_filed_label')">
                    <label for="all_stats_fields">Select All</label>
                    </li>
                    <?php 
                for ($i = 0, $n = count($stats_labels); $i < $n; $i++) {
                    $field_label = $stats_labels[$i];
                    echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"stats_filed_label" . $i . "\" name=\"stats_filed_label" . $i . "\" value=\"" . $stats_labels_ids[$i] . "\" class=\"stats_filed_label\" onclick=\"checked_labels('stats_filed_label')\" ><label for=\"stats_filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
                }
                ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_stat_fields" value="<?php 
                echo $row->frontend_submit_stat_fields;
                ?>
" id="frontend_submit_stat_fields" />
                </td>	
              </tr>
              <?php 
            }
            ?>
            </table>
          <?php 
        }
        ?>
        </fieldset>
      </fieldset>
      <fieldset id="custom_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;">Email Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td style="padding: 15px; width:75px;">
              <label>Send E-mail</label>
            </td>
            <td style="padding: 15px;">
              <input type="radio" name="sendemail" id="sendemail_yes" value="1" <?php 
        echo $row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_yes">Yes</label>
              <input type="radio" name="sendemail" id="sendemail_no" value="0" <?php 
        echo !$row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_no">No</label>
            </td>
          </tr>
        </table>
        <fieldset class="fm_mail_options">
          <legend style="color:#0B55C4;font-weight: bold;">Email to Administrator</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mailToAdd">Email to send submissions to</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mailToAdd" name="mailToAdd" style="width: 250px;" />
                <input type="hidden" id="mail" name="mail" value="<?php 
        echo $row->mail . ($row->mail && substr($row->mail, -1) != ',' ? ',' : '');
        ?>
" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
"
                     style="vertical-align: middle; cursor: pointer;"
                     title="Add more emails"
                     onclick="if (fm_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php 
        echo WD_FM_URL;
        ?>
')" />
                <div id="cfm_mail_div">
                  <?php 
        $mail_array = explode(',', $row->mail);
        foreach ($mail_array as $mail) {
            if ($mail && $mail != ',') {
                ?>
                      <div class="fm_mail_input">
                        <?php 
                echo $mail;
                ?>
                        <img src="<?php 
                echo WD_FM_URL;
                ?>
/images/delete.png" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php 
                echo $mail;
                ?>
')" title="Delete Email" />
                      </div>
                      <?php 
            }
        }
        ?>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_mail">Email From</label>
              </td>
              <td class="fm_options_value">
                <!--<input id="from_mail" name="from_mail" value="<?php 
        echo $row->from_mail;
        ?>
" style="width:250px;" />-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="from_mail" id="from_mail<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $row->from_mail ? 'checked="checked"' : '';
            ?>
 onclick="wdhide('mail_from_other')" />
                    <label for="from_mail<?php 
            echo $i;
            ?>
"><?php 
            echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
            ?>
</label>
                  </div>
                  <?php 
            if (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->from_mail) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->from_mail) {
                    $is_other = false;
                }
            }
        }
        ?>
                <div style="<?php 
        echo $fields_count == 1 ? 'display:none;' : '';
        ?>
">
                  <input type="radio" id="other" name="from_mail" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('mail_from_other')" />
                  <label for="other">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="mail_from_other" name="mail_from_other" value="<?php 
        echo $is_other ? $row->from_mail : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_name">From Name</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="from_name" name="from_name" value="<?php 
        echo $row->from_name;
        ?>
" style="width: 250px;" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; cursor: pointer;display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('from_name')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_labels" class="email_labels" style="display:none;">';
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to">Reply to<br/>(if different from "Email From") </label>
              </td>
              <td class="fm_options_value">
                <!--<input id="reply_to" name="reply_to" value="<?php 
        echo $row->reply_to;
        ?>
" style="width:250px;"/>-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="reply_to" id="reply_to<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $row->reply_to ? 'checked="checked"' : '';
            ?>
 onclick="wdhide('reply_to_other')" />
                    <label for="reply_to<?php 
            echo $i;
            ?>
"><?php 
            echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
            ?>
</label>
                  </div>
                  <?php 
            if (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->reply_to) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->reply_to) {
                    $is_other = false;
                }
            }
        }
        ?>
								<div style="<?php 
        echo $fields_count == 1 ? 'display: none;' : '';
        ?>
">
                  <input type="radio" id="other1" name="reply_to" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('reply_to_other')" />
                  <label for="other1">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="reply_to_other" name="reply_to_other" value="<?php 
        echo $is_other && $row->reply_to ? $row->reply_to : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label> CC: </label>
							</td>
							<td class="fm_options_value">
								<input  type="text" id="mail_cc" name="mail_cc" value="<?php 
        echo $row->mail_cc;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc" name="mail_bcc" value="<?php 
        echo $row->mail_bcc;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> Subject: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject" name="mail_subject" value="<?php 
        echo $row->mail_subject;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode" id="htmlmode" value="1" <?php 
        if ($row->mail_mode == 1) {
            echo "checked";
        }
        ?>
 /> <label for="htmlmode">HTML</label>
                <input type="radio" name="mail_mode" id="textmode" value="0" <?php 
        if ($row->mail_mode == 0) {
            echo "checked";
        }
        ?>
 /> <label for="textmode">Text</label>
              </td>
              </tr>
              <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment"  value="1" id="en_attach" <?php 
        if ($row->mail_attachment == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment" id="dis_attach" value="0" <?php 
        if ($row->mail_attachment == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Email empty fields: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_emptyfields"  value="1" id="en_mail_emptyfields" <?php 
        if ($row->mail_emptyfields == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_mail_emptyfields">Yes</label>
                <input type="radio" name="mail_emptyfields" id="dis_mail_emptyfields" value="0" <?php 
        if ($row->mail_emptyfields == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_mail_emptyfields">No</label>
              </td>
            </tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For Administrator</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail, 'script_mail', array('teeny' => FALSE, 'textarea_name' => 'script_mail', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail" id="script_mail" cols="20" rows="10" style="width:300px; height:450px;"><?php 
            echo $row->script_mail;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
        <fieldset class="fm_mail_options">
          <legend style="color: #0B55C4; font-weight: bold;">Email to User</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail">Send to</label>
              </td>
              <td class="fm_options_value">
                <?php 
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        if ($fields_count == 1) {
            ?>
                  There is no email field
                  <?php 
        } else {
            for ($i = 0; $i < $fields_count - 1; $i++) {
                ?>
                    <div>
                     <input type="checkbox" name="send_to<?php 
                echo $i;
                ?>
" id="send_to<?php 
                echo $i;
                ?>
" value="<?php 
                echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
                ?>
"  <?php 
                echo is_numeric(strpos($row->send_to, '*' . (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) . '*')) ? 'checked="checked"' : '';
                ?>
 style="margin: 0px 5px 0px 0px;" />
                      <label for="send_to<?php 
                echo $i;
                ?>
"><?php 
                echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
                ?>
</label>
                    </div>
                    <?php 
            }
        }
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_user">Email From</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_user" name="mail_from_user" value="<?php 
        echo $row->mail_from_user;
        ?>
" style="width: 250px;" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_name_user">From Name</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_name_user" name="mail_from_name_user" value="<?php 
        echo $row->mail_from_name_user;
        ?>
" style="width: 250px;"/>
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
                <?php 
        $choise = "document.getElementById('mail_from_name_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_name_user_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to_user">Reply to<br />(if different from "Email Form")</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="reply_to_user" name="reply_to_user" value="<?php 
        echo $row->reply_to_user;
        ?>
" style="width:250px;"/>
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label> CC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_cc_user" name="mail_cc_user" value="<?php 
        echo $row->mail_cc_user;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc_user" name="mail_bcc_user" value="<?php 
        echo $row->mail_bcc_user;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> Subject: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject_user" name="mail_subject_user" value="<?php 
        echo $row->mail_subject_user;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_user_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); \t\t\tdocument.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode_user" id="htmlmode_user" value="1" <?php 
        if ($row->mail_mode_user == 1) {
            echo "checked";
        }
        ?>
 /> <label for="htmlmode_user">HTML</label>
                <input type="radio" name="mail_mode_user" id="textmode_user" value="0" <?php 
        if ($row->mail_mode_user == 0) {
            echo "checked";
        }
        ?>
 /> <label for="textmode_user">Text</label>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment_user"  value="1" id="en_attach_user" <?php 
        if ($row->mail_attachment_user == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach_user">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment_user" id="dis_attach_user" value="0" <?php 
        if ($row->mail_attachment_user == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach_user">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
				<td class="fm_options_label" style="vertical-align: middle;">
					<label> Email verification: </label>
				</td>
				<td class="fm_options_value">
					<input type="radio" name="mail_verify"  value="1" id="en_mail_verify" <?php 
        if ($row->mail_verify == 1) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(true)" /> <label for="en_mail_verify">Yes</label>
					<input type="radio" name="mail_verify" id="dis_mail_verify" value="0" <?php 
        if ($row->mail_verify == 0) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(false)"/> <label for="dis_mail_verify">No</label>
				</td>
            </tr>
			<tr valign="top" class="expire_link" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
>
				<td class="fm_options_label" valign="top">
					<label> Verification link expires in: </label>
				</td>
				<td class="fm_options_value">
					<input class="inputbox" type="text" name="mail_verify_expiretime" maxlength="10"  value = "<?php 
        echo $row->mail_verify_expiretime ? $row->mail_verify_expiretime : 0;
        ?>
" style="width:95px;" onkeypress="return check_isnum_point(event)"/><small> -- hours (0 - never expires).</small>
				</td>
			</tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For User</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail_user')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo htmlspecialchars(addslashes($label_label[$i]));
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
				  <div class="verification_div" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
><input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="Verification link" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'Verification link')" /> </div>
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail_user, 'script_mail_user', array('teeny' => FALSE, 'textarea_name' => 'script_mail_user', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail_user" id="script_mail_user" cols="20" rows="10" style="width:300px; height:450px;"><?php 
            echo $row->script_mail_user;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
      </fieldset>
      <fieldset id="actions_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">Actions after submission</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Action type</label>
            </td>
            <td class="fm_options_value">
              <div><input type="radio" name="submit_text_type" id="text_type_none" onclick="set_type('none')" value="1" <?php 
        echo $row->submit_text_type != 2 && $row->submit_text_type != 3 && $row->submit_text_type != 4 && $row->submit_text_type != 5 ? "checked" : "";
        ?>
 /><label for="text_type_none">Stay on Form</label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_post" onclick="set_type('post')" value="2" <?php 
        echo $row->submit_text_type == 2 ? "checked" : "";
        ?>
 /><label for="text_type_post">Post</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_page" onclick="set_type('page')" value="5" <?php 
        echo $row->submit_text_type == 5 ? "checked" : "";
        ?>
 /><label for="text_type_page">Page</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_custom_text" onclick="set_type('custom_text')" value="3" <?php 
        echo $row->submit_text_type == 3 ? "checked" : "";
        ?>
 /><label for="text_type_custom_text">Custom Text</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_url" onclick="set_type('url')" value="4" <?php 
        echo $row->submit_text_type == 4 ? "checked" : "";
        ?>
 /><label for="text_type_url">URL</div>
            </td>
          </tr>
          <tr id="none" <?php 
        echo $row->submit_text_type == 2 || $row->submit_text_type == 3 || $row->submit_text_type == 4 || $row->submit_text_type == 5 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label>Stay on Form</label>
            </td>
            <td class="fm_options_value">
              <img src="<?php 
        echo WD_FM_URL . '/images/tick.png';
        ?>
" border="0">
            </td>
          </tr>
          <tr id="post" <?php 
        echo $row->submit_text_type != 2 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="post_name">Post</label>
            </td>
            <td class="fm_options_value">
              <select id="post_name" name="post_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Post -</option>
                <?php 
        // The Query.
        $args = array('posts_per_page' => 10000);
        query_posts($args);
        // The Loop.
        while (have_posts()) {
            the_post();
            ?>
                <option value="<?php 
            $x = get_permalink(get_the_ID());
            echo $x;
            ?>
" <?php 
            echo $row->article_id == $x ? 'selected="selected"' : '';
            ?>
><?php 
            the_title();
            ?>
</option>
                <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="page" <?php 
        echo $row->submit_text_type != 5 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="page_name">Page</label>
            </td>
            <td class="fm_options_value">
              <select id="page_name" name="page_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Page -</option>
                <?php 
        // The Query.
        $pages = get_pages();
        // The Loop.
        foreach ($pages as $page) {
            $page_id = get_page_link($page->ID);
            ?>
                <option value="<?php 
            echo $page_id;
            ?>
" <?php 
            echo $row->article_id == $page_id ? 'selected="selected"' : '';
            ?>
><?php 
            echo $page->post_title;
            ?>
</option>
                  <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="custom_text" <?php 
        echo $row->submit_text_type != 3 ? 'style="display: none;"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="submit_text">Text</label>
            </td>
            <td class="fm_options_value">
				<?php 
        $choise = "document.getElementById('submit_text')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_file_upload") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				<input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
				<input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="User Id" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'userid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
              <?php 
        if (user_can_richedit()) {
            wp_editor($row->submit_text, 'submit_text', array('teeny' => FALSE, 'textarea_name' => 'submit_text', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                <textarea cols="36" rows="5" id="submit_text" name="submit_text" style="resize: vertical;">
                  <?php 
            echo $row->submit_text;
            ?>
                </textarea>
                <?php 
        }
        ?>
            </td>
          </tr>
          <tr id="url" <?php 
        echo $row->submit_text_type != 4 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="url">URL</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="url" name="url" style="width:300px" value="<?php 
        echo $row->url;
        ?>
" />
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="payment_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">Payment Options</legend>
        <table class="admintable">
          <tr>
            <td colspan="2">
              <div class="error_fm" style="padding: 5px; font-size: 14px;">Paypal Options are disabled in free version.</div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Turn Paypal On</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode1" value="1" <?php 
        echo $row->paypal_mode == "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode1">On</label></div>
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode2" value="0" <?php 
        echo $row->paypal_mode != "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode2">Off</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Checkout Mode</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode1" value="production" <?php 
        echo $row->checkout_mode == "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode1">Production</label></div>
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode2" value="testmode" <?php 
        echo $row->checkout_mode != "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode2">Testmode</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="paypal_email">Paypal email</label>
            </td>
            <td class="fm_options_value">
              <input disabled="disabled" type="text" name="paypal_email" id="paypal_email" value="<?php 
        echo $row->paypal_email;
        ?>
" class="text_area" style="width:250px">
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="payment_currency">Payment Currency</label>
            </td>
            <td class="fm_options_value">
              <select disabled="disabled" id="payment_currency" name="payment_currency" style="width:253px">
                <option value="USD" <?php 
        echo $row->payment_currency == 'USD' ? 'selected' : '';
        ?>
>$ &#8226; U.S. Dollar</option>
                <option value="EUR" <?php 
        echo $row->payment_currency == 'EUR' ? 'selected' : '';
        ?>
>&#8364; &#8226; Euro</option>
                <option value="GBP" <?php 
        echo $row->payment_currency == 'GBP' ? 'selected' : '';
        ?>
>&#163; &#8226; Pound Sterling</option>
                <option value="JPY" <?php 
        echo $row->payment_currency == 'JPY' ? 'selected' : '';
        ?>
>&#165; &#8226; Japanese Yen</option>
                <option value="CAD" <?php 
        echo $row->payment_currency == 'CAD' ? 'selected' : '';
        ?>
>C$ &#8226; Canadian Dollar</option>
                <option value="MXN" <?php 
        echo $row->payment_currency == 'MXN' ? 'selected' : '';
        ?>
>Mex$ &#8226; Mexican Peso</option>
                <option value="HKD" <?php 
        echo $row->payment_currency == 'HKD' ? 'selected' : '';
        ?>
>HK$ &#8226; Hong Kong Dollar</option>
                <option value="HUF" <?php 
        echo $row->payment_currency == 'HUF' ? 'selected' : '';
        ?>
>Ft &#8226; Hungarian Forint</option>
                <option value="NOK" <?php 
        echo $row->payment_currency == 'NOK' ? 'selected' : '';
        ?>
>kr &#8226; Norwegian Kroner</option>
                <option value="NZD" <?php 
        echo $row->payment_currency == 'NZD' ? 'selected' : '';
        ?>
>NZ$ &#8226; New Zealand Dollar</option>
                <option value="SGD" <?php 
        echo $row->payment_currency == 'SGD' ? 'selected' : '';
        ?>
>S$ &#8226; Singapore Dollar</option>
                <option value="SEK" <?php 
        echo $row->payment_currency == 'SEK' ? 'selected' : '';
        ?>
>kr &#8226; Swedish Kronor</option>
                <option value="PLN" <?php 
        echo $row->payment_currency == 'PLN' ? 'selected' : '';
        ?>
>zl &#8226; Polish Zloty</option>
                <option value="AUD" <?php 
        echo $row->payment_currency == 'AUD' ? 'selected' : '';
        ?>
>A$ &#8226; Australian Dollar</option>
                <option value="DKK" <?php 
        echo $row->payment_currency == 'DKK' ? 'selected' : '';
        ?>
>kr &#8226; Danish Kroner</option>
                <option value="CHF" <?php 
        echo $row->payment_currency == 'CHF' ? 'selected' : '';
        ?>
>CHF &#8226; Swiss Francs</option>
                <option value="CZK" <?php 
        echo $row->payment_currency == 'CZK' ? 'selected' : '';
        ?>
>Kc &#8226; Czech Koruny</option>
                <option value="ILS" <?php 
        echo $row->payment_currency == 'ILS' ? 'selected' : '';
        ?>
>&#8362; &#8226; Israeli Sheqel</option>
                <option value="BRL" <?php 
        echo $row->payment_currency == 'BRL' ? 'selected' : '';
        ?>
>R$ &#8226; Brazilian Real</option>
                <option value="TWD" <?php 
        echo $row->payment_currency == 'TWD' ? 'selected' : '';
        ?>
>NT$ &#8226; Taiwan New Dollars</option>
                <option value="MYR" <?php 
        echo $row->payment_currency == 'MYR' ? 'selected' : '';
        ?>
>RM &#8226; Malaysian Ringgit</option>
                <option value="PHP" <?php 
        echo $row->payment_currency == 'PHP' ? 'selected' : '';
        ?>
>&#8369; &#8226; Philippine Peso</option>
                <option value="THB" <?php 
        echo $row->payment_currency == 'THB' ? 'selected' : '';
        ?>
>&#xe3f; &#8226; Thai Bahtv</option>
              </select>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="tax">Tax</label>
            </td>
            <td class="fm_options_value">
              <input type="text" name="tax" id="tax" value="<?php 
        echo $row->tax;
        ?>
" class="text_area" style="width: 40px;" onKeyPress="return check_isnum_point(event)"> %
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="javascript_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">JavaScript</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label for="javascript">Javascript</label>
            </td>
            <td class="fm_options_value" style="width:650px;">
              <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php 
        echo $row->javascript;
        ?>
</textarea>
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="conditions_fieldset" class="adminform fm_fieldset_deactive">
				<legend style="color:#0B55C4;font-weight: bold;">Conditional Fields</legend>
				<?php 
        $ids = array();
        $types = array();
        $labels = array();
        $paramss = array();
        $all_ids = array();
        $all_labels = array();
        $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $fields = explode('*:*new_field*:*', $row->form_fields);
        $fields = array_slice($fields, 0, count($fields) - 1);
        foreach ($fields as $field) {
            $temp = explode('*:*id*:*', $field);
            array_push($ids, $temp[0]);
            array_push($all_ids, $temp[0]);
            $temp = explode('*:*type*:*', $temp[1]);
            array_push($types, $temp[0]);
            $temp = explode('*:*w_field_label*:*', $temp[1]);
            array_push($labels, $temp[0]);
            array_push($all_labels, $temp[0]);
            array_push($paramss, $temp[1]);
        }
        foreach ($types as $key => $value) {
            if (!in_array($types[$key], $select_and_input)) {
                unset($ids[$key]);
                unset($labels[$key]);
                unset($types[$key]);
                unset($paramss[$key]);
            }
        }
        $ids = array_values($ids);
        $labels = array_values($labels);
        $types = array_values($types);
        $paramss = array_values($paramss);
        $chose_ids = implode('@@**@@', $ids);
        $chose_labels = implode('@@**@@', $labels);
        $chose_types = implode('@@**@@', $types);
        $chose_paramss = implode('@@**@@', $paramss);
        $all_ids_cond = implode('@@**@@', $all_ids);
        $all_labels_cond = implode('@@**@@', $all_labels);
        $show_hide = array();
        $field_label = array();
        $all_any = array();
        $condition_params = array();
        $count_of_conditions = 0;
        if ($row->condition != "") {
            $conditions = explode('*:*new_condition*:*', $row->condition);
            $conditions = array_slice($conditions, 0, count($conditions) - 1);
            $count_of_conditions = count($conditions);
            foreach ($conditions as $condition) {
                $temp = explode('*:*show_hide*:*', $condition);
                array_push($show_hide, $temp[0]);
                $temp = explode('*:*field_label*:*', $temp[1]);
                array_push($field_label, $temp[0]);
                $temp = explode('*:*all_any*:*', $temp[1]);
                array_push($all_any, $temp[0]);
                array_push($condition_params, $temp[1]);
            }
        } else {
            $show_hide[0] = 1;
            $all_any[0] = 'and';
            $condition_params[0] = '';
            if ($all_ids) {
                $field_label[0] = $all_ids[0];
            }
        }
        ?>
					<div>
					<span style="font-size:13px;">Add Condition<span/>
					<img src="<?php 
        echo WD_FM_URL . '/images/add_condition.png';
        ?>
" title="add" onclick="add_condition('<?php 
        echo $chose_ids;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_labels));
        ?>
', '<?php 
        echo $chose_types;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_paramss));
        ?>
', '<?php 
        echo $all_ids_cond;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($all_labels_cond));
        ?>
')" style="cursor: pointer; vertical-align: middle; margin-left:15px;">
					</div>
					<?php 
        for ($k = 0; $k < $count_of_conditions; $k++) {
            if (in_array($field_label[$k], $all_ids)) {
                ?>
					<div id="condition<?php 
                echo $k;
                ?>
" >
						<div id="conditional_fileds<?php 
                echo $k;
                ?>
">
							<select id="show_hide<?php 
                echo $k;
                ?>
" name="show_hide<?php 
                echo $k;
                ?>
" style="width:80px; ">
							<option value="1" <?php 
                if ($show_hide[$k] == 1) {
                    echo 'selected="selected"';
                }
                ?>
>show</option>
							<option value="0" <?php 
                if ($show_hide[$k] == 0) {
                    echo 'selected="selected"';
                }
                ?>
>hide</option>
							</select> 
							
							<select id="fields<?php 
                echo $k;
                ?>
" name="fields<?php 
                echo $k;
                ?>
" style="width:400px; " onChange="" >
							<?php 
                foreach ($all_labels as $key => $value) {
                    if ($field_label[$k] == $all_ids[$key]) {
                        $selected = 'selected="selected"';
                    } else {
                        $selected = '';
                    }
                    echo '<option value="' . $all_ids[$key] . '" ' . $selected . '>' . $value . '</option>';
                }
                ?>
							</select> 
							<span>if</span>
							
							<select id="all_any<?php 
                echo $k;
                ?>
" name="all_any<?php 
                echo $k;
                ?>
" style="width:60px; ">
							<option value="and" <?php 
                if ($all_any[$k] == "and") {
                    echo 'selected="selected"';
                }
                ?>
>all</option>
							<option value="or" <?php 
                if ($all_any[$k] == "or") {
                    echo 'selected="selected"';
                }
                ?>
>any</option>
							</select> 
							
							<span>of the following match:</span>	
							<img src="<?php 
                echo WD_FM_URL . '/images/add.png';
                ?>
" title="add" onclick="add_condition_fields(<?php 
                echo $k;
                ?>
,'<?php 
                echo $chose_ids;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_labels));
                ?>
', '<?php 
                echo $chose_types;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_paramss));
                ?>
')" style="cursor: pointer; vertical-align: middle;">
							
							<img src="<?php 
                echo WD_FM_URL . '/images/page_delete.png';
                ?>
" onclick="delete_condition('<?php 
                echo $k;
                ?>
')" style="cursor: pointer; vertical-align: middle;">
						</div>
						
						<?php 
                if ($condition_params[$k]) {
                    $_params = explode('*:*next_condition*:*', $condition_params[$k]);
                    $_params = array_slice($_params, 0, count($_params) - 1);
                    foreach ($_params as $key => $_param) {
                        $key_select_or_input = '';
                        $param_values = explode('***', $_param);
                        $multiselect = explode('@@@', $param_values[2]);
                        if (in_array($param_values[0], $ids)) {
                            ?>
								<div id="condition_div<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
">
								<select id="field_labels<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php 
                            echo $key;
                            ?>
','<?php 
                            echo $chose_ids;
                            ?>
', '<?php 
                            echo $chose_types;
                            ?>
', '<?php 
                            echo htmlspecialchars(addslashes($chose_paramss));
                            ?>
')" style="width:350px;"/>
									<?php 
                            foreach ($labels as $key1 => $value) {
                                if ($param_values[0] == $ids[$key1]) {
                                    $selected = 'selected="selected"';
                                    if ($types[$key1] == "type_checkbox" || $types[$key1] == "type_paypal_checkbox") {
                                        $multiple = 'multiple="multiple" class="multiple_select"';
                                    } else {
                                        $multiple = '';
                                    }
                                    $key_select_or_input = $key1;
                                } else {
                                    $selected = '';
                                }
                                if ($field_label[$k] != $ids[$key1]) {
                                    echo '<option id="' . $k . '_' . $key1 . '" value="' . $ids[$key1] . '" ' . $selected . '>' . $value . '</option>';
                                }
                            }
                            ?>
	
								</select>
								
								<select id="is_select<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" style="vertical-align: top;">
								<option value="==" <?php 
                            if ($param_values[1] == "==") {
                                echo 'selected="selected"';
                            }
                            ?>
>is</option>
								<option value="!=" <?php 
                            if ($param_values[1] == "!=") {
                                echo 'selected="selected"';
                            }
                            ?>
>is not</option>
								<option value="%" <?php 
                            if ($param_values[1] == "%") {
                                echo 'selected="selected"';
                            }
                            ?>
>like</option>

								<option value="!%" <?php 
                            if ($param_values[1] == "!%") {
                                echo 'selected="selected"';
                            }
                            ?>
>not like</option>

								<option value="=" <?php 
                            if ($param_values[1] == "=") {
                                echo 'selected="selected"';
                            }
                            ?>
>empty</option>

								<option value="!" <?php 
                            if ($param_values[1] == "!") {
                                echo 'selected="selected"';
                            }
                            ?>
>not empty</option>

								</select>
								
								<?php 
                            if ($key_select_or_input !== '' && in_array($types[$key_select_or_input], $select_type_fields)) {
                                ?>
								<select id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" <?php 
                                echo $multiple;
                                ?>
 style="vertical-align: top; width: 200px;">
								<?php 
                                switch ($types[$key_select_or_input]) {
                                    case "type_own_select":
                                    case "type_paypal_select":
                                        $w_size = explode('*:*w_size*:*', $paramss[$key_select_or_input]);
                                        break;
                                    case "type_radio":
                                    case "type_checkbox":
                                    case "type_paypal_radio":
                                    case "type_paypal_checkbox":
                                    case "type_paypal_shipping":
                                        $w_size = explode('*:*w_flow*:*', $paramss[$key_select_or_input]);
                                        break;
                                }
                                $w_choices = explode('*:*w_choices*:*', $w_size[1]);
                                $w_choices_array = explode('***', $w_choices[0]);
                                $w_choices_price = explode('*:*w_choices_price*:*', $w_choices[1]);
                                $w_choices_price_array = explode('***', $w_choices_price[0]);
                                for ($m = 0; $m < count($w_choices_array); $m++) {
                                    if ($types[$key_select_or_input] == "type_paypal_checkbox" || $types[$key_select_or_input] == "type_paypal_radio" || $types[$key_select_or_input] == "type_paypal_shipping" || $types[$key_select_or_input] == "type_paypal_select") {
                                        $w_choice = $w_choices_array[$m] . '*:*value*:*' . $w_choices_price_array[$m];
                                    } else {
                                        $w_choice = $w_choices_array[$m];
                                    }
                                    if (in_array(esc_html($w_choice), $multiselect)) {
                                        $selected = 'selected="selected"';
                                    } else {
                                        $selected = '';
                                    }
                                    if (strpos($w_choices_array[$m], '[') === false && strpos($w_choices_array[$m], ']') === false && strpos($w_choices_array[$m], ':') === false) {
                                        echo '<option id="choise_' . $k . '_' . $m . '" value="' . $w_choice . '" ' . $selected . '>' . $w_choices_array[$m] . '</option>';
                                    }
                                }
                                if ($types[$key_select_or_input] == "type_address") {
                                    $w_countries = array("", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe");
                                    $w_options = '';
                                    foreach ($w_countries as $w_country) {
                                        if (in_array($w_country, $multiselect)) {
                                            $selected = 'selected="selected"';
                                        } else {
                                            $selected = '';
                                        }
                                        echo '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
                                    }
                                }
                                ?>
	
								</select>
								<?php 
                            } else {
                                if ($key_select_or_input != '' && ($types[$key_select_or_input] == "type_number" || $types[$key_select_or_input] == "type_phone")) {
                                    $onkeypress_function = "onkeypress='return check_isnum_space(event)'";
                                } else {
                                    if ($key_select_or_input != '' && $types[$key_select_or_input] == "type_paypal_price") {
                                        $onkeypress_function = "onkeypress='return check_isnum_point(event)'";
                                    } else {
                                        $onkeypress_function = "";
                                    }
                                }
                                ?>
								<input id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" type="text" value="<?php 
                                echo $param_values[2];
                                ?>
" <?php 
                                echo $onkeypress_function;
                                ?>
 style="vertical-align: top; width: 200px;"><?php 
                            }
                            ?>
								
								<img src="<?php 
                            echo WD_FM_URL . '/images/delete.png';
                            ?>
" id="delete_condition<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onclick="delete_field_condition('<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
')" style="vertical-align: top;">
								</div>
								<?php 
                        }
                    }
                }
                ?>
					</div>
					<?php 
            }
        }
        ?>
				<input type="hidden" id="condition" name="condition" value="<?php 
        echo $row->condition;
        ?>
" />	
				
			</fieldset>
      
      <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">MySQL Mapping</legend>
        <div>
          <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="add_query" title="Add Query" onclick="return false;">
            Add Query
          </a>
          <button class="button-primary thickbox thickbox-preview" onclick="if (fm_check_email('mailToAdd') ||
                           fm_check_email('from_mail') ||
                           fm_check_email('reply_to') ||
                           fm_check_email('mail_from_user') ||
                           fm_check_email('reply_to_user') ||
                           fm_check_email('mail_from_other') ||
                           fm_check_email('reply_to_other') ||
                           fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'remove_query')">Delete</button>
        </div>
				<?php 
        if ($queries) {
            ?>
				<table class="wp-list-table widefat fixed posts table_content">
					<thead>
						<tr>
							<th style="width:4%;" class="table_small_col count_col sub-align">#</th>
							<th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
							<th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
                <input id="check_all" type="checkbox" style="margin:0;">
              </th>
							<th style="width:86%;" class="table_large_col">Query</th>
						</tr>
					</thead>
					<?php 
            $k = 0;
            for ($i = 0, $n = count($queries); $i < $n; $i++) {
                $query = $queries[$i];
                $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
                $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
						<tr <?php 
                if ($k) {
                    echo "class=\"alternate\"";
                }
                ?>
>
							<td align="center" class="table_small_col"><?php 
                echo $i + 1;
                ?>
</td>
							<td align="center" class="table_small_col"><?php 
                echo $query->id;
                ?>
</td>
							<td align="center" class="table_small_col check-column"><?php 
                echo $checked;
                ?>
</td>
							<td align="center"><a href="<?php 
                echo $link;
                ?>
" class="thickbox thickbox-preview" onclick="return false;"><?php 
                echo $query->query;
                ?>
</a></td>
						</tr>
						<?php 
                $k = 1 - $k;
            }
            ?>
				</table>
				<?php 
        }
        ?>
			</fieldset>
      <input type="hidden" name="boxchecked" value="0">
      <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php 
        echo WDW_FM_Library::get('fieldset_id', 'general');
        ?>
" />

      <input type="hidden" id="task" name="task" value=""/>
      <input type="hidden" id="current_id" name="current_id" value="<?php 
        echo $row->id;
        ?>
" />
    </form>
    <script>
      jQuery(window).load(function () {
        form_maker_options_tabs(jQuery("#fieldset_id").val());
        fm_popup();
        function hide_email_labels(event) {
          var e = event.toElement || event.relatedTarget;
          if (e.parentNode == this || e == this) {
             return;
          }
          this.style.display="none";
        }
        if(document.getElementById('mail_from_labels')) {
          document.getElementById('mail_from_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_labels')) {
          document.getElementById('mail_subject_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_from_name_user_labels')) {
          document.getElementById('mail_from_name_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_user_labels')) {
          document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
      });
      function wd_fm_apply_options() {
        set_condition();
        fm_set_input_value('task', 'apply_options');
        document.getElementById('adminForm').submit();
      }
    </script>
    <?php 
    }
Example #30
0
/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
function wp_default_editor()
{
    $r = user_can_richedit() ? 'tinymce' : 'html';
    // defaults
    if (wp_get_current_user()) {
        // look for cookie
        $ed = get_user_setting('editor', 'tinymce');
        $r = in_array($ed, array('tinymce', 'html', 'test')) ? $ed : $r;
    }
    /**
     * Filter which editor should be displayed by default.
     *
     * @since 2.5.0
     *
     * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
     */
    return apply_filters('wp_default_editor', $r);
}