Changeset 2671069
- Timestamp:
- 02/02/2022 07:12:48 AM (4 years ago)
- Location:
- charterpad-widgets
- Files:
-
- 9 added
- 3 edited
-
tags/1.0.5 (added)
-
tags/1.0.5/charterpad-widgets.php (added)
-
tags/1.0.5/css (added)
-
tags/1.0.5/css/style.css (added)
-
tags/1.0.5/helpers (added)
-
tags/1.0.5/helpers/helpers.php (added)
-
tags/1.0.5/js (added)
-
tags/1.0.5/js/cp_widget_iframe.js (added)
-
tags/1.0.5/readme.txt (added)
-
trunk/charterpad-widgets.php (modified) (6 diffs)
-
trunk/helpers/helpers.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
charterpad-widgets/trunk/charterpad-widgets.php
r2667932 r2671069 5 5 * Plugin URI: https://app.charterpad.com/widgets 6 6 * Description: The CharterPad website widgets has it all: setup the avaiable widgets to integrate trip avaiability and quote enquiries, adaptive design, mobile responsive, and much more. Get started now! 7 * Version: 1.0. 47 * Version: 1.0.5 8 8 * Author: Charterpad 9 9 * Author URI: https://charterpad.com/ 10 10 **/ 11 add_action('admin_menu', 'cpwidget _widget_admin_panel_menu');12 add_action('wp_head', 'cpwidget _wp_head');13 add_action('wp_footer', 'cpwidget _wp_footer');11 add_action('admin_menu', 'cpwidget5236_widget_admin_panel_menu'); 12 add_action('wp_head', 'cpwidget5236_wp_head'); 13 add_action('wp_footer', 'cpwidget5236_wp_footer'); 14 14 require(__DIR__ . '/helpers/helpers.php'); 15 15 16 add_shortcode('cp-quote', 'cpwidget _generate_shortcode');17 add_shortcode('cp-availability', 'cpwidget _generate_shortcode');18 19 $ options = get_option('cpwidget_plugin_options');20 $ base_url = esc_url('https://app.charterpad.com/');21 $ widgetsList = array('availability', 'quote');22 $ styleSheetCdn = esc_url($base_url . "widgets/css/app.css");23 $ scriptCdn = esc_url($base_url . "widgets/js/app.js");16 add_shortcode('cp-quote', 'cpwidget5236_generate_shortcode'); 17 add_shortcode('cp-availability', 'cpwidget5236_generate_shortcode'); 18 19 $cpwidget5236_options = get_option('cpwidget5236_plugin_options'); 20 $cpwidget5236_base_url = esc_url('https://app.charterpad.com/'); 21 $cpwidget5236_widgetsList = array('availability', 'quote'); 22 $cpwidget5236_styleSheetCdn = esc_url($cpwidget5236_base_url . "widgets/css/app.css"); 23 $cpwidget5236_scriptCdn = esc_url($cpwidget5236_base_url . "widgets/js/app.js"); 24 24 25 25 // Adding admin side styling 26 wp_register_style('cpwidget _admin_style', plugin_dir_url(__FILE__) . 'css/style.css');27 wp_enqueue_style('cpwidget _admin_style', plugin_dir_url(__FILE__) . 'css/style.css');28 29 if (!function_exists('cpwidget _wp_head')) {30 function cpwidget _wp_head()31 { 32 global $ options, $styleSheetCdn;33 if (isset($ options['app_code']) && isset($options['type']) && $options['type'] == 'advanced')34 wp_enqueue_style("charterpad_widget_style", $ styleSheetCdn);35 } 36 } 37 if (!function_exists('cpwidget _wp_footer')) {38 function cpwidget _wp_footer()39 { 40 global $ options, $scriptCdn;41 if (isset($ options['app_code']) && isset($options['type']) && $options['type'] == 'advanced')42 wp_enqueue_script("charterpad_widget_js", $ scriptCdn);26 wp_register_style('cpwidget5236_admin_style', plugin_dir_url(__FILE__) . 'css/style.css'); 27 wp_enqueue_style('cpwidget5236_admin_style', plugin_dir_url(__FILE__) . 'css/style.css'); 28 29 if (!function_exists('cpwidget5236_wp_head')) { 30 function cpwidget5236_wp_head() 31 { 32 global $cpwidget5236_options, $cpwidget5236_styleSheetCdn; 33 if (isset($cpwidget5236_options['app_code']) && isset($cpwidget5236_options['type']) && $cpwidget5236_options['type'] == 'advanced') 34 wp_enqueue_style("charterpad_widget_style", $cpwidget5236_styleSheetCdn); 35 } 36 } 37 if (!function_exists('cpwidget5236_wp_footer')) { 38 function cpwidget5236_wp_footer() 39 { 40 global $cpwidget5236_options, $cpwidget5236_scriptCdn; 41 if (isset($cpwidget5236_options['app_code']) && isset($cpwidget5236_options['type']) && $cpwidget5236_options['type'] == 'advanced') 42 wp_enqueue_script("charterpad_widget_js", $cpwidget5236_scriptCdn); 43 43 else 44 wp_enqueue_script("cpwidget _classic_js", plugin_dir_url(__FILE__) . "js/cp_widget_iframe.js", true, true);44 wp_enqueue_script("cpwidget5236_classic_js", plugin_dir_url(__FILE__) . "js/cp_widget_iframe.js", true, true); 45 45 } 46 46 } 47 47 48 48 // Add cp widget admin menu 49 if (!function_exists('cpwidget _widget_admin_panel_menu')) {50 function cpwidget _widget_admin_panel_menu()51 { 52 $ icon = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNC4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyMjEuNiAyMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDIyMS42IDIyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iNSIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMTQ0LjEsNzIuN2MxLjMsMS4zLDEuNywzLjMsMSw1LjFsLTM1LjgsODcuOA0KCWMtMC42LDEuNS0yLjMsMi4yLTMuNywxLjZj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DIuNQ0KCUMxODIuNywyLjUsMTgyLjcsMi41LDE4Mi43LDIuNUwxODIuNywyLjVINzguNmMtMS43LDAtMy4xLDEuNC0zLjEsMy4xYzAsMS43LDEuNCwzLjEsMy4xLDMuMWg4My44Yy05LjcsNi42LTE2LjIsMTcuOC0xNi4yLDMwLjYNCgljMCwyMC4zLDE2LjMsMzYuOCwzNi40LDM2LjhjMjAuMSwwLDM2LjQtMTYuNSwzNi40LTM2LjhDMjE5LjEsMTksMjAyLjgsMi41LDE4Mi43LDIuNSIvPg0KPC9zdmc+DQo=';53 add_menu_page('CharterPad Widget', 'CharterPad', 'manage_options', 'charterpad-plugin', 'cpwidget _render_plugin_settings_page', 'data:image/svg+xml;base64,' . $icon . ',');54 } 55 } 56 57 if (!function_exists('cpwidget _render_plugin_settings_page')) {58 function cpwidget _render_plugin_settings_page()49 if (!function_exists('cpwidget5236_widget_admin_panel_menu')) { 50 function cpwidget5236_widget_admin_panel_menu() 51 { 52 $cpwidget5236_icon = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNC4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyMjEuNiAyMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDIyMS42IDIyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNGRkZGRkYiIHN0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MwLjItMTMuNy0zMC4yLTMwLjYNCgljMC0xNi45LDEzLjYtMzAuNiwzMC4yLTMwLjZjMTYuNywwLDMwLjIsMTMuNywzMC4yLDMwLjZDMjEyLjksNTYuMSwxOTkuNCw2OS45LDE4Mi43LDY5LjkgTTE4Mi43LDIuNQ0KCUMxODIuNywyLjUsMTgyLjcsMi41LDE4Mi43LDIuNUwxODIuNywyLjVINzguNmMtMS43LDAtMy4xLDEuNC0zLjEsMy4xYzAsMS43LDEuNCwzLjEsMy4xLDMuMWg4My44Yy05LjcsNi42LTE2LjIsMTcuOC0xNi4yLDMwLjYNCgljMCwyMC4zLDE2LjMsMzYuOCwzNi40LDM2LjhjMjAuMSwwLDM2LjQtMTYuNSwzNi40LTM2LjhDMjE5LjEsMTksMjAyLjgsMi41LDE4Mi43LDIuNSIvPg0KPC9zdmc+DQo='; 53 add_menu_page('CharterPad Widget', 'CharterPad', 'manage_options', 'charterpad-plugin', 'cpwidget5236_render_plugin_settings_page', 'data:image/svg+xml;base64,' . $cpwidget5236_icon . ','); 54 } 55 } 56 57 if (!function_exists('cpwidget5236_render_plugin_settings_page')) { 58 function cpwidget5236_render_plugin_settings_page() 59 59 { 60 60 ?> … … 63 63 <form action="options.php" method="post"> 64 64 <?php 65 settings_fields('cpwidget _plugin_options'); // cpwidget_plugin_options = Name of setting group66 do_settings_sections('cpwidget _plugin'); // cpwidget_plugin = name of section65 settings_fields('cpwidget5236_plugin_options'); // cpwidget5236_plugin_options = Name of setting group 66 do_settings_sections('cpwidget5236_plugin'); // cpwidget5236_plugin = name of section 67 67 ?> 68 68 <input name="submit" class="button button-primary" type="submit" value="<?php esc_attr_e('Save Settings'); ?>" /> … … 73 73 } 74 74 75 if (!function_exists('cpwidget _register_settings')) {76 function cpwidget _register_settings()77 { 78 register_setting('cpwidget _plugin_options', 'cpwidget_plugin_options', 'cpwidget_plugin_options_validate');79 add_settings_section('cpwidget _settings', 'General Settings', 'cpwidget_plugin_section_text', 'cpwidget_plugin');75 if (!function_exists('cpwidget5236_register_settings')) { 76 function cpwidget5236_register_settings() 77 { 78 register_setting('cpwidget5236_plugin_options', 'cpwidget5236_plugin_options', 'cpwidget5236_plugin_options_validate'); 79 add_settings_section('cpwidget5236_settings', 'General Settings', 'cpwidget5236_plugin_section_text', 'cpwidget5236_plugin'); 80 80 81 81 // General Settings 82 add_settings_field('cpwidget _plugin_setting_type', 'Integration Method', 'cpwidget_plugin_setting_type', 'cpwidget_plugin', 'cpwidget_settings');83 add_settings_field('cpwidget _plugin_setting_app_code', 'App Code', 'cpwidget_plugin_setting_app_code', 'cpwidget_plugin', 'cpwidget_settings');84 add_settings_field('cpwidget _plugin_setting_primary_color', 'Primary Color', 'cpwidget_plugin_setting_primary_color', 'cpwidget_plugin', 'cpwidget_settings');85 add_settings_field('cpwidget _plugin_setting_secondary_color', 'Secondary Color', 'cpwidget_plugin_setting_secondary_color', 'cpwidget_plugin', 'cpwidget_settings');86 add_settings_field('cpwidget _plugin_theme', 'Theme', 'cpwidget_plugin_theme', 'cpwidget_plugin', 'cpwidget_settings');87 add_settings_field('cpwidget _plugin_setting_hide_footer_section', 'Company Signature', 'cpwidget_plugin_setting_hide_footer_section', 'cpwidget_plugin', 'cpwidget_settings');82 add_settings_field('cpwidget5236_plugin_setting_type', 'Integration Method', 'cpwidget5236_plugin_setting_type', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 83 add_settings_field('cpwidget5236_plugin_setting_app_code', 'App Code', 'cpwidget5236_plugin_setting_app_code', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 84 add_settings_field('cpwidget5236_plugin_setting_primary_color', 'Primary Color', 'cpwidget5236_plugin_setting_primary_color', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 85 add_settings_field('cpwidget5236_plugin_setting_secondary_color', 'Secondary Color', 'cpwidget5236_plugin_setting_secondary_color', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 86 add_settings_field('cpwidget5236_plugin_theme', 'Theme', 'cpwidget5236_plugin_theme', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 87 add_settings_field('cpwidget5236_plugin_setting_hide_footer_section', 'Company Signature', 'cpwidget5236_plugin_setting_hide_footer_section', 'cpwidget5236_plugin', 'cpwidget5236_settings'); 88 88 89 89 // Availability 90 add_settings_section('cpwidget _availability_settings', 'Availability Widget Settings', 'cpwidget_plugin_availability_text', 'cpwidget_plugin');91 add_settings_field('cpwidget _plugin_setting_availability_enabled', 'Enabled', 'cpwidget_plugin_setting_availability_enabled', 'cpwidget_plugin', 'cpwidget_availability_settings');92 add_settings_field('cpwidget _plugin_setting_trip_type', 'Trip Type', 'cpwidget_plugin_setting_trip_type', 'cpwidget_plugin', 'cpwidget_availability_settings');90 add_settings_section('cpwidget5236_availability_settings', 'Availability Widget Settings', 'cpwidget5236_plugin_availability_text', 'cpwidget5236_plugin'); 91 add_settings_field('cpwidget5236_plugin_setting_availability_enabled', 'Enabled', 'cpwidget5236_plugin_setting_availability_enabled', 'cpwidget5236_plugin', 'cpwidget5236_availability_settings'); 92 add_settings_field('cpwidget5236_plugin_setting_trip_type', 'Trip Type', 'cpwidget5236_plugin_setting_trip_type', 'cpwidget5236_plugin', 'cpwidget5236_availability_settings'); 93 93 94 94 // Quote 95 add_settings_section('cpwidget _quote_settings', 'Quote Widget Settings', 'cpwidget_plugin_quote_text', 'cpwidget_plugin');96 add_settings_field('cpwidget _plugin_setting_quote_enabled', 'Enabled', 'cpwidget_plugin_setting_quote_enabled', 'cpwidget_plugin', 'cpwidget_quote_settings');97 } 98 add_action('admin_init', 'cpwidget _register_settings');99 } 100 if (!function_exists('cpwidget _plugin_options_validate')) {101 function cpwidget _plugin_options_validate($input)102 { 103 if (!isset($ input['availability_enabled'])) {104 $ input['availability_enabled'] = 0;105 } 106 if (!isset($ input['quote_enabled'])) {107 $ input['quote_enabled'] = 0;108 } 109 return $ input;110 } 111 } 112 if (!function_exists('cpwidget _plugin_section_text')) {113 function cpwidget _plugin_section_text()95 add_settings_section('cpwidget5236_quote_settings', 'Quote Widget Settings', 'cpwidget5236_plugin_quote_text', 'cpwidget5236_plugin'); 96 add_settings_field('cpwidget5236_plugin_setting_quote_enabled', 'Enabled', 'cpwidget5236_plugin_setting_quote_enabled', 'cpwidget5236_plugin', 'cpwidget5236_quote_settings'); 97 } 98 add_action('admin_init', 'cpwidget5236_register_settings'); 99 } 100 if (!function_exists('cpwidget5236_plugin_options_validate')) { 101 function cpwidget5236_plugin_options_validate($cpwidget5236_input) 102 { 103 if (!isset($cpwidget5236_input['availability_enabled'])) { 104 $cpwidget5236_input['availability_enabled'] = 0; 105 } 106 if (!isset($cpwidget5236_input['quote_enabled'])) { 107 $cpwidget5236_input['quote_enabled'] = 0; 108 } 109 return $cpwidget5236_input; 110 } 111 } 112 if (!function_exists('cpwidget5236_plugin_section_text')) { 113 function cpwidget5236_plugin_section_text() 114 114 { 115 115 echo '<p class="description">Setup your widget and customize the style as per your theme.</p>'; 116 116 } 117 117 } 118 if (!function_exists('cpwidget _plugin_availability_text')) {119 120 function cpwidget _plugin_availability_text()121 { 122 global $ base_url;123 echo '<p class="description">The specified widget will be used to check the trip availability with advanced search filters. You will receive the customer enquiries as per their prefrences. Use the shortcode <code>[cp-availability]</code></p> <img src=" ' . $ base_url . 'images/widgets/availability.png" height="400"></img>';124 } 125 } 126 if (!function_exists('cpwidget _plugin_quote_text')) {127 function cpwidget _plugin_quote_text()128 { 129 global $ base_url;130 echo '<p class="description">The specified widget will be used as a simple enquiry form. Use the shortcode <code>[cp-quote]</code></p><img src="' . esc_attr($ base_url) . 'images/widgets/quote.png" height="400"></img>';131 } 132 } 133 if (!function_exists('cpwidget _plugin_setting_app_code')) {134 function cpwidget _plugin_setting_app_code()135 { 136 global $ options, $base_url;137 echo "<input required class='cpw-app-code-input' id='cpwidget _plugin_setting_app_code' name='cpwidget_plugin_options[app_code]' type='text' value='" . esc_attr($options['app_code']) . "' />";138 echo "<p class='description'>Get app code from your CharterPad account. <a href='" . esc_attr($ base_url) . "app-widgets' target='_blank'>Get App Code</a></p>";139 } 140 } 141 if (!function_exists('cpwidget _plugin_setting_primary_color')) {142 function cpwidget _plugin_setting_primary_color()143 { 144 global $ options;145 if (!isset($ options['primary_color'])) $options['primary_color'] = '#009b91';146 echo "<input required id='cpwidget _plugin_setting_primary_color' name='cpwidget_plugin_options[primary_color]' type='color' placeholder='#009b91' value='" . esc_attr($options['primary_color']) . "' />";118 if (!function_exists('cpwidget5236_plugin_availability_text')) { 119 120 function cpwidget5236_plugin_availability_text() 121 { 122 global $cpwidget5236_base_url; 123 echo '<p class="description">The specified widget will be used to check the trip availability with advanced search filters. You will receive the customer enquiries as per their prefrences. Use the shortcode <code>[cp-availability]</code></p> <img src=" ' . $cpwidget5236_base_url . 'images/widgets/availability.png" height="400"></img>'; 124 } 125 } 126 if (!function_exists('cpwidget5236_plugin_quote_text')) { 127 function cpwidget5236_plugin_quote_text() 128 { 129 global $cpwidget5236_base_url; 130 echo '<p class="description">The specified widget will be used as a simple enquiry form. Use the shortcode <code>[cp-quote]</code></p><img src="' . esc_attr($cpwidget5236_base_url) . 'images/widgets/quote.png" height="400"></img>'; 131 } 132 } 133 if (!function_exists('cpwidget5236_plugin_setting_app_code')) { 134 function cpwidget5236_plugin_setting_app_code() 135 { 136 global $cpwidget5236_options, $cpwidget5236_base_url; 137 echo "<input required class='cpw-app-code-input' id='cpwidget5236_plugin_setting_app_code' name='cpwidget5236_plugin_options[app_code]' type='text' value='" . esc_attr($cpwidget5236_options['app_code']) . "' />"; 138 echo "<p class='description'>Get app code from your CharterPad account. <a href='" . esc_attr($cpwidget5236_base_url) . "app-widgets' target='_blank'>Get App Code</a></p>"; 139 } 140 } 141 if (!function_exists('cpwidget5236_plugin_setting_primary_color')) { 142 function cpwidget5236_plugin_setting_primary_color() 143 { 144 global $cpwidget5236_options; 145 if (!isset($cpwidget5236_options['primary_color'])) $cpwidget5236_options['primary_color'] = '#009b91'; 146 echo "<input required id='cpwidget5236_plugin_setting_primary_color' name='cpwidget5236_plugin_options[primary_color]' type='color' placeholder='#009b91' value='" . esc_attr($cpwidget5236_options['primary_color']) . "' />"; 147 147 echo "<p class='description'>Set the primary color of the theme as per you website color scheme (Default: #009b91)</p>"; 148 148 } 149 149 } 150 if (!function_exists('cpwidget _plugin_setting_secondary_color')) {151 function cpwidget _plugin_setting_secondary_color()152 { 153 global $ options;154 if (!isset($ options['secondary_color'])) $options['secondary_color'] = '#ff9933';155 echo "<input required id='cpwidget _plugin_setting_secondary_color' name='cpwidget_plugin_options[secondary_color]' type='color' placeholder='#ff9933' value='" . esc_attr($options['secondary_color']) . "' />";150 if (!function_exists('cpwidget5236_plugin_setting_secondary_color')) { 151 function cpwidget5236_plugin_setting_secondary_color() 152 { 153 global $cpwidget5236_options; 154 if (!isset($cpwidget5236_options['secondary_color'])) $cpwidget5236_options['secondary_color'] = '#ff9933'; 155 echo "<input required id='cpwidget5236_plugin_setting_secondary_color' name='cpwidget5236_plugin_options[secondary_color]' type='color' placeholder='#ff9933' value='" . esc_attr($cpwidget5236_options['secondary_color']) . "' />"; 156 156 echo "<p class='description'>Set the secondary color of the theme as per you website color scheme (Default: #ff9933)</p>"; 157 157 } 158 158 } 159 if (!function_exists('cpwidget _plugin_setting_hide_footer_section')) {160 function cpwidget _plugin_setting_hide_footer_section()161 { 162 global $ options;163 $c hecked = (isset($options['hide_footer_section']) && $options['hide_footer_section'] == 1) ? 1 : 0;164 echo "<label for='cpwidget _plugin_setting_hide_footer_section'><input id='cpwidget_plugin_setting_hide_footer_section' name='cpwidget_plugin_options[hide_footer_section]' type='checkbox' value='1' " . checked(1, $checked, false) . "/>";159 if (!function_exists('cpwidget5236_plugin_setting_hide_footer_section')) { 160 function cpwidget5236_plugin_setting_hide_footer_section() 161 { 162 global $cpwidget5236_options; 163 $cpwidget5236_checked = (isset($cpwidget5236_options['hide_footer_section']) && $cpwidget5236_options['hide_footer_section'] == 1) ? 1 : 0; 164 echo "<label for='cpwidget5236_plugin_setting_hide_footer_section'><input id='cpwidget5236_plugin_setting_hide_footer_section' name='cpwidget5236_plugin_options[hide_footer_section]' type='checkbox' value='1' " . checked(1, $cpwidget5236_checked, false) . "/>"; 165 165 echo "By default, a nice footer section exists with all widgets. If you want to hide the footer section then mark as checked.</label>"; 166 166 } 167 167 } 168 if (!function_exists('cpwidget _plugin_setting_availability_enabled')) {169 function cpwidget _plugin_setting_availability_enabled()170 { 171 global $ options;172 $c hecked = !isset($options['availability_enabled']) ? 1 : $options['availability_enabled'];173 echo "<input id='cpwidget _plugin_setting_availability_enabled' name='cpwidget_plugin_options[availability_enabled]' type='checkbox' value='1' " . checked(1, $checked, false) . "/>";174 } 175 } 176 if (!function_exists('cpwidget _plugin_setting_quote_enabled')) {177 function cpwidget _plugin_setting_quote_enabled()178 { 179 global $ options;180 $c hecked = !isset($options['quote_enabled']) ? 1 : $options['quote_enabled'];181 echo "<input id='cpwidget _plugin_setting_quote_enabled' name='cpwidget_plugin_options[quote_enabled]' type='checkbox' value='1' " . checked(1, $checked, false) . "/>";182 } 183 } 184 if (!function_exists('cpwidget _plugin_setting_trip_type')) {185 186 function cpwidget _plugin_setting_trip_type()187 { 188 global $ options;189 $ empty_leg = (isset($options['empty_leg']) && $options['empty_leg'] == 1) ? 1 : 0;190 $ one_way = (isset($options['one_way']) && $options['one_way'] == 1) ? 1 : 0;191 $ round_trip = (isset($options['round_trip']) && $options['round_trip'] == 1) ? 1 : 0;192 echo "<label class='cpw-mr-20' for='cpwidget _plugin_setting_empty_leg'><input id='cpwidget_plugin_setting_empty_leg' name='cpwidget_plugin_options[empty_leg]' type='checkbox' value='1' " . checked(1, $empty_leg, false) . "/>";168 if (!function_exists('cpwidget5236_plugin_setting_availability_enabled')) { 169 function cpwidget5236_plugin_setting_availability_enabled() 170 { 171 global $cpwidget5236_options; 172 $cpwidget5236_checked = !isset($cpwidget5236_options['availability_enabled']) ? 1 : $cpwidget5236_options['availability_enabled']; 173 echo "<input id='cpwidget5236_plugin_setting_availability_enabled' name='cpwidget5236_plugin_options[availability_enabled]' type='checkbox' value='1' " . checked(1, $cpwidget5236_checked, false) . "/>"; 174 } 175 } 176 if (!function_exists('cpwidget5236_plugin_setting_quote_enabled')) { 177 function cpwidget5236_plugin_setting_quote_enabled() 178 { 179 global $cpwidget5236_options; 180 $cpwidget5236_checked = !isset($cpwidget5236_options['quote_enabled']) ? 1 : $cpwidget5236_options['quote_enabled']; 181 echo "<input id='cpwidget5236_plugin_setting_quote_enabled' name='cpwidget5236_plugin_options[quote_enabled]' type='checkbox' value='1' " . checked(1, $cpwidget5236_checked, false) . "/>"; 182 } 183 } 184 if (!function_exists('cpwidget5236_plugin_setting_trip_type')) { 185 186 function cpwidget5236_plugin_setting_trip_type() 187 { 188 global $cpwidget5236_options; 189 $cpwidget5236_empty_leg = (isset($cpwidget5236_options['empty_leg']) && $cpwidget5236_options['empty_leg'] == 1) ? 1 : 0; 190 $cpwidget5236_one_way = (isset($cpwidget5236_options['one_way']) && $cpwidget5236_options['one_way'] == 1) ? 1 : 0; 191 $cpwidget5236_round_trip = (isset($cpwidget5236_options['round_trip']) && $cpwidget5236_options['round_trip'] == 1) ? 1 : 0; 192 echo "<label class='cpw-mr-20' for='cpwidget5236_plugin_setting_empty_leg'><input id='cpwidget5236_plugin_setting_empty_leg' name='cpwidget5236_plugin_options[empty_leg]' type='checkbox' value='1' " . checked(1, $cpwidget5236_empty_leg, false) . "/>"; 193 193 echo "Empty Leg</label>"; 194 echo "<label class='cpw-mr-20' for='cpwidget _plugin_setting_one_way'><input id='cpwidget_plugin_setting_one_way' name='cpwidget_plugin_options[one_way]' type='checkbox' value='1' " . checked(1, $one_way, false) . "/>";194 echo "<label class='cpw-mr-20' for='cpwidget5236_plugin_setting_one_way'><input id='cpwidget5236_plugin_setting_one_way' name='cpwidget5236_plugin_options[one_way]' type='checkbox' value='1' " . checked(1, $cpwidget5236_one_way, false) . "/>"; 195 195 echo "One Way</label>"; 196 echo "<label class='cpw-mr-20' for='cpwidget _plugin_setting_round_trip'><input id='cpwidget_plugin_setting_round_trip' name='cpwidget_plugin_options[round_trip]' type='checkbox' value='1' " . checked(1, $round_trip, false) . "/>";196 echo "<label class='cpw-mr-20' for='cpwidget5236_plugin_setting_round_trip'><input id='cpwidget5236_plugin_setting_round_trip' name='cpwidget5236_plugin_options[round_trip]' type='checkbox' value='1' " . checked(1, $cpwidget5236_round_trip, false) . "/>"; 197 197 echo "Round Trip</label>"; 198 198 echo "<p class='description'>The above types are available as filters. You may limit in your widget. By default all options will be considered.</p>"; 199 199 } 200 200 } 201 if (!function_exists('cpwidget _plugin_setting_type')) {202 function cpwidget _plugin_setting_type()203 { 204 global $ options;201 if (!function_exists('cpwidget5236_plugin_setting_type')) { 202 function cpwidget5236_plugin_setting_type() 203 { 204 global $cpwidget5236_options; 205 205 ?> 206 <select name="cpwidget _plugin_options[type]" id="cpwidget_plugin_setting_type">207 <?php $ selected = (isset($options['type']) && $options['type'] === 'advanced') ? 'selected' : ''; ?>208 <option value="advanced" <?php echo $ selected; ?>>Advanced (Recommended)</option>209 <?php $ selected = (isset($options['type']) && $options['type'] === 'classic') ? 'selected' : ''; ?>210 <option value="classic" <?php echo $ selected; ?>>Classic</option>206 <select name="cpwidget5236_plugin_options[type]" id="cpwidget5236_plugin_setting_type"> 207 <?php $cpwidget5236_selected = (isset($cpwidget5236_options['type']) && $cpwidget5236_options['type'] === 'advanced') ? 'selected' : ''; ?> 208 <option value="advanced" <?php echo $cpwidget5236_selected; ?>>Advanced (Recommended)</option> 209 <?php $cpwidget5236_selected = (isset($cpwidget5236_options['type']) && $cpwidget5236_options['type'] === 'classic') ? 'selected' : ''; ?> 210 <option value="classic" <?php echo $cpwidget5236_selected; ?>>Classic</option> 211 211 </select> 212 212 <p class="description"><b>Advanced: </b> You will be able to override the style on the widget elements. You may manage the font-fmily, size color and much more.</p> … … 215 215 } 216 216 } 217 if (!function_exists('cpwidget _plugin_theme')) {218 function cpwidget _plugin_theme()219 { 220 global $ options;217 if (!function_exists('cpwidget5236_plugin_theme')) { 218 function cpwidget5236_plugin_theme() 219 { 220 global $cpwidget5236_options; 221 221 ?> 222 <select name="cpwidget _plugin_options[theme]" id="cpwidget_plugin_theme">223 <option value="light" <?php echo (isset($ options['theme']) && $options['theme'] === 'light') ? 'selected' : ''; ?>>Light</option>224 <option value="dark" <?php echo (isset($ options['theme']) && $options['theme'] === 'dark') ? 'selected' : ''; ?>>Dark</option>222 <select name="cpwidget5236_plugin_options[theme]" id="cpwidget5236_plugin_theme"> 223 <option value="light" <?php echo (isset($cpwidget5236_options['theme']) && $cpwidget5236_options['theme'] === 'light') ? 'selected' : ''; ?>>Light</option> 224 <option value="dark" <?php echo (isset($cpwidget5236_options['theme']) && $cpwidget5236_options['theme'] === 'dark') ? 'selected' : ''; ?>>Dark</option> 225 225 </select> 226 226 <?php 227 227 } 228 228 } 229 if (!function_exists('cpwidget _generate_shortcode')) {230 function cpwidget _generate_shortcode($attributes, $content = null, $shortcode_name)229 if (!function_exists('cpwidget5236_generate_shortcode')) { 230 function cpwidget5236_generate_shortcode($cpwidget5236_attributes, $cpwidget5236_content = null, $cpwidget5236_shortcode_name) 231 231 { 232 232 extract(shortcode_atts(array( 233 233 'category' => '', 234 234 'module' => '' 235 ), $ attributes));235 ), $cpwidget5236_attributes)); 236 236 ob_start(); 237 $ widget = str_replace('cp-', '', $shortcode_name);238 global $ options, $styleSheetCdn, $scriptCdn;237 $cpwidget5236_widget = str_replace('cp-', '', $cpwidget5236_shortcode_name); 238 global $cpwidget5236_options, $cpwidget5236_styleSheetCdn, $cpwidget5236_scriptCdn; 239 239 240 240 // Check either App code is defined 241 if (!isset($ options['app_code'])) return '<p>App code is not defined yet please setup CharterPad widget plugin.</p>';241 if (!isset($cpwidget5236_options['app_code'])) return '<p>App code is not defined yet please setup CharterPad widget plugin.</p>'; 242 242 // Check if enabled 243 if (isset($ options[$widget . '_enabled']) && $options[$widget . '_enabled'] == 0) return false;244 245 if (isset($ options['type']) && $options['type'] == 'advanced') {246 cpwidget _get_charterpad_widget_tag($widget);243 if (isset($cpwidget5236_options[$cpwidget5236_widget . '_enabled']) && $cpwidget5236_options[$cpwidget5236_widget . '_enabled'] == 0) return false; 244 245 if (isset($cpwidget5236_options['type']) && $cpwidget5236_options['type'] == 'advanced') { 246 cpwidget5236_get_charterpad_widget_tag($cpwidget5236_widget); 247 247 } else { 248 $ style = cpwidget_attrtag('link', "href='" . $styleSheetCdn . "' rel='stylesheet'");249 $ script = cpwidget_attrtag('script', "src='" . $scriptCdn . "' type='text/javascript'", ' ');250 251 $ head = cpwidget_attrtag('head', '', cpwidget_attrtag('meta', ['charset' => 'utf-8']) . cpwidget_attrtag("meta", "http-equiv='X-UA-Compatible' content='IE=edge'") . cpwidget_attrtag("meta", "name='viewport' content='width=device-width,initial-scale=1'"));252 $cp Tag = str_replace('"', "'", cpwidget_get_charterpad_widget_tag($widget, false));253 $ body = (cpwidget_attrtag('body', "style='margin: 0px'", $style . $cpTag . $script));254 255 $ iframeAttrs = [256 "id" => "charterpad-iframe-" . $ widget,248 $cpwidget5236_style = cpwidget5236_attrtag('link', "href='" . $cpwidget5236_styleSheetCdn . "' rel='stylesheet'"); 249 $cpwidget5236_script = cpwidget5236_attrtag('script', "src='" . $cpwidget5236_scriptCdn . "' type='text/javascript'", ' '); 250 251 $cpwidget5236_head = cpwidget5236_attrtag('head', '', cpwidget5236_attrtag('meta', ['charset' => 'utf-8']) . cpwidget5236_attrtag("meta", "http-equiv='X-UA-Compatible' content='IE=edge'") . cpwidget5236_attrtag("meta", "name='viewport' content='width=device-width,initial-scale=1'")); 252 $cpwidget5236_cpTag = str_replace('"', "'", cpwidget5236_get_charterpad_widget_tag($cpwidget5236_widget, false)); 253 $cpwidget5236_body = (cpwidget5236_attrtag('body', "style='margin: 0px'", $cpwidget5236_style . $cpwidget5236_cpTag . $cpwidget5236_script)); 254 255 $cpwidget5236_iframeAttrs = [ 256 "id" => "charterpad-iframe-" . $cpwidget5236_widget, 257 257 "onload" => "cpwidgetResizeIFrameToFitContent(this)", 258 258 "frameborder" => "0", … … 261 261 ]; 262 262 ?> 263 <iframe <?php foreach ($ iframeAttrs as $attrkey => $attrVal) {264 echo esc_attr(' ' . $ attrkey . '=' . $attrVal);265 } ?> src="javascript: window.frameElement.getAttribute('srcdoc')" srcdoc="<?php echo esc_attr($ head . $body); ?>" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-presentation allow-top-navigation">263 <iframe <?php foreach ($cpwidget5236_iframeAttrs as $cpwidget5236_attrkey => $cpwidget5236_attrVal) { 264 echo esc_attr(' ' . $cpwidget5236_attrkey . '=' . $cpwidget5236_attrVal); 265 } ?> src="javascript: window.frameElement.getAttribute('srcdoc')" srcdoc="<?php echo esc_attr($cpwidget5236_head . $cpwidget5236_body); ?>" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-presentation allow-top-navigation"> 266 266 </iframe> 267 267 … … 271 271 } 272 272 } 273 if (!function_exists('cpwidget _get_charterpad_widget_tag')) {274 function cpwidget _get_charterpad_widget_tag($widget, $printTag = true)275 { 276 global $ options;277 278 $ attributes = [279 "app-code" => $ options['app_code'],280 "app-widget" => $ widget,281 "hide-footer" => (isset($ options['hide_footer_section']) && $options['hide_footer_section'] == 1) ? 'true' : 'false',282 "app-theme-primary" => $ options['primary_color'],283 "app-theme-secondary" => $ options['secondary_color'],284 "app-theme" => isset($ options['theme']) ? $options['theme'] : 'light'273 if (!function_exists('cpwidget5236_get_charterpad_widget_tag')) { 274 function cpwidget5236_get_charterpad_widget_tag($cpwidget5236_widget, $cpwidget5236_printTag = true) 275 { 276 global $cpwidget5236_options; 277 278 $cpwidget5236_attributes = [ 279 "app-code" => $cpwidget5236_options['app_code'], 280 "app-widget" => $cpwidget5236_widget, 281 "hide-footer" => (isset($cpwidget5236_options['hide_footer_section']) && $cpwidget5236_options['hide_footer_section'] == 1) ? 'true' : 'false', 282 "app-theme-primary" => $cpwidget5236_options['primary_color'], 283 "app-theme-secondary" => $cpwidget5236_options['secondary_color'], 284 "app-theme" => isset($cpwidget5236_options['theme']) ? $cpwidget5236_options['theme'] : 'light' 285 285 ]; 286 286 287 if ($ widget == 'availability') {288 $ widget_types = [];289 if (isset($ options['empty_leg'])) array_push($widget_types, 'empty-leg');290 if (isset($ options['one_way'])) array_push($widget_types, 'one-way');291 if (isset($ options['round_trip'])) array_push($widget_types, 'round-trip');292 293 if (count($ widget_types)) $attributes['app-widget-types'] = implode(',', $widget_types);294 } 295 if (!$ printTag) {296 return cpwidget _attrtag('charterpad-widget', $attributes, ' ');287 if ($cpwidget5236_widget == 'availability') { 288 $cpwidget5236_widget_types = []; 289 if (isset($cpwidget5236_options['empty_leg'])) array_push($cpwidget5236_widget_types, 'empty-leg'); 290 if (isset($cpwidget5236_options['one_way'])) array_push($cpwidget5236_widget_types, 'one-way'); 291 if (isset($cpwidget5236_options['round_trip'])) array_push($cpwidget5236_widget_types, 'round-trip'); 292 293 if (count($cpwidget5236_widget_types)) $cpwidget5236_attributes['app-widget-types'] = implode(',', $cpwidget5236_widget_types); 294 } 295 if (!$cpwidget5236_printTag) { 296 return cpwidget5236_attrtag('charterpad-widget', $cpwidget5236_attributes, ' '); 297 297 } else { 298 298 ?> 299 <charterpad-widget <?php foreach ($ attributes as $attrKey => $attrVal) {300 echo esc_attr(' ' . $ attrKey . '=' . $attrVal);299 <charterpad-widget <?php foreach ($cpwidget5236_attributes as $cpwidget5236_attrKey => $cpwidget5236_attrVal) { 300 echo esc_attr(' ' . $cpwidget5236_attrKey . '=' . $cpwidget5236_attrVal); 301 301 } ?>></charterpad-widget> 302 302 <?php -
charterpad-widgets/trunk/helpers/helpers.php
r2661269 r2671069 2 2 3 3 // tag with possible indentation 4 if (!function_exists('cpwidget _tag')) {5 function cpwidget _tag($tag, $ltagcontent = "", $openindent = -1, $closeindent = -1)4 if (!function_exists('cpwidget5236_tag')) { 5 function cpwidget5236_tag($tag, $ltagcontent = "", $openindent = -1, $closeindent = -1) 6 6 { 7 return cpwidget _attrtag($tag, "", $ltagcontent, $openindent, $closeindent);7 return cpwidget5236_attrtag($tag, "", $ltagcontent, $openindent, $closeindent); 8 8 } 9 9 } … … 11 11 // an attribute with a given value 12 12 // or empty if value is not set 13 if (!function_exists('cpwidget _attr')) {14 function cpwidget _attr($attr, $value)13 if (!function_exists('cpwidget5236_attr')) { 14 function cpwidget5236_attr($attr, $value) 15 15 { 16 16 if (empty($value)) … … 22 22 23 23 // attributed tag, possibly indented 24 if (!function_exists('cpwidget _attrtag')) {25 function cpwidget _attrtag($tag, $attrs, $ltagcontent = "", $openindent = -1, $closeindent = -1)24 if (!function_exists('cpwidget5236_attrtag')) { 25 function cpwidget5236_attrtag($tag, $attrs, $ltagcontent = "", $openindent = -1, $closeindent = -1) 26 26 { 27 27 $attributes = ''; 28 28 if (is_array($attrs)) { 29 29 foreach ($attrs as $key => $value) { 30 $attributes .= cpwidget _attr($key, $value);30 $attributes .= cpwidget5236_attr($key, $value); 31 31 } 32 32 } else { … … 36 36 $html = "<" . $tag . ' ' . $attributes; 37 37 if ($openindent >= 0) 38 $html = "\n" . cpwidget _indentation($openindent) . $html;38 $html = "\n" . cpwidget5236_indentation($openindent) . $html; 39 39 if (empty($ltagcontent)) { 40 40 $html .= "/>"; 41 41 if ($closeindent >= 0) 42 $html .= "\n" . cpwidget _indentation($closeindent);42 $html .= "\n" . cpwidget5236_indentation($closeindent); 43 43 } else { 44 44 $html .= ">" . $ltagcontent; 45 45 if ($closeindent >= 0) { 46 $html .= "\n" . cpwidget _indentation($closeindent);46 $html .= "\n" . cpwidget5236_indentation($closeindent); 47 47 } 48 48 $html .= "</" . $tag . ">"; … … 53 53 54 54 // indent the given lines 55 if (!function_exists('cpwidget _indent')) {56 function cpwidget _indent($html, $indent)55 if (!function_exists('cpwidget5236_indent')) { 56 function cpwidget5236_indent($html, $indent) 57 57 { 58 58 $result = ""; 59 59 $lines = explode("\n", $html); 60 60 foreach ($lines as $line) { 61 $result .= cpwidget _indentation($indent) . $line . "\n";61 $result .= cpwidget5236_indentation($indent) . $line . "\n"; 62 62 } 63 63 return $result; … … 67 67 68 68 // indentation by the given count 69 if (!function_exists('cpwidget _indentation')) {70 function cpwidget _indentation($count)69 if (!function_exists('cpwidget5236_indentation')) { 70 function cpwidget5236_indentation($count) 71 71 { 72 72 return str_repeat(" ", $count); … … 75 75 76 76 // adds a newline 77 if (!function_exists('cpwidget _line')) {78 function cpwidget _line($line)77 if (!function_exists('cpwidget5236_line')) { 78 function cpwidget5236_line($line) 79 79 { 80 80 return $line . "\n"; -
charterpad-widgets/trunk/readme.txt
r2667932 r2671069 5 5 Requires at least: 3.4 6 6 Tested up to: 5.9 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 License: GPLv2 or later 9 9 Requires PHP: 5.4 … … 43 43 == Changelog == 44 44 45 = 1.0.5 = 46 * Resolved the issue related to naming convension in the variables to avoid conflicts. 47 48 = 1.0.3 = 49 * Issue fixed related to widget apperance. 50 51 = 1.0.2 = 52 * Tested the compatilibity of plugin with latest version of WordPress. 53 54 = 1.0.1 = 55 * Fixed the issue related to widget shortcode output as it was adding at the top of page content before. 56 45 57 = 1.0 = 46 58 * Inital stable version of the plugin. 47 59 48 = 1.0.1 =49 * Fixed the issue related to widget shortcode output as it was adding at the top of page content before.50 51 = 1.0.2 =52 * Tested the compatilibity of plugin with latest version of WordPress.53 54 = 1.0.3 =55 * Issue fixed related to widget apperance.56 57 = 1.0.4 =58 * Added the installlation guide video.59 60 60 == Upgrade Notice == 61 61 62 = 1.0 = 63 The initial stable version comes with avaiability and quote widgets and admin related settings. 64 65 = 1.0.1 = 66 Fixed the issue related to widget shortcode output as it was adding at the top of page content before. 67 68 = 1.0.2 = 69 Tested the compatilibity of plugin with latest version of WordPress. 62 = 1.0.5 = 63 Resolved the issue related to naming convension in the variables to avoid conflicts. 70 64 71 65 Copyright 2011-2021 by the contributors
Note: See TracChangeset
for help on using the changeset viewer.