PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/polo-family.com/wp-content/plugins/aawzone-ebay/include/helpers/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //home/trave494/polo-family.com/wp-content/plugins/aawzone-ebay/include/helpers/settings.class.php |
<?php /* * Define class WooZoneProviderEbay_Settings * Make sure you skip down to the end of this file, as there are a few * lines of code that are very important. */ !defined('ABSPATH') and exit; if (class_exists('WooZoneProviderEbay_Settings') != true) { class WooZoneProviderEbay_Settings { /* * Some required plugin information */ const VERSION = '1.0'; private $save_status = false; /* * Required __construct() function that initalizes the WooZoneProviderEbay_Settings */ public function __construct() { $this->save_settings(); } private function save_settings() { $form_saved = isset( $_REQUEST['WooZoneProviderEbay-form-saved'] ) ? (boolean) $_REQUEST['WooZoneProviderEbay-form-saved'] : false; $box_id = isset( $_REQUEST['box_id'] ) ? (string) $_REQUEST['box_id'] : ''; if( $form_saved === true && trim($box_id) != "" ){ $params = isset( $_REQUEST[$box_id] ) ? $_REQUEST[$box_id] : array(); if( count($params) > 0 ){ update_option( $box_id, $params ); $this->save_status = true; } } } /* * Build options, method * --------------------- * this will create you interface via options array elements */ public function build_options($options = array(), $box_id = '') { // reset as array, this will stock all the html content, and at the end return it $html = array(); if (count($options) == 0) { return 'Please fill with some options content first!'; } $noRowElements = array( 'message', 'app', 'box-style' ); $settings = array(); // get the values from DB $box_id = $box_id . '_' . WooZoneProviderEbay()->get_campaign_id(); $settings = get_option( $box_id ); $html[] = '<form method="POST" class="WooZoneProviderEbay-form" id="' . ($box_id) . '" action="">'; $html[] = '<div style="margin-bottom: 20px;" class="WooZoneProviderEbay-message WooZoneProviderEbay-success ' . ( $this->save_status == false ? 'WooZoneProviderEbay-display-none' : '' ) . '">Saved successfully!</div>'; // create a hidden input for sending the prefix $html[] = '<input type="hidden" name="box_id" value="' . ($box_id) . '" />'; $html[] = '<input type="hidden" name="WooZoneProviderEbay-form-saved" value="1" />'; $box = isset($options) ? $options : array(); $html[] = $this->tabs_header($box); // tabs html header // loop the box elements if (isset($options['elements']) && count($options['elements']) > 0) { // loop the box elements now foreach ($options['elements'] as $elm_id => $value) { // some helpers. Reset an each loop, prevent collision $val = ''; $select_value = ''; $checked = ''; $option_name = isset($option_name) ? $option_name : ''; // Set default value to $val if (isset($value['std'])) { $val = $value['std']; } // If the option is already saved, ovveride $val if ( ( $value['type'] != 'info' ) ) { if ( isset($settings[($elm_id)] ) && ( ( !is_array($settings[($elm_id)]) && @trim($settings[($elm_id)]) != "" ) || ( is_array($settings[($elm_id)]) /*&& !empty($settings[($elm_id)])*/ ) ) ) { $val = $settings[( $elm_id )]; // Striping slashes of non-array options if ( !is_array($val) ) { $val = stripslashes( $val ); //if($val == '') $val = true; } } } // If there is a description save it for labels $explain_value = ''; if (isset($value['desc'])) { $explain_value = $value['desc']; } if (!in_array($value['type'], $noRowElements)) { // the row and the label $html[] = '<div class="WooZoneProviderEbay-form-row' . ($this->tabs_elements($box, $elm_id)) . '"> <label for="' . ($elm_id) . '">' . (isset($value['title']) ? $value['title'] : '') . '</label> <div class="WooZoneProviderEbay-form-item">'; } switch ($value['type']) { // Basic text input case 'text': $html[] = '<input ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' id="' . esc_attr($elm_id) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" type="text" value="' . esc_attr($val) . '" />'; break; case 'list_of_colors': $html[] = '<div class="WooZoneProviderEbay-list-of-colors">'; $html[] = '<a href="#" class="button button-primary button-large WooZoneProviderEbay-add-color">Add new color</a>'; $html[] = '<ul>'; if( count(WooZoneProviderEbay()->the_colors()) > 0 ){ foreach ( WooZoneProviderEbay()->the_colors() as $color_name => $rgb ) { $html[] = '<li>'; $html[] = '<a href="#" class="WooZoneProviderEbay-lc-remove-color"><i class="dashicons dashicons-no-alt"></i></a>'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][name][]" class="WooZoneProviderEbay-lc-color-name" placeholder="Color Name" value="' . ( $color_name ) . '" />'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][color][]" class="WooZoneProviderEbay-lc-color-hex WooZoneProviderEbay-wp-color-picker" value="' . ( WooZoneProviderEbay()->rgb2html( $rgb[0], $rgb[1], $rgb[2] ) ) . '" />'; $html[] = '</li>'; } } $html[] = '</ul>'; $html[] = ''; $html[] = '</div>'; break; case 'box-style': $html[] = '<div class="WooZoneProviderEbay-form-row WooZoneProviderEbay_template">'; $html[] = '<div class="WooZoneProviderEbay-box-style-title">'; $html[] = '<h2>' . ( $value['title'] ) . '</h2>'; $html[] = '<p>' . ( $value['box_desc'] ) . ' </p>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-box-style">'; $html[] = '<div class="WooZoneProviderEbay-box-preview"><span></span></div>'; $html[] = '<div class="WooZoneProviderEbay-box-settings">'; $html[] = '<a href="#" class="WooZoneProviderEbay-box-settings-title on" data-rel="border-radius">Border Radius</a>'; $html[] = '<a href="#" class="WooZoneProviderEbay-box-settings-title" data-rel="box-shadow">Box Shadow</a>'; $html[] = '<a href="#" class="WooZoneProviderEbay-box-settings-title" data-rel="box-spacing">Box Spacing</a>'; $html[] = '<div class="WooZoneProviderEbay-box-content" data-rel="box-spacing">'; $html[] = '<fieldset>'; $html[] = '<label>'; $html[] = '<span>Box Margin</span>'; $html[] = '<div class="WooZoneProviderEbay-box-spacing">'; $html[] = '<div class="WooZoneProviderEbay-box-spacing-margin">'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-top WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][margin][top]" value="' . ( isset($val['margin']['top']) ? $val['margin']['top'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-right WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][margin][right]" value="' . ( isset($val['margin']['right']) ? $val['margin']['right'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-bottom WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][margin][bottom]" value="' . ( isset($val['margin']['bottom']) ? $val['margin']['bottom'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-left WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][margin][left]" value="' . ( isset($val['margin']['left']) ? $val['margin']['left'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-content">content</span>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Box Padding</span>'; $html[] = '<div class="WooZoneProviderEbay-box-spacing">'; $html[] = '<div class="WooZoneProviderEbay-box-spacing-margin">'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-top WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][padding][top]" value="' . ( isset($val['padding']['top']) ? $val['padding']['top'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-right WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][padding][right]" value="' . ( isset($val['padding']['right']) ? $val['padding']['right'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-bottom WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][padding][bottom]" value="' . ( isset($val['padding']['bottom']) ? $val['padding']['bottom'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-margin-left WooZoneProviderEbay-box-spacing-input">'; $html[] = '<input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][padding][left]" value="' . ( isset($val['padding']['left']) ? $val['padding']['left'] : '0px') . '">'; $html[] = '</span>'; $html[] = '<span class="WooZoneProviderEbay-box-spacing-content">content</span>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '</label>'; $html[] = '</fieldset>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-box-content" data-rel="border-radius" style="display: block">'; $html[] = '<fieldset>'; $html[] = '<label>'; $html[] = '<span>All Corners</span>'; $html[] = '<em>px</em><input type="text" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][all]" value="' . ( isset($val['radius']['all']) ? $val['radius']['all'] : '10') . '"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['radius']['all']) ? $val['radius']['all'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Top Left</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['radius']['top-left']) ? $val['radius']['top-left'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][top-left]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['radius']['top-left']) ? $val['radius']['top-left'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Top Right</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['radius']['top-right']) ? $val['radius']['top-right'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][top-right]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['radius']['top-right']) ? $val['radius']['top-right'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Bottom Left</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['radius']['bottom-left']) ? $val['radius']['bottom-left'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][bottom-left]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['radius']['bottom-left']) ? $val['radius']['bottom-left'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Bottom Right</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['radius']['bottom-right']) ? $val['radius']['bottom-right'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][bottom-right]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['radius']['bottom-right']) ? $val['radius']['bottom-right'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label style="margin-top: 30px">'; $html[] = '<span>Border Width</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['radius']['border-width']) ? $val['radius']['border-width'] : '0') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][border-width]" />'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="100" data-def="' . ( isset($val['radius']['border-width']) ? $val['radius']['border-width'] : '0') . '"></div>'; $html[] = '</label>'; $html[] = '<label class="WooZoneProviderEbay-box-settings-one-row">'; $html[] = '<span>Border Style</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][border-style]">'; $html[] = '<option value="solid" ' . ( isset($val['radius']['border-style']) && $val['radius']['border-style'] == 'solid' ? 'selected' : '' ) .'>solid</option>'; $html[] = '<option value="dotted" ' . ( isset($val['radius']['border-style']) && $val['radius']['border-style'] == 'dotted' ? 'selected' : '' ) .'>dotted</option>'; $html[] = '<option value="dashed" ' . ( isset($val['radius']['border-style']) && $val['radius']['border-style'] == 'dashed' ? 'selected' : '' ) .'>dashed</option>'; $html[] = '<option value="double" ' . ( isset($val['radius']['border-style']) && $val['radius']['border-style'] == 'double' ? 'selected' : '' ) .'>double</option>'; $html[] = '<option value="none" ' . ( isset($val['radius']['border-style']) && $val['radius']['border-style'] == 'none' ? 'selected' : '' ) .'>none</option>'; $html[] = '</select>'; $html[] = '</label>'; $html[] = '<label class="WooZoneProviderEbay-box-settings-one-row">'; $html[] = '<span>Border Color</span>'; $html[] = '<input class="WooZoneProviderEbay-wp-color-picker-box" data-alpha="true" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][border-color]" type="text" value="' . ( isset($val['radius']['border-color']) ? $val['radius']['border-color'] : '#fee50e') . '" />'; $html[] = '</label>'; $html[] = '<label class="WooZoneProviderEbay-box-settings-one-row">'; $html[] = '<span>Box Background</span>'; $html[] = '<input class="WooZoneProviderEbay-wp-color-picker-box" data-alpha="true" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][radius][background-color]" type="text" value="' . ( isset($val['radius']['background-color']) ? $val['radius']['background-color'] : '#5f3a71') . '" />'; $html[] = '</label>'; $html[] = '</fieldset>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-box-content" data-rel="box-shadow">'; $html[] = '<fieldset>'; $html[] = '<label>'; $html[] = '<span>Horizontal Length</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['box-shadow']['horizontal']) ? $val['box-shadow']['horizontal'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][horizontal]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="-200" data-max="200" data-def="' . ( isset($val['box-shadow']['horizontal']) ? $val['box-shadow']['horizontal'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Vertical Length</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['box-shadow']['vertical']) ? $val['box-shadow']['vertical'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][vertical]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="-200" data-max="200" data-def="' . ( isset($val['box-shadow']['vertical']) ? $val['box-shadow']['vertical'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Blur Radius</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['box-shadow']['blur']) ? $val['box-shadow']['blur'] : '10') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][blur]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="200" data-def="' . ( isset($val['box-shadow']['blur']) ? $val['box-shadow']['blur'] : '10') . '"></div>'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Spread Radius</span>'; $html[] = '<em>px</em><input type="text" value="' . ( isset($val['box-shadow']['spread']) ? $val['box-shadow']['spread'] : '0') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][spread]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="-200" data-max="200" data-def="' . ( isset($val['box-shadow']['spread']) ? $val['box-shadow']['spread'] : '0') . '"></div>'; $html[] = '</label>'; $html[] = '<label class="WooZoneProviderEbay-box-settings-one-row">'; $html[] = '<span>Shadow Color</span>'; $html[] = '<input class="WooZoneProviderEbay-wp-color-picker-box" data-alpha="true" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][shadow]" type="text" value="' . ( isset($val['box-shadow']['spread']) ? $val['box-shadow']['shadow'] : '#23282d') . '" />'; $html[] = '</label>'; $html[] = '<label>'; $html[] = '<span>Opacity</span>'; $html[] = '<em>%</em><input type="text" value="' . ( isset($val['box-shadow']['opacity']) ? $val['box-shadow']['opacity'] : '0') . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][opacity]"/>'; $html[] = '<div class="WooZoneProviderEbay-box-settings-slider" data-min="0" data-max="100" data-def="' . ( isset($val['box-shadow']['opacity']) ? $val['box-shadow']['opacity'] : '0') . '" data-step="1"></div>'; $html[] = '</label>'; $html[] = '<label class="WooZoneProviderEbay-box-settings-one-row">'; $html[] = '<span>Box Shadow type</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][box-shadow][type]">'; $html[] = '<option value="outline" ' . ( isset($val['box-shadow']['type']) && $val['box-shadow']['type'] == 'outline' ? 'selected' : '' ) .'>Outline</option>'; $html[] = '<option value="inset" ' . ( isset($val['box-shadow']['type']) && $val['box-shadow']['type'] == 'inset' ? 'selected' : '' ) .'>Inset</option>'; $html[] = '</select>'; $html[] = '</label>'; $html[] = '</fieldset>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '<textarea class="WooZoneProviderEbay-box-settings-export-style" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][output]"></textarea>'; $html[] = '</div>'; $html[] = '</div>'; break; // Basic text input case 'timepicker': $html[] = '<input ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' id="' . esc_attr($elm_id) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" type="text" value="' . esc_attr($val) . '" class="' . ( WooZoneProviderEbay()->alias . '-timepicker') . '" />'; break; // Basic text input case 'password_access': $html[] = '<input id="' . esc_attr($elm_id) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" type="text" value="' . esc_attr($val) . '" class="' . ( WooZoneProviderEbay()->alias . '-password') . '" />'; $html[] = '<a href="#upload" target="blank" class="' . ( WooZoneProviderEbay()->alias ) . '-button ' . ( WooZoneProviderEbay()->alias ) . '-small red ' . ( WooZoneProviderEbay()->alias ) . '-btn-new-password">Generate new password</a>'; break; // Wordpress color picker input case 'color_picker': $html[] = '<input class="WooZoneProviderEbay-wp-color-picker" data-alpha="true" ' . ( isset($value['force_width']) ? "style='width:" . ( $value['force_width'] ) . "px;'" : '' ) . ' id="' . esc_attr( $elm_id ) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" type="text" value="' . esc_attr( $val ) . '" />'; break; case 'geo_targeting': $html[] = '<div class="WooZoneProviderEbay_iw-amazon_ids WooZoneProviderEbay_iw-amazon_geo">'; $html[] = '<p class="WooZoneProviderEbay_iw-status-notice"> If you plan to promote products from all Amazon Websites, you should activate the Geotargeting feature. This setting automatically detects your client location (country) and only loads Amazon Products from the closest Amazon Website. Ex: You have a client from Canada that searches for "samsung" on your website. When he clicks on any Amazon Product, he will be redirected to Amazon.ca'; $html[] = '<div class="WooZoneProviderEbay_iw_switch"> <h1 class="WooZoneProviderEbay_iw_on">Geo-targeting is ON</h1> <h1 class="WooZoneProviderEbay_iw_off">Geo-targeting is OFF</h1> <div class="WooZoneProviderEbay_iw_circle"></div> <input type="hidden" value="' . esc_attr( $val['geo_status'] ) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][geo_status]" /> </div>'; $html[] = '<div class="WooZoneProviderEbay_geo_service">'; $html[] = '<h2>Detection System:</h2>'; $html[] = '<select style="width:380px;" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][service]"> <option ' . ( $val['service'] == 'local_csv' ? 'selected="selected"' : '' ) . ' value="local_csv">Local IP detection (plugin local csv file with IP range lists)</option> <option ' . ( $val['service'] == 'www.geoplugin.net' ? 'selected="selected"' : '' ) . ' value="www.geoplugin.net">www.geoplugin.net</option> <option ' . ( $val['service'] == 'ipinfo.io' ? 'selected="selected"' : '' ) . ' value="ipinfo.io">ipinfo.io</option> </select>'; $html[] = '<p>We use an external server for detecting client country location (per IP address) or you can try local IP detection.</p>'; $html[] = '<h2>Choose main affiliate website:</h2>'; $html[] = '<div class="WooZoneProviderEbay_country_dropdown">'; $html[] = '<input type="hidden" value="' . esc_attr( $val['default_aff'] ) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][default_aff]" />'; $html[] = '<div class="WooZoneProviderEbay_country_dropdown-current">'; $html[] = '<img src=""> <span></span> <div class="dashicons dashicons-arrow-down-alt2"></div>'; $html[] = '</div>'; $html[] = '<ul>'; foreach (WooZoneProviderEbay()->amazon_sites() as $country_code => $country) { $html[] = '<li data-country="' . ( $country_code ) . '">'; $html[] = '<img src="' . ( $country['flag'] ) . '" />'; $html[] = '<span>' . $country['label'] . '</span>'; $html[] = '</li>'; $cc++; } $html[] = '</ul>'; $html[] = '<p>This location will be used if your customer location cannot be detected.</p>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '</div>'; break; case 'amazon_categories': $html[] = '<div class="WooZoneProviderEbay_iw-amazon_categories">'; $amazon_sites = WooZoneProviderEbay()->amazon_sites(); $amazon_categories = WooZoneProviderEbay()->amazon_categories(); $html[] = '<ul>'; foreach ($amazon_categories as $domain => $departamens) { if( isset($amazon_sites[$domain]) ){ $html[] = '<li>'; $html[] = '<img src="' . ( $amazon_sites[$domain]['flag'] ) . '" />'; $html[] = '<span>'; $html[] = $amazon_sites[$domain]['label']; $html[] = '</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $domain ) . ']">'; foreach ($departamens as $key4 => $value4) { $html[] = '<option ' . ( $val[$domain] == $value4 ? 'selected' : '' ) . ' value="' . ( $value4 ) . '">' . ( $key4 ) . '</option>'; } $html[] = '</select>'; $html[] = '</li>'; } } $html[] = '</ul>'; $html[] = '</div>'; break; // Basic text input case 'amazon_ids': $html[] = '<div class="WooZoneProviderEbay_iw-amazon_ids">'; $html[] = '<p class="WooZoneProviderEbay_iw-status-notice"> If you plan to promote products from all Amazon Websites, you should register for each Amazon Affiliate Program of each Country:'; $cc = 0; foreach (WooZoneProviderEbay()->amazon_sites() as $country_code => $country) { $html[] = '<a href="' . ( $country['url'] ) . '" target="_blank">' . ( $country['label'] ) . '</a>' . ( $cc < count(WooZoneProviderEbay()->amazon_sites()) -1 ? ', ': ''); $cc++; } $html[] = '</p>'; $html[] = '<ul>'; foreach (WooZoneProviderEbay()->amazon_sites() as $country_code => $country) { $html[] = '<li>'; $html[] = '<img src="' . ( $country['flag'] ) . '" />'; $html[] = '<a href="' . ( $country['url'] ) . '" target="_blank">' . ( $country['label'] ) . '</a>'; $html[] = '<input type="text" value="' . ( $val[$country_code] ) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $country_code ) . ']" placeholder="your tag here ...">'; $html[] = '</li>'; } $html[] = '</ul>'; $html[] = '</div>'; break; case 'template_typography': if( $value['options'] ){ $html[] = '<div class="WooZoneProviderEbay-typo-wrapper">'; $google_fonts = WooZoneProviderEbay()->getAllGfonts(); if( !isset($val) || !is_array($val) || count($val) == 0 ){ $val = array(); } foreach ($value['options'] as $option_key => $option_value) { // build some defaults if not saved if( !isset($val[$option_key]['family']) ) $val[$option_key]['family'] = $option_value['family']; if( !isset($val[$option_key]['size']) ) $val[$option_key]['size'] = $option_value['size']; if( !isset($val[$option_key]['weight']) ) $val[$option_key]['weight'] = isset($option_value['weight']) ? $option_value['weight'] : ''; if( !isset($val[$option_key]['color']) ) $val[$option_key]['color'] = $option_value['color']; if( !isset($val[$option_key]['background-color']) ) $val[$option_key]['background-color'] = isset($option_value['background-color']) ? $option_value['background-color'] : ''; $html[] = '<fieldset class="WooZoneProviderEbay-typo-row">'; $html[] = '<legend class="WooZoneProviderEbay-typo-title">' . ( $option_value['title'] ) . '</legend>'; $html[] = '<div class="WooZoneProviderEbay-typo-font-preview">The quick brown fox jumps over the lazy dog</div>'; $html[] = '<div class="WooZoneProviderEbay-typo-font-family">'; $html[] = '<span>Font-family:</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $option_key ) . '][family]">'; if( count($google_fonts) > 0 ){ foreach ($google_fonts as $font_key => $font ) { $html[] = '<option value="' . ( $font_key ) . '" ' . ( isset($val[$option_key]['family']) && $val[$option_key]['family'] == $font ? 'selected' : '' ) . '>' . ( $font ) . '</option>'; } } $html[] = '</select>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-typo-font-size">'; $html[] = '<span>Font-size:</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $option_key ) . '][size]">'; foreach ( range( 10, 34 ) as $size ) { $html[] = '<option value="' . ( $size ) . '" ' . ( isset($val[$option_key]['size']) && $val[$option_key]['size'] == $size ? 'selected' : '' ) .'>' . ( $size ) . 'px</option>'; } $html[] = '</select>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-typo-font-weight">'; $html[] = '<span>Font-weight:</span>'; $html[] = '<select name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $option_key ) . '][weight]">'; foreach ( array('normal', 'bold') as $weight ) { $html[] = '<option value="' . ( $weight ) . '" ' . ( isset($val[$option_key]['weight']) && $val[$option_key]['weight'] == $weight ? 'selected' : '' ) .'>' . ( $weight ) . '</option>'; } $html[] = '</select>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-typo-font-color">'; $html[] = '<span>Font-color:</span>'; $html[] = '<input class="WooZoneProviderEbay-wp-color-picker-typo" data-alpha="true" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $option_key ) . '][color]" type="text" value="' . ( isset($val[$option_key]['color']) ? $val[$option_key]['color'] : '#000') . '" />'; $html[] = '<div class="WooZoneProviderEbay-wp-color-picker-wrapper"></div>'; $html[] = '</div>'; if( $val[$option_key]['background-color'] != "" ){ $html[] = '<div class="WooZoneProviderEbay-typo-background-color">'; $html[] = '<span>Background-color:</span>'; $html[] = '<input class="WooZoneProviderEbay-wp-color-picker-typo" data-alpha="true" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $option_key ) . '][background-color]" type="text" value="' . ( isset($val[$option_key]['background-color']) ? $val[$option_key]['background-color'] : '#000') . '" />'; $html[] = '<div class="WooZoneProviderEbay-wp-color-picker-wrapper"></div>'; $html[] = '</div>'; } $html[] = '</fieldset>'; } $html[] = '</div>'; } break; // Basic checkbox input case 'checkbox': $html[] = '<input ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' ' . ($val == true ? 'checked' : '') . ' id="' . esc_attr($elm_id) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" type="checkbox" value="" />'; break; // Basic checkbox input case 'image_radio': if( isset($value['options']) && count($value['options']) > 0 ){ $html[] = '<div class="WooZoneProviderEbay-select-wrapper">'; foreach ($value['options'] as $option_key => $option_value ) { $html[] = '<label ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' class="WooZoneProviderEbay-select-item ' . ($val == $option_key ? 'select-on' : '') . '">'; $html[] = '<span>' . ( $option_value['caption'] ) . '</span>'; $html[] = '<img src="' . ( $option_value['img'] ) . '" />'; $html[] = '<input name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" ' . ($val == $option_key ? 'checked' : '') . ' type="radio" value="' . ( $option_key ) . '" />'; $html[] = '</label>'; } $html[] = '</div>'; } break; // Basic checkbox input case 'html_radio': if( isset($value['options']) && count($value['options']) > 0 ){ $html[] = '<div class="WooZoneProviderEbay-select-wrapper">'; foreach ($value['options'] as $option_key => $option_value ) { $html[] = '<label ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' class="WooZoneProviderEbay-select-item ' . ($val == $option_key ? 'select-on' : '') . '">'; $html[] = '<span>' . ( $option_value['caption'] ) . '</span>'; $html[] = '<div>' . ( $option_value['html'] ) . '</div>'; $html[] = '<input name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" ' . ($val == $option_key ? 'checked' : '') . ' type="radio" value="' . ( $option_key ) . '" />'; $html[] = '</label>'; } $html[] = '</div>'; } break; // Basic upload_image case 'upload_image': $html[] = '<div class="' . ( WooZoneProviderEbay()->alias ) . '-upload-box-wrapper">'; $html[] = '<div class="' . ( WooZoneProviderEbay()->alias ) . '-upload-image">'; if( (int)$val > 0 ){ $html[] = wp_get_attachment_image( $val, array( '75', '75' ) ); } $html[] = '</div>'; $html[] = '<input type="hidden" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" value="' . ( (int)$val ) . '" />'; $html[] = '<a href="#upload" target="blank" class="' . ( WooZoneProviderEbay()->alias ) . '-button ' . ( WooZoneProviderEbay()->alias ) . '-small yellow ' . ( WooZoneProviderEbay()->alias ) . '-btn-upload">Upload Image</a>'; $html[] = '<a href="#upload" target="blank" class="' . ( WooZoneProviderEbay()->alias ) . '-button ' . ( WooZoneProviderEbay()->alias ) . '-small red ' . ( WooZoneProviderEbay()->alias ) . '-btn-upload-delete">Delete Image</a>'; $html[] = '</div>'; break; case 'import': $html[] = '<a href="#" target="blank" data-id="' . ( WooZoneProviderEbay()->get_campaign_id() ) . '" class="' . ( WooZoneProviderEbay()->alias ) . '-button yellow ' . ( WooZoneProviderEbay()->alias ) . '-import-now">Import now</a>'; break; case 'export': $html[] = '<div class="' . ( WooZoneProviderEbay()->alias ) . '-export-settings">'; /* $html[] = '<p>'; $html[] = 'Export campaign setup:'; $html[] = '<select name="' . ( WooZoneProviderEbay()->alias ) . '-campaign-setup"><option value="yes">YES</option><option value="no">NO</option></select>'; $html[] = '</p>'; $html[] = '<p>'; $html[] = 'Export template setup:'; $html[] = '<select name="' . ( WooZoneProviderEbay()->alias ) . '-template-setup"><option value="yes">YES</option><option value="no">NO</option></select>'; $html[] = '</p>'; $html[] = '<p>'; $html[] = 'Export products setup:'; $html[] = '<select name="' . ( WooZoneProviderEbay()->alias ) . '-campaign-products"><option value="yes">YES</option><option value="no">NO</option></select>'; $html[] = '</p>';*/ $html[] = '<a href="#" target="blank" class="' . ( WooZoneProviderEbay()->alias ) . '-button yellow ' . ( WooZoneProviderEbay()->alias ) . '-export-now">Export now</a>'; $html[] = '</div>'; break; // Basic textarea case 'textarea': $cols = "120"; if (isset($value['cols'])) { $cols = $value['cols']; } $height = "style='height:120px;'"; if (isset($value['height'])) { $height = "style='height:{$value['height']};'"; } $html[] = '<textarea id="' . esc_attr($elm_id) . '" ' . $height . ' cols="' . ($cols) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']">' . esc_attr($val) . '</textarea>'; break; // Basic html/text message case 'message': $html[] = '<div class="WooZoneProviderEbay-message WooZoneProviderEbay-' . ($value['status']) . ' ' . ($this->tabs_elements($box, $elm_id)) . '">' . ($value['html']) . '</div>'; break; // Basic html/text message case 'html': $__html = str_replace("#box_id#", $box_id, $value['html']); $__html = str_replace("#option_name#", $box_id, $__html); $__html = str_replace("#option_id#", $elm_id, $__html); $__html = str_replace("#option_value#", $val, $__html); $html[] = $__html; break; // Select Box case 'select': $html[] = '<select ' . (isset($value['force_width']) ? "style='width:" . ($value['force_width']) . "px;'" : '') . ' name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . ']" id="' . esc_attr($elm_id) . '">'; foreach ($value['options'] as $key => $option) { $selected = ''; if ($val != '') { if ($val == $key) { $selected = ' selected="selected"'; } } $html[] = '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>'; } $html[] = '</select>'; break; // multiselect Box case 'multiselect': $html[] = '<select multiple="multiple" size="3" name="[' . ( $box_id ) . '][' . esc_attr( $elm_id ) . '][]" id="' . esc_attr($elm_id) . '">'; if (count($option) > 1) { foreach ($value['options'] as $key => $option) { $selected = ''; if ($val != '') { if (in_array($key, $val)) { $selected = ' selected="selected"'; } } $html[] = '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>'; } } $html[] = '</select>'; break; // Select Box case 'multi_select_box': if( count($value['subfields']) > 0 ){ foreach ($value['subfields'] as $kk => $vv) { $muval = ''; // Set default value to $val if ( isset( $vv['std']) ) { $muval = $vv['std']; } $html[] = '<span>' . ( $vv['title'] ) . ':</span>'; $html[] = '<select ' . ( isset($vv['force_width']) ? "style='width:" . ( $vv['force_width'] ) . "px;'" : '' ) . ' name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][' . ( $kk ) . ']" id="' . esc_attr( $elm_id ) . '[' . ( $kk ) . ']">'; foreach ($vv['options'] as $key2 => $option ) { $selected = ''; //var_dump('<pre>',$val ,'</pre>'); echo __FILE__ . ":" . __LINE__;die . PHP_EOL; if( isset($val[$kk]) && $val[$kk] != '' ) { if ( $val[$kk] == $key2 ) { $selected = ' selected="selected"';} } else if ( $muval != '' ) { if ( $muval == $key2 ) { $selected = ' selected="selected"';} } $html[] = '<option'. $selected .' value="' . esc_attr( $key2 ) . '">' . esc_html( $option ) . '</option>'; } $html[] = '</select> '; } } break; // multiselect Box case 'multiselect_left2right': $available = array(); $selected = array(); foreach ($value['options'] as $key => $option ) { if( $val != '' ) { if ( in_array($key, $val) ) { $selected[] = $key; } } } $available = array_diff(array_keys($value['options']), $selected); $html[] = '<div class="WooZoneProviderEbay-multiselect-half WooZoneProviderEbay-multiselect-available" style="margin-right: 2%;">'; if( isset($value['info']['left']) ){ $html[] = '<h5>' . ( $value['info']['left'] ) . '</h5>'; } $html[] = '<select multiple="multiple" size="' . (isset($value['rows_visible']) ? $value['rows_visible'] : 5) . '" name="[' . ( $box_id ) . '][' . esc_attr( $elm_id ) . '-available][]" id="' . esc_attr( $elm_id ) . '-available" class="multisel_l2r_available">'; if(count($available) > 0){ foreach ($value['options'] as $key => $option ) { if ( !in_array($key, $available) ) continue 1; $html[] = '<option value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>'; } } $html[] = '</select>'; $html[] = '</div>'; $html[] = '<div class="WooZoneProviderEbay-multiselect-half WooZoneProviderEbay-multiselect-selected">'; if( isset($value['info']['right']) ){ $html[] = '<h5>' . ( $value['info']['right'] ) . '</h5>'; } $html[] = '<select multiple="multiple" size="' . (isset($value['rows_visible']) ? $value['rows_visible'] : 5) . '" name="' . ( $box_id ) . '[' . esc_attr( $elm_id ) . '][]" id="' . esc_attr( $elm_id ) . '" class="multisel_l2r_selected">'; if(count($selected) > 0){ foreach ($value['options'] as $key => $option ) { if ( !in_array($key, $selected) ) continue 1; $isselected = ' selected="selected"'; $html[] = '<option'. $isselected .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>'; } } $html[] = '</select>'; $html[] = '</div>'; $html[] = '<div style="clear:both"></div>'; $html[] = '<div class="multisel_l2r_btn" style="">'; $html[] = '<span style="display: inline-block; text-align: center;"><input id="' . esc_attr( $elm_id ) . '-moveright" type="button" value="Move Right" class="moveright WooZoneProviderEbay-button WooZoneProviderEbay-small yellow"></span>'; $html[] = '<span style="display: inline-block; text-align: center;"><input id="' . esc_attr( $elm_id ) . '-moverightall" type="button" value="Move Right All" class="moverightall WooZoneProviderEbay-small WooZoneProviderEbay-button yellow"></span>'; $html[] = '<span style="display: inline-block; margin-left: 60px; text-align: left;"><input id="' . esc_attr( $elm_id ) . '-moveleft" type="button" value="Move Left" class="moveleft WooZoneProviderEbay-button WooZoneProviderEbay-small yellow"></span>'; $html[] = '<span style="display: inline-block; text-align: center;"><input id="' . esc_attr( $elm_id ) . '-moveleftall" type="button" value="Move Left All" class="moveleftall WooZoneProviderEbay-small WooZoneProviderEbay-button yellow"></span>'; $html[] = '</div>'; break; default: wp_die("Invalid filed types!"); } // the element description if (isset($value['desc'])){ $html[] = '<span class="WooZoneProviderEbay-form-note">' . ($value['desc']) . '</span>'; } if (!in_array($value['type'], $noRowElements)) { // close: .WooZoneProviderEbay-form-row $html[] = '</div></div>'; } } // WooZoneProviderEbay-message use for status message, default it's hidden $html[] = '<div class="WooZoneProviderEbay-message" id="WooZoneProviderEbay-status-box" style="display:none;"></div>'; // buttons for saving settings $html[] = '<div class="WooZoneProviderEbay-button-row"> <input type="submit" value="Save Settings" class="WooZoneProviderEbay-button yellow WooZoneProviderEbay-saveOptions" /> </div>'; // close: form $html[] = '</form>'; // return the $html return implode("\n", $html); } } //make Tabs! private function tabs_header( $box ) { $html = array(); // get tabs $tabs = isset($box['tabs']) ? $box['tabs'] : array(); if (is_array($tabs) && count($tabs)>0) { $html[] = '<ul class="WooZoneProviderEbay-settings-tabs">'; foreach ($tabs as $key_tab => $value_tab) { $html[] = '<li><a href="#' . ( $key_tab ) . '">' . ( $value_tab['label'] ) . '</a></li>'; } $html[] = '</ul>'; } // return the $html return implode("\n", $html); } private function tabs_elements($box, $elemKey) { // get tabs $__tabs = isset($box['tabs']) ? $box['tabs'] : array(); $__ret = ''; if (is_array($__tabs) && count($__tabs)>0) { foreach ($__tabs as $tabClass => $tabElements) { $tabElements = $tabElements['elements']; $tabElements = trim($tabElements); $tabElements = array_map('trim', explode(',', $tabElements)); if (in_array($elemKey, $tabElements)) $__ret .= ($tabClass.' '); //support element on multiple tabs! } } return ' '.trim($__ret).' '; } } }