Plugin Directory

Changeset 2671069


Ignore:
Timestamp:
02/02/2022 07:12:48 AM (4 years ago)
Author:
charterpad
Message:

Resolved the issue related to naming convention in the variables to avoid conflicts.

Location:
charterpad-widgets
Files:
9 added
3 edited

Legend:

Unmodified
Added
Removed
  • charterpad-widgets/trunk/charterpad-widgets.php

    r2667932 r2671069  
    55 * Plugin URI: https://app.charterpad.com/widgets
    66 * 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.4
     7 * Version: 1.0.5
    88 * Author: Charterpad
    99 * Author URI: https://charterpad.com/
    1010 **/
    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');
     11add_action('admin_menu', 'cpwidget5236_widget_admin_panel_menu');
     12add_action('wp_head', 'cpwidget5236_wp_head');
     13add_action('wp_footer', 'cpwidget5236_wp_footer');
    1414require(__DIR__ . '/helpers/helpers.php');
    1515
    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");
     16add_shortcode('cp-quote', 'cpwidget5236_generate_shortcode');
     17add_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");
    2424
    2525// 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);
     26wp_register_style('cpwidget5236_admin_style', plugin_dir_url(__FILE__) . 'css/style.css');
     27wp_enqueue_style('cpwidget5236_admin_style', plugin_dir_url(__FILE__) . 'css/style.css');
     28
     29if (!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}
     37if (!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);
    4343        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);
    4545    }
    4646}
    4747
    4848// 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+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iNSIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMTQ0LjEsNzIuN2MxLjMsMS4zLDEuNywzLjMsMSw1LjFsLTM1LjgsODcuOA0KCWMtMC42LDEuNS0yLjMsMi4yLTMuNywxLjZjLTEuNC0wLjYtMi4xLTIuMy0xLjUtMy44TDEzOC45LDc4bC04NC41LDM1LjJjLTEuNSwwLjYtMy4xLTAuMS0zLjctMS42Yy0wLjYtMS41LDAuMS0zLjEsMS41LTMuOA0KCWw4Ni45LTM2LjJDMTQwLjgsNzEsMTQyLjgsNzEuNCwxNDQuMSw3M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LDE2LjMsMzYuOCwzNi40LDM2LjhjMjAuMSwwLDM2LjQtMTYuNSwzNi40LTM2LjhDMjE5LjEsMTksMjAyLjgsMi41LDE4Mi43LDIuNSIvPg0KPC9zdmc+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()
     49if (!function_exists('cpwidget5236_widget_admin_panel_menu')) {
     50    function cpwidget5236_widget_admin_panel_menu()
     51    {
     52        $cpwidget5236_icon = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNC4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyMjEuNiAyMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDIyMS42IDIyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iNSIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMTQ0LjEsNzIuN2MxLjMsMS4zLDEuNywzLjMsMSw1LjFsLTM1LjgsODcuOA0KCWMtMC42LDEuNS0yLjMsMi4yLTMuNywxLjZjLTEuNC0wLjYtM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IuNywyLjUsMTgyLjcsMi41LDE4Mi43LDIuNUwxODIuNywyLjVINzguNmMtMS43LDAtMy4xLDEuNC0zLjEsMy4xYzAsMS43LDEuNCwzLjEsMy4xLDMuMWg4My44Yy05LjcsNi42LTE2LjIsMTcuOC0xNi4yLDMwLjYNCgljMCwyMC4zLDE2LjMsMzYuOCwzNi40LDM2LjhjMjAuMSwwLDM2LjQtMTYuNSwzNi40LTM2LjhDMjE5LjEsMTksMjAyLjgsMi41LDE4Mi43LDIuNSIvPg0KPC9zdmc+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
     57if (!function_exists('cpwidget5236_render_plugin_settings_page')) {
     58    function cpwidget5236_render_plugin_settings_page()
    5959    {
    6060?>
     
    6363            <form action="options.php" method="post">
    6464                <?php
    65                 settings_fields('cpwidget_plugin_options'); // cpwidget_plugin_options = Name of setting group
    66                 do_settings_sections('cpwidget_plugin'); // cpwidget_plugin = name of section
     65                settings_fields('cpwidget5236_plugin_options'); // cpwidget5236_plugin_options = Name of setting group
     66                do_settings_sections('cpwidget5236_plugin'); // cpwidget5236_plugin = name of section
    6767                ?>
    6868                <input name="submit" class="button button-primary" type="submit" value="<?php esc_attr_e('Save Settings'); ?>" />
     
    7373}
    7474
    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');
     75if (!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');
    8080
    8181        // 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');
    8888
    8989        // 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');
    9393
    9494        // 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}
     100if (!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}
     112if (!function_exists('cpwidget5236_plugin_section_text')) {
     113    function cpwidget5236_plugin_section_text()
    114114    {
    115115        echo '<p class="description">Setup your widget and customize the style as per your theme.</p>';
    116116    }
    117117}
    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']) . "' />";
     118if (!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}
     126if (!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}
     133if (!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}
     141if (!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']) . "' />";
    147147        echo "<p class='description'>Set the primary color of the theme as per you website color scheme (Default: #009b91)</p>";
    148148    }
    149149}
    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']) . "' />";
     150if (!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']) . "' />";
    156156        echo "<p class='description'>Set the secondary color of the theme as per you website color scheme (Default: #ff9933)</p>";
    157157    }
    158158}
    159 if (!function_exists('cpwidget_plugin_setting_hide_footer_section')) {
    160     function cpwidget_plugin_setting_hide_footer_section()
    161     {
    162         global $options;
    163         $checked = (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) . "/>";
     159if (!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) . "/>";
    165165        echo "By default, a nice footer section exists with all widgets. If you want to hide the footer section then mark as checked.</label>";
    166166    }
    167167}
    168 if (!function_exists('cpwidget_plugin_setting_availability_enabled')) {
    169     function cpwidget_plugin_setting_availability_enabled()
    170     {
    171         global $options;
    172         $checked = !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         $checked = !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) . "/>";
     168if (!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}
     176if (!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}
     184if (!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) . "/>";
    193193        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) . "/>";
    195195        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) . "/>";
    197197        echo "Round Trip</label>";
    198198        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>";
    199199    }
    200200}
    201 if (!function_exists('cpwidget_plugin_setting_type')) {
    202     function cpwidget_plugin_setting_type()
    203     {
    204         global $options;
     201if (!function_exists('cpwidget5236_plugin_setting_type')) {
     202    function cpwidget5236_plugin_setting_type()
     203    {
     204        global $cpwidget5236_options;
    205205    ?>
    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>
    211211        </select>
    212212        <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>
     
    215215    }
    216216}
    217 if (!function_exists('cpwidget_plugin_theme')) {
    218     function cpwidget_plugin_theme()
    219     {
    220         global $options;
     217if (!function_exists('cpwidget5236_plugin_theme')) {
     218    function cpwidget5236_plugin_theme()
     219    {
     220        global $cpwidget5236_options;
    221221    ?>
    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>
    225225        </select>
    226226        <?php
    227227    }
    228228}
    229 if (!function_exists('cpwidget_generate_shortcode')) {
    230     function cpwidget_generate_shortcode($attributes, $content = null, $shortcode_name)
     229if (!function_exists('cpwidget5236_generate_shortcode')) {
     230    function cpwidget5236_generate_shortcode($cpwidget5236_attributes, $cpwidget5236_content = null, $cpwidget5236_shortcode_name)
    231231    {
    232232        extract(shortcode_atts(array(
    233233            'category' => '',
    234234            'module' => ''
    235         ), $attributes));
     235        ), $cpwidget5236_attributes));
    236236        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;
    239239
    240240        // 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>';
    242242        // 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);
    247247        } 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             $cpTag = 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,
    257257                "onload" => "cpwidgetResizeIFrameToFitContent(this)",
    258258                "frameborder" => "0",
     
    261261            ];
    262262        ?>
    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">
    266266            </iframe>
    267267
     
    271271    }
    272272}
    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'
     273if (!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'
    285285        ];
    286286
    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, ' ');
    297297        } else {
    298298        ?>
    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);
    301301                                } ?>></charterpad-widget>
    302302<?php
  • charterpad-widgets/trunk/helpers/helpers.php

    r2661269 r2671069  
    22
    33// tag with possible indentation
    4 if (!function_exists('cpwidget_tag')) {
    5     function cpwidget_tag($tag, $ltagcontent = "", $openindent = -1, $closeindent = -1)
     4if (!function_exists('cpwidget5236_tag')) {
     5    function cpwidget5236_tag($tag, $ltagcontent = "", $openindent = -1, $closeindent = -1)
    66    {
    7         return cpwidget_attrtag($tag, "", $ltagcontent, $openindent, $closeindent);
     7        return cpwidget5236_attrtag($tag, "", $ltagcontent, $openindent, $closeindent);
    88    }
    99}
     
    1111// an attribute with a given value
    1212// or empty if value is not set
    13 if (!function_exists('cpwidget_attr')) {
    14     function cpwidget_attr($attr, $value)
     13if (!function_exists('cpwidget5236_attr')) {
     14    function cpwidget5236_attr($attr, $value)
    1515    {
    1616        if (empty($value))
     
    2222
    2323// attributed tag, possibly indented
    24 if (!function_exists('cpwidget_attrtag')) {
    25     function cpwidget_attrtag($tag, $attrs, $ltagcontent = "", $openindent = -1, $closeindent = -1)
     24if (!function_exists('cpwidget5236_attrtag')) {
     25    function cpwidget5236_attrtag($tag, $attrs, $ltagcontent = "", $openindent = -1, $closeindent = -1)
    2626    {
    2727        $attributes = '';
    2828        if (is_array($attrs)) {
    2929            foreach ($attrs as $key => $value) {
    30                 $attributes .= cpwidget_attr($key, $value);
     30                $attributes .= cpwidget5236_attr($key, $value);
    3131            }
    3232        } else {
     
    3636        $html = "<" . $tag . ' ' . $attributes;
    3737        if ($openindent >= 0)
    38             $html = "\n" . cpwidget_indentation($openindent) . $html;
     38            $html = "\n" . cpwidget5236_indentation($openindent) . $html;
    3939        if (empty($ltagcontent)) {
    4040            $html .= "/>";
    4141            if ($closeindent >= 0)
    42                 $html .= "\n" . cpwidget_indentation($closeindent);
     42                $html .= "\n" . cpwidget5236_indentation($closeindent);
    4343        } else {
    4444            $html .= ">" . $ltagcontent;
    4545            if ($closeindent >= 0) {
    46                 $html .= "\n" . cpwidget_indentation($closeindent);
     46                $html .= "\n" . cpwidget5236_indentation($closeindent);
    4747            }
    4848            $html .= "</" . $tag . ">";
     
    5353
    5454// indent the given lines
    55 if (!function_exists('cpwidget_indent')) {
    56     function cpwidget_indent($html, $indent)
     55if (!function_exists('cpwidget5236_indent')) {
     56    function cpwidget5236_indent($html, $indent)
    5757    {
    5858        $result = "";
    5959        $lines = explode("\n", $html);
    6060        foreach ($lines as $line) {
    61             $result .= cpwidget_indentation($indent) . $line . "\n";
     61            $result .= cpwidget5236_indentation($indent) . $line . "\n";
    6262        }
    6363        return $result;
     
    6767
    6868// indentation by the given count
    69 if (!function_exists('cpwidget_indentation')) {
    70     function cpwidget_indentation($count)
     69if (!function_exists('cpwidget5236_indentation')) {
     70    function cpwidget5236_indentation($count)
    7171    {
    7272        return str_repeat("  ", $count);
     
    7575
    7676// adds a newline   
    77 if (!function_exists('cpwidget_line')) {
    78     function cpwidget_line($line)
     77if (!function_exists('cpwidget5236_line')) {
     78    function cpwidget5236_line($line)
    7979    {
    8080        return $line . "\n";
  • charterpad-widgets/trunk/readme.txt

    r2667932 r2671069  
    55Requires at least: 3.4
    66Tested up to: 5.9
    7 Stable tag: 1.0.4
     7Stable tag: 1.0.5
    88License: GPLv2 or later
    99Requires PHP: 5.4
     
    4343== Changelog ==
    4444
     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
    4557= 1.0 =
    4658* Inital stable version of the plugin.
    4759
    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 
    6060== Upgrade Notice ==
    6161
    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 =
     63Resolved the issue related to naming convension in the variables to avoid conflicts.
    7064
    7165Copyright 2011-2021 by the contributors
Note: See TracChangeset for help on using the changeset viewer.