Plugin Directory

Changeset 3222227


Ignore:
Timestamp:
01/14/2025 11:56:48 AM (13 months ago)
Author:
powr
Message:

Add changes to powr-popup.php

Location:
powr-popup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • powr-popup/tags/2.0.0/powr-popup.php

    r3222126 r3222227  
    2727// If this file is called directly, abort.
    2828if (! defined('WPINC')) {
    29     die;
     29    die;
    3030}
    3131
     
    3333
    3434if (!function_exists('powrio_popup_menu')) {
    35     function powrio_popup_menu()
    36     {
    37         if (empty($GLOBALS['admin_page_hooks']['powrio-plugins']))
    38             add_menu_page(
    39                 'Popup',
    40                 'Popup',
    41                 'manage_options',
    42                 'powrio-popup',
    43                 'powrio_powr_popup_options',
    44                 plugins_url('/src/icons/powr-icon.png', __FILE__)
    45             );
    46     }
     35    function powrio_popup_menu()
     36    {
     37        if (empty($GLOBALS['admin_page_hooks']['powrio-plugins'])) {
     38            add_menu_page(
     39                'Popup',
     40                'Popup',
     41                'manage_options',
     42                'powrio-popup',
     43                'powrio_powr_popup_options',
     44                plugins_url('/src/icons/powr-icon.png', __FILE__)
     45            );
     46        }
     47    }
    4748}
    4849
    4950if (!function_exists('powrio_powr_base_url')) {
    50     function powrio_powr_base_url()
    51     {
    52         return 'www.powr-staging.io';
    53     }
     51    function powrio_powr_base_url()
     52    {
     53        return 'www.powr.io';
     54    }
    5455}
    5556
    5657if (!function_exists('powrio_render_iframe')) {
    57     function powrio_render_iframe($url)
    58     {
    59         echo ('<iframe src="' . esc_url($url) . '" frameborder="0" scrolling="yes" seamless="seamless" style="background: white;display:block; width: calc(100% - -20px);; height: calc(100vh - 35px); margin-left: -20px;"></iframe>');
    60     }
     58    function powrio_render_iframe($url)
     59    {
     60        echo ('<iframe src="' . esc_url($url) . '" frameborder="0" scrolling="yes" seamless="seamless" style="background: white;display:block; width: calc(100% - -20px);; height: calc(100vh - 35px); margin-left: -20px;"></iframe>');
     61    }
    6162}
    6263
    6364if (!function_exists('powrio_powr_popup_options')) {
    64     function powrio_powr_popup_options()
    65     {
    66         $current_user = wp_get_current_user();
    67         powrio_render_iframe('https://' . powrio_powr_base_url() . '/api/woo_commerce/auth/apps/popup?email='.$current_user->user_email.'&platform=woocommerce&done=1');
    68     }
     65    function powrio_powr_popup_options()
     66    {
     67        $current_user = wp_get_current_user();
     68        powrio_render_iframe('https://' . powrio_powr_base_url() . '/api/woo_commerce/auth/apps/popup?email=' . $current_user->user_email . '&platform=woocommerce&done=1');
     69    }
    6970}
    7071
    7172add_action('admin_menu', 'powrio_popup_menu');
    72 ?>
     73
     74
     75if (!function_exists('powrio_log_message')) {
     76    function powrio_log_message($message)
     77    {
     78        if (defined('WP_DEBUG') && WP_DEBUG) {
     79            error_log('[POWr Popup] ' . $message);
     80        }
     81    }
     82}
     83
     84powrio_log_message('POWr Popup plugin loaded.');
     85
     86if (!function_exists('powrio_sanitize_input')) {
     87    function powrio_sanitize_input($input)
     88    {
     89        return sanitize_text_field($input);
     90    }
     91}
     92
     93
     94$example_input = '<script>alert("Test")</script>';
     95$sanitized_input = powrio_sanitize_input($example_input);
     96powrio_log_message('Sanitized input: ' . $sanitized_input);
     97
     98if (!function_exists('powrio_future_feature')) {
     99    function powrio_future_feature()
     100    {
     101        // Future functionality will go here.
     102    }
     103}
     104
     105
     106add_action('init', function () {
     107    powrio_log_message('Init action triggered.');
     108});
     109
     110
     111if (!function_exists('powrio_cleanup')) {
     112    function powrio_cleanup()
     113    {
     114        powrio_log_message('Plugin deactivated. Cleanup tasks executed.');
     115    }
     116}
     117register_deactivation_hook(__FILE__, 'powrio_cleanup');
     118
     119
     120if (!function_exists('powrio_setup')) {
     121    function powrio_setup()
     122    {
     123        powrio_log_message('Plugin activated. Setup tasks executed.');
     124    }
     125}
     126register_activation_hook(__FILE__, 'powrio_setup');
  • powr-popup/trunk/powr-popup.php

    r3222126 r3222227  
    2727// If this file is called directly, abort.
    2828if (! defined('WPINC')) {
    29     die;
     29    die;
    3030}
    3131
     
    3333
    3434if (!function_exists('powrio_popup_menu')) {
    35     function powrio_popup_menu()
    36     {
    37         if (empty($GLOBALS['admin_page_hooks']['powrio-plugins']))
    38             add_menu_page(
    39                 'Popup',
    40                 'Popup',
    41                 'manage_options',
    42                 'powrio-popup',
    43                 'powrio_powr_popup_options',
    44                 plugins_url('/src/icons/powr-icon.png', __FILE__)
    45             );
    46     }
     35    function powrio_popup_menu()
     36    {
     37        if (empty($GLOBALS['admin_page_hooks']['powrio-plugins'])) {
     38            add_menu_page(
     39                'Popup',
     40                'Popup',
     41                'manage_options',
     42                'powrio-popup',
     43                'powrio_powr_popup_options',
     44                plugins_url('/src/icons/powr-icon.png', __FILE__)
     45            );
     46        }
     47    }
    4748}
    4849
    4950if (!function_exists('powrio_powr_base_url')) {
    50     function powrio_powr_base_url()
    51     {
    52         return 'www.powr-staging.io';
    53     }
     51    function powrio_powr_base_url()
     52    {
     53        return 'www.powr.io';
     54    }
    5455}
    5556
    5657if (!function_exists('powrio_render_iframe')) {
    57     function powrio_render_iframe($url)
    58     {
    59         echo ('<iframe src="' . esc_url($url) . '" frameborder="0" scrolling="yes" seamless="seamless" style="background: white;display:block; width: calc(100% - -20px);; height: calc(100vh - 35px); margin-left: -20px;"></iframe>');
    60     }
     58    function powrio_render_iframe($url)
     59    {
     60        echo ('<iframe src="' . esc_url($url) . '" frameborder="0" scrolling="yes" seamless="seamless" style="background: white;display:block; width: calc(100% - -20px);; height: calc(100vh - 35px); margin-left: -20px;"></iframe>');
     61    }
    6162}
    6263
    6364if (!function_exists('powrio_powr_popup_options')) {
    64     function powrio_powr_popup_options()
    65     {
    66         $current_user = wp_get_current_user();
    67         powrio_render_iframe('https://' . powrio_powr_base_url() . '/api/woo_commerce/auth/apps/popup?email='.$current_user->user_email.'&platform=woocommerce&done=1');
    68     }
     65    function powrio_powr_popup_options()
     66    {
     67        $current_user = wp_get_current_user();
     68        powrio_render_iframe('https://' . powrio_powr_base_url() . '/api/woo_commerce/auth/apps/popup?email=' . $current_user->user_email . '&platform=woocommerce&done=1');
     69    }
    6970}
    7071
    7172add_action('admin_menu', 'powrio_popup_menu');
    72 ?>
     73
     74
     75if (!function_exists('powrio_log_message')) {
     76    function powrio_log_message($message)
     77    {
     78        if (defined('WP_DEBUG') && WP_DEBUG) {
     79            error_log('[POWr Popup] ' . $message);
     80        }
     81    }
     82}
     83
     84powrio_log_message('POWr Popup plugin loaded.');
     85
     86if (!function_exists('powrio_sanitize_input')) {
     87    function powrio_sanitize_input($input)
     88    {
     89        return sanitize_text_field($input);
     90    }
     91}
     92
     93
     94$example_input = '<script>alert("Test")</script>';
     95$sanitized_input = powrio_sanitize_input($example_input);
     96powrio_log_message('Sanitized input: ' . $sanitized_input);
     97
     98if (!function_exists('powrio_future_feature')) {
     99    function powrio_future_feature()
     100    {
     101        // Future functionality will go here.
     102    }
     103}
     104
     105
     106add_action('init', function () {
     107    powrio_log_message('Init action triggered.');
     108});
     109
     110
     111if (!function_exists('powrio_cleanup')) {
     112    function powrio_cleanup()
     113    {
     114        powrio_log_message('Plugin deactivated. Cleanup tasks executed.');
     115    }
     116}
     117register_deactivation_hook(__FILE__, 'powrio_cleanup');
     118
     119
     120if (!function_exists('powrio_setup')) {
     121    function powrio_setup()
     122    {
     123        powrio_log_message('Plugin activated. Setup tasks executed.');
     124    }
     125}
     126register_activation_hook(__FILE__, 'powrio_setup');
Note: See TracChangeset for help on using the changeset viewer.