Plugin Directory

Changeset 3172446


Ignore:
Timestamp:
10/20/2024 06:16:37 PM (15 months ago)
Author:
rickey29
Message:

4.1.0

Location:
hyper-pwa/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • hyper-pwa/trunk/admin/admin.php

    r3141086 r3172446  
    167167    private function get_tab()
    168168    {
    169         $tab = ! empty( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : '';
     169        $tab = ! empty( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
    170170        if ( 'manifest' === $tab || 'service-worker' === $tab || 'a2hs' === $tab || 'faq' === $tab || 'subscription' === $tab
    171171            || 'custom-dev' === $tab || 'contact-us' === $tab )
     
    175175            return $tab;
    176176        }
    177         elseif ( empty( $tab ) && ! empty( $_COOKIE[ 'hyper-pwa-admin-tab' ] ) )
    178         {
    179             return $_COOKIE[ 'hyper-pwa-admin-tab' ];
     177        elseif ( empty( $tab ) && ! empty( $_COOKIE['hyper-pwa-admin-tab'] ) )
     178        {
     179            return sanitize_text_field( wp_unslash( $_COOKIE['hyper-pwa-admin-tab'] ) );
    180180        }
    181181        else
     
    422422    <h2>Hyper PWA Settings</h2>';
    423423
    424         if ( ! empty( $_GET[ 'settings-updated' ] ) )
     424        if ( ! empty( $_GET['settings-updated'] ) )
    425425        {
    426426            update_option( HYPER_PWA_TRANSIENT_TIMESTAMP, $this->current_timestamp );
     
    441441        {
    442442            echo '
    443         <a href="?page=hyper-pwa&tab=' . $key . '" class="nav-tab' . ( ( $key === $this->tab ) ? ' nav-tab-active' : '' ) . '">' . $value . '</a>';
     443        <a href="?page=hyper-pwa&tab=' . esc_attr( $key ) . '" class="nav-tab' . ( ( $key === $this->tab ) ? ' nav-tab-active' : '' ) . '">' . esc_html( $value ) . '</a>';
    444444        }
    445445
     
    504504    public function field_callback( $args )
    505505    {
    506         $value = get_option( $args[ 'uid' ] );
     506        $value = get_option( $args['uid'] );
    507507        if ( empty( $value ) )
    508508        {
    509             $value = isset( $args[ 'default' ] ) ? $args[ 'default' ] : '';
    510         }
    511 
    512         if ( ! isset( $args[ 'placeholder' ] ) )
    513         {
    514             $args[ 'placeholder' ] = '';
    515         }
    516 
    517         switch ( $args[ 'type' ] )
     509            $value = isset( $args['default'] ) ? $args['default'] : '';
     510        }
     511
     512        if ( ! isset( $args['placeholder'] ) )
     513        {
     514            $args['placeholder'] = '';
     515        }
     516
     517        switch ( $args['type'] )
    518518        {
    519519            case 'text':
    520520            case 'password':
    521521            case 'number':
    522                 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" size="64" />', $args[ 'uid' ], $args[ 'type' ], $args[ 'placeholder' ], $value );
     522                printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" size="64" />', esc_attr( $args['uid'] ), esc_attr( $args['type'] ), esc_attr( $args['placeholder'] ), esc_attr( $value ) );
    523523                break;
    524524
    525525            case 'textarea':
    526                 printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="4" cols="64">%3$s</textarea>', $args[ 'uid' ], $args[ 'placeholder' ], $value );
     526                printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="4" cols="64">%3$s</textarea>', esc_attr( $args['uid'] ), esc_attr( $args['placeholder'] ), esc_textarea( $value ) );
    527527                break;
    528528
    529529            case 'select':
    530530            case 'multiselect':
    531                 if ( ! empty( $args[ 'options' ] ) && is_array( $args[ 'options' ] ) )
     531                if ( ! empty( $args['options'] ) && is_array( $args['options'] ) )
    532532                {
    533533                    $options_markup = '';
    534                     foreach ( $args[ 'options' ] as $key => $label )
     534                    foreach ( $args['options'] as $key => $label )
    535535                    {
    536536                        if ( ! empty( $value ) )
     
    545545
    546546                    $attributes = '';
    547                     if ( 'multiselect' === $args[ 'type' ] )
     547                    if ( 'multiselect' === $args['type'] )
    548548                    {
    549549                        $attributes = ' multiple="multiple" ';
    550550                    }
    551551
    552                     printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', $args[ 'uid' ], $attributes, $options_markup );
     552                    printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', esc_attr( $args['uid'] ), esc_attr( $attributes ), wp_kses_post( $options_markup ) );
    553553                }
    554554                break;
     
    556556            case 'radio':
    557557            case 'checkbox':
    558                 if ( ! empty( $args[ 'options' ] ) && is_array( $args[ 'options' ] ) )
     558                if ( ! empty( $args['options'] ) && is_array( $args['options'] ) )
    559559                {
    560560                    $options_markup = '';
    561561                    $iterator = 0;
    562                     foreach ( $args[ 'options' ] as $key => $label )
     562                    foreach ( $args['options'] as $key => $label )
    563563                    {
    564564                        $iterator++;
    565565                        if ( ! empty( $value ) )
    566566                        {
    567                             $options_markup .= sprintf( '<input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /><label for="%1$s_%6$s"> %5$s</label><br>', $args[ 'uid' ], $args[ 'type' ], $key, checked( $value[ array_search( $key, $value, TRUE ) ], $key, FALSE ), $label, $iterator );
     567                            $options_markup .= sprintf( '<input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /><label for="%1$s_%6$s"> %5$s</label><br>', esc_attr( $args['uid'] ), esc_attr( $args['type'] ), esc_attr( $key ), checked( $value[ array_search( $key, $value, TRUE ) ], $key, FALSE ), esc_html( $label ), esc_attr( $iterator ) );
    568568                        }
    569569                        else
    570570                        {
    571                             $options_markup .= sprintf( '<input id="%1$s_%5$s" name="%1$s[]" type="%2$s" value="%3$s" /><label for="%1$s_%5$s"> %4$s</label><br>', $args[ 'uid' ], $args[ 'type' ], $key, $label, $iterator );
     571                            $options_markup .= sprintf( '<input id="%1$s_%5$s" name="%1$s[]" type="%2$s" value="%3$s" /><label for="%1$s_%5$s"> %4$s</label><br>', esc_attr( $args['uid'] ), esc_attr( $args['type'] ), esc_attr( $key ), esc_html( $label ), esc_attr( $iterator ) );
    572572                        }
    573573                    }
    574574
    575                     printf( '<fieldset>%s</fieldset>', $options_markup );
     575                    printf( '<fieldset>%s</fieldset>', wp_kses_post( $options_markup ) );
    576576                }
    577577                break;
    578578
    579579            case 'media-uploader':
    580                 printf( '<input id="%1$s" type="text" name="%1$s" value="%2$s" placeholder="%3$s" size="64" /> <input id="%4$s" type="button" class="button-primary" value="Choose Image" />', $args[ 'uid' ], $value, $args[ 'placeholder' ], $args[ 'button' ] );
     580                printf( '<input id="%1$s" type="text" name="%1$s" value="%2$s" placeholder="%3$s" size="64" /> <input id="%4$s" type="button" class="button-primary" value="Choose Image" />', esc_attr( $args['uid'] ), esc_attr( $value ), esc_attr( $args['placeholder'] ), esc_attr( $args['button'] ) );
    581581                break;
    582582
    583583            case 'color-picker':
    584                 printf( '<input id="%1$s" type="text" name="%1$s" value="%2$s" class="hyper-pwa-color-picker" data-default-color="#ffffff" />', $args[ 'uid' ], $value );
     584                printf( '<input id="%1$s" type="text" name="%1$s" value="%2$s" class="hyper-pwa-color-picker" data-default-color="#ffffff" />', esc_attr( $args['uid'] ), esc_attr( $value ) );
    585585                break;
    586586        }
    587587
    588         if ( ! empty( $args[ 'helper' ] ) )
    589         {
    590             $helper = $args[ 'helper' ];
    591             printf( '<span class="helper">%s</span>', $helper );
    592         }
    593 
    594         if ( ! empty( $args[ 'supplimental' ] ) )
    595         {
    596             $supplimental = $args[ 'supplimental' ];
    597             printf( '<p class="description">%s</p>', $supplimental );
     588        if ( ! empty( $args['helper'] ) )
     589        {
     590            $helper = $args['helper'];
     591            printf( '<span class="helper">%s</span>', esc_html( $helper ) );
     592        }
     593
     594        if ( ! empty( $args['supplimental'] ) )
     595        {
     596            $supplimental = $args['supplimental'];
     597            printf( '<p class="description">%s</p>', esc_html( $supplimental ) );
    598598        }
    599599    }
     
    608608        foreach ( $this->fields as $field )
    609609        {
    610             if ( empty( $field[ 'tab' ] ) || $this->tab !== $field[ 'tab' ] )
     610            if ( empty( $field['tab'] ) || $this->tab !== $field['tab'] )
    611611            {
    612612                continue;
    613613            }
    614             $tab = $field[ 'tab' ];
    615 
    616             if ( empty( $field[ 'uid' ] ) )
     614            $tab = $field['tab'];
     615
     616            if ( empty( $field['uid'] ) )
    617617            {
    618618                continue;
    619619            }
    620             $uid = $field[ 'uid' ];
    621 
    622             if ( empty( $field[ 'label' ] ) )
     620            $uid = $field['uid'];
     621
     622            if ( empty( $field['label'] ) )
    623623            {
    624624                continue;
    625625            }
    626             $label = $field[ 'label' ];
    627 
    628             if ( empty( $field[ 'section' ] ) )
     626            $label = $field['label'];
     627
     628            if ( empty( $field['section'] ) )
    629629            {
    630630                continue;
    631631            }
    632             $section = $field[ 'section' ];
     632            $section = $field['section'];
    633633
    634634            $title = ! empty( $this->sections[$section] ) ? $this->sections[$section] : '';
     
    648648
    649649
    650 if ( 'admin-ajax.php' === $GLOBALS[ 'pagenow' ] || 'wp-activate.php' === $GLOBALS[ 'pagenow' ] || 'wp-cron.php' === $GLOBALS[ 'pagenow' ] ||
    651     'wp-signup.php' === $GLOBALS[ 'pagenow' ] )
     650if ( 'admin-ajax.php' === $GLOBALS['pagenow'] || 'wp-activate.php' === $GLOBALS['pagenow'] || 'wp-cron.php' === $GLOBALS['pagenow'] || 'wp-signup.php' === $GLOBALS['pagenow'] )
    652651{
    653652    return;
    654653}
    655 elseif ( 'wp-login.php' === $GLOBALS[ 'pagenow' ] )
     654elseif ( 'wp-login.php' === $GLOBALS['pagenow'] )
    656655{
    657     if ( ! empty( $_COOKIE[ 'hyper-pwa-admin-tab' ] ) )
     656    if ( ! empty( $_COOKIE['hyper-pwa-admin-tab'] ) )
    658657    {
    659658        $current_timestamp = time();
     
    668667}
    669668
    670 $HYPER_PWA_admin = new HyperPWAAdmin();
    671 
    672 add_action( 'admin_menu', [ $HYPER_PWA_admin, 'add_menu' ] );
    673 add_action( 'admin_init', [ $HYPER_PWA_admin, 'register_settings' ] );
     669$hyper_pwa_admin = new HyperPWAAdmin();
     670
     671add_action( 'admin_menu', [ $hyper_pwa_admin, 'add_menu' ] );
     672add_action( 'admin_init', [ $hyper_pwa_admin, 'register_settings' ] );
  • hyper-pwa/trunk/cfg/cfg.php

    r3141086 r3172446  
    55}
    66
    7 define( 'HYPER_PWA_VERSION', '4.0.0' );
     7define( 'HYPER_PWA_VERSION', '4.1.0' );
    88
    99define( 'HYPER_PWA_TRANSIENT_SCHEDULE_RECURRENCE', HOUR_IN_SECONDS );
  • hyper-pwa/trunk/fallback/manifest.php

    r3141086 r3172446  
    6262  "icons": [
    6363    {
    64       "src": "' . $this->host_dir . $icons[ 'icon_192' ] . '",
     64      "src": "' . $this->host_dir . $icons['icon_192'] . '",
    6565      "sizes": "192x192",
    6666      "type": "image/png",
     
    6868    },
    6969    {
    70       "src": "' . $this->host_dir . $icons[ 'icon_512' ] . '",
     70      "src": "' . $this->host_dir . $icons['icon_512'] . '",
    7171      "sizes": "512x512",
    7272      "type": "image/png",
     
    7474    },
    7575    {
    76       "src": "' . $this->host_dir . $icons[ 'maskable_icon_192' ] . '",
     76      "src": "' . $this->host_dir . $icons['maskable_icon_192'] . '",
    7777      "sizes": "192x192",
    7878      "type": "image/png",
     
    8080    },
    8181    {
    82       "src": "' . $this->host_dir . $icons[ 'maskable_icon_512' ] . '",
     82      "src": "' . $this->host_dir . $icons['maskable_icon_512'] . '",
    8383      "sizes": "512x512",
    8484      "type": "image/png",
     
    9191  "screenshots": [
    9292    {
    93       "src": "' . $this->host_dir . $screenshots[ 'wide' ] . '",
     93      "src": "' . $this->host_dir . $screenshots['wide'] . '",
    9494      "sizes": "512x384",
    9595      "type": "image/gif",
     
    9898    },
    9999    {
    100       "src": "' . $this->host_dir . $screenshots[ 'narrow' ] . '",
     100      "src": "' . $this->host_dir . $screenshots['narrow'] . '",
    101101      "sizes": "384x512",
    102102      "type": "image/gif",
  • hyper-pwa/trunk/flx/flx.php

    r3141086 r3172446  
    3333        $list = [];
    3434
    35         $num = rand( 1, 6 );
     35        $num = wp_rand( 1, 6 );
    3636        if ( 1 === $num )
    3737        {
  • hyper-pwa/trunk/hyper-pwa.php

    r3141086 r3172446  
    44Plugin URI:  https://wordpress.org/plugins/hyper-pwa/
    55Description: Provide Manifest and Service Worker, convert WordPress into Progressive Web Apps (PWA).
    6 Version:     4.0.0
     6Version:     4.1.0
    77Author:      Rickey Gu
    88Author URI:  https://flexplat.com
     
    2020define( 'HYPER_PWA_PATH', plugin_dir_path( __FILE__ ) );
    2121
     22include_once ABSPATH . 'wp-admin/includes/plugin.php';
     23
    2224require_once HYPER_PWA_PATH . 'cfg/cfg.php';
    2325require_once HYPER_PWA_PATH . 'lib/transient.php';
     
    4749        $this->base_pattern = str_replace( [ '/', '.' ], [ '\/', '\.' ], $this->home_url );
    4850
    49         $parts = parse_url( $this->home_url );
    50         $this->page_url = $parts[ 'scheme' ] . '://' . $parts[ 'host' ] . add_query_arg( [] );
     51        $parts = wp_parse_url( $this->home_url );
     52        $this->page_url = $parts['scheme'] . '://' . $parts['host'] . add_query_arg( [] );
    5153
    5254        $this->current_timestamp = time();
     
    249251        }
    250252
    251         $icon_192 = '/wp-content/plugins/hyper-pwa/img/icon-192.png';
     253        $icons = $this->option->get_icons();
    252254        $install_button = $this->option->get_install_button();
    253255        $popup_messages = $this->option->get_popup_messages();
    254256
    255         $settings = $this->retrieve->get_settings();
    256         if ( ! empty( $settings[ 'premium' ] ) && 'enable' === $settings[ 'premium' ] )
    257         {
    258             $icons = $this->option->get_icons();
    259             $icon_192 = $icons['icon_192'];
    260         }
    261 
    262257        $footer = '<div id="hyper-pwa-notification-bar" class="hyper-pwa-hidden hyper-pwa-notification-bar" style="display:flex;">
    263258    <div>
    264         <img class="hyper-pwa-icon" src="' . $this->home_url . $icon_192 . '" width="48" height="48">
     259        <img class="hyper-pwa-icon" src="' . $this->home_url . $icons['icon_192'] . '" width="48" height="48">
    265260    </div>
    266261    <div style="flex:1;">
     
    280275<div id="hyper-pwa-popup-window-ios-safari" class="hyper-pwa-popup-window">
    281276    <div id="hyper-pwa-popup-text-ios-safari" class="hyper-pwa-popup-text">
    282         ' . $popup_messages[ 'ios_safari' ] . '
     277        ' . $popup_messages['ios_safari'] . '
    283278        <svg width="24px" height="24px" style="vertical-align: bottom;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" enable-background="new 0 0 50 50">
    284279            <path fill="dodgerblue" d="M30.3 13.7L25 8.4l-5.3 5.3-1.4-1.4L25 5.6l6.7 6.7z"/>
     
    286281            <path fill="dodgerblue" d="M35 40H15c-1.7 0-3-1.3-3-3V19c0-1.7 1.3-3 3-3h7v2h-7c-.6 0-1 .4-1 1v18c0 .6.4 1 1 1h20c.6 0 1-.4 1-1V19c0-.6-.4-1-1-1h-7v-2h7c1.7 0 3 1.3 3 3v18c0 1.7-1.3 3-3 3z"/>
    287282        </svg>
    288         ' . $popup_messages[ 'ios_safari_2' ] . '
     283        ' . $popup_messages['ios_safari_2'] . '
    289284    </div>
    290285</div>
    291286<div id="hyper-pwa-popup-window-ios-chrome" class="hyper-pwa-popup-window">
    292287    <div id="hyper-pwa-popup-text-ios-chrome" class="hyper-pwa-popup-text">
    293         ' . $popup_messages[ 'ios_chrome' ] . '
     288        ' . $popup_messages['ios_chrome'] . '
    294289    </div>
    295290</div>' . "\n";
     
    317312        $url = esc_url( $url );
    318313
    319         $link = '<a href="' . $url . '">' . __( 'Settings' ) . '</a>';
     314        $link = '<a href="' . $url . '">' . __( 'Settings', 'hyper-pwa' ) . '</a>';
    320315        array_push( $links, $link );
    321316
     
    332327
    333328        setcookie( 'hyper-pwa-admin-tab', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
    334         setcookie( 'hyper-pwa-disable-a2hs', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
     329        setcookie( 'hyper-pwa-a2hs-disable', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
    335330    }
    336331
     
    343338
    344339        setcookie( 'hyper-pwa-admin-tab', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
    345         setcookie( 'hyper-pwa-disable-a2hs', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
    346     }
    347 }
    348 
     340        setcookie( 'hyper-pwa-a2hs-disable', '', $this->current_timestamp - 1, COOKIEPATH, COOKIE_DOMAIN );
     341    }
     342}
     343
     344
     345if ( is_plugin_active( 'flx-woo/flx-woo.php' ) )
     346{
     347    return;
     348}
    349349
    350350include_once HYPER_PWA_PATH . 'admin/admin.php';
    351351
    352 if ( 'admin-ajax.php' === $GLOBALS[ 'pagenow' ] || 'wp-activate.php' === $GLOBALS[ 'pagenow' ] ||
    353     'wp-cron.php' === $GLOBALS[ 'pagenow' ] || 'wp-login.php' === $GLOBALS[ 'pagenow' ] ||
    354     'wp-signup.php' === $GLOBALS[ 'pagenow' ] )
     352if ( 'admin-ajax.php' === $GLOBALS['pagenow'] || 'wp-activate.php' === $GLOBALS['pagenow'] || 'wp-cron.php' === $GLOBALS['pagenow'] || 'wp-login.php' === $GLOBALS['pagenow'] || 'wp-signup.php' === $GLOBALS['pagenow'] )
    355353{
    356354    return;
  • hyper-pwa/trunk/readme.txt

    r3141086 r3172446  
    44Tags: progressive web apps, pwa, add to home screen, a2hs, offline
    55Requires at least: 5.1
    6 Tested up to: 6.6.1
     6Tested up to: 6.6.2
    77Requires PHP: 7.2
    8 Stable tag: 4.0.0
     8Stable tag: 4.1.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6363== Changelog ==
    6464
     65= 4.1.0
     66(Sun., Oct. 20, 2024)
     67* Improve according to Plugin Check
     68
    6569= 4.0.0
    6670(Sun., Aug. 25, 2024)
Note: See TracChangeset for help on using the changeset viewer.