Changeset 3172446
- Timestamp:
- 10/20/2024 06:16:37 PM (15 months ago)
- Location:
- hyper-pwa/trunk
- Files:
-
- 6 edited
-
admin/admin.php (modified) (10 diffs)
-
cfg/cfg.php (modified) (1 diff)
-
fallback/manifest.php (modified) (6 diffs)
-
flx/flx.php (modified) (1 diff)
-
hyper-pwa.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hyper-pwa/trunk/admin/admin.php
r3141086 r3172446 167 167 private function get_tab() 168 168 { 169 $tab = ! empty( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ]: '';169 $tab = ! empty( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : ''; 170 170 if ( 'manifest' === $tab || 'service-worker' === $tab || 'a2hs' === $tab || 'faq' === $tab || 'subscription' === $tab 171 171 || 'custom-dev' === $tab || 'contact-us' === $tab ) … … 175 175 return $tab; 176 176 } 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'] ) ); 180 180 } 181 181 else … … 422 422 <h2>Hyper PWA Settings</h2>'; 423 423 424 if ( ! empty( $_GET[ 'settings-updated'] ) )424 if ( ! empty( $_GET['settings-updated'] ) ) 425 425 { 426 426 update_option( HYPER_PWA_TRANSIENT_TIMESTAMP, $this->current_timestamp ); … … 441 441 { 442 442 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>'; 444 444 } 445 445 … … 504 504 public function field_callback( $args ) 505 505 { 506 $value = get_option( $args[ 'uid'] );506 $value = get_option( $args['uid'] ); 507 507 if ( empty( $value ) ) 508 508 { 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'] ) 518 518 { 519 519 case 'text': 520 520 case 'password': 521 521 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 ) ); 523 523 break; 524 524 525 525 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 ) ); 527 527 break; 528 528 529 529 case 'select': 530 530 case 'multiselect': 531 if ( ! empty( $args[ 'options' ] ) && is_array( $args[ 'options'] ) )531 if ( ! empty( $args['options'] ) && is_array( $args['options'] ) ) 532 532 { 533 533 $options_markup = ''; 534 foreach ( $args[ 'options'] as $key => $label )534 foreach ( $args['options'] as $key => $label ) 535 535 { 536 536 if ( ! empty( $value ) ) … … 545 545 546 546 $attributes = ''; 547 if ( 'multiselect' === $args[ 'type'] )547 if ( 'multiselect' === $args['type'] ) 548 548 { 549 549 $attributes = ' multiple="multiple" '; 550 550 } 551 551 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 ) ); 553 553 } 554 554 break; … … 556 556 case 'radio': 557 557 case 'checkbox': 558 if ( ! empty( $args[ 'options' ] ) && is_array( $args[ 'options'] ) )558 if ( ! empty( $args['options'] ) && is_array( $args['options'] ) ) 559 559 { 560 560 $options_markup = ''; 561 561 $iterator = 0; 562 foreach ( $args[ 'options'] as $key => $label )562 foreach ( $args['options'] as $key => $label ) 563 563 { 564 564 $iterator++; 565 565 if ( ! empty( $value ) ) 566 566 { 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 ) ); 568 568 } 569 569 else 570 570 { 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 ) ); 572 572 } 573 573 } 574 574 575 printf( '<fieldset>%s</fieldset>', $options_markup);575 printf( '<fieldset>%s</fieldset>', wp_kses_post( $options_markup ) ); 576 576 } 577 577 break; 578 578 579 579 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'] ) ); 581 581 break; 582 582 583 583 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 ) ); 585 585 break; 586 586 } 587 587 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 ) ); 598 598 } 599 599 } … … 608 608 foreach ( $this->fields as $field ) 609 609 { 610 if ( empty( $field[ 'tab' ] ) || $this->tab !== $field[ 'tab'] )610 if ( empty( $field['tab'] ) || $this->tab !== $field['tab'] ) 611 611 { 612 612 continue; 613 613 } 614 $tab = $field[ 'tab'];615 616 if ( empty( $field[ 'uid'] ) )614 $tab = $field['tab']; 615 616 if ( empty( $field['uid'] ) ) 617 617 { 618 618 continue; 619 619 } 620 $uid = $field[ 'uid'];621 622 if ( empty( $field[ 'label'] ) )620 $uid = $field['uid']; 621 622 if ( empty( $field['label'] ) ) 623 623 { 624 624 continue; 625 625 } 626 $label = $field[ 'label'];627 628 if ( empty( $field[ 'section'] ) )626 $label = $field['label']; 627 628 if ( empty( $field['section'] ) ) 629 629 { 630 630 continue; 631 631 } 632 $section = $field[ 'section'];632 $section = $field['section']; 633 633 634 634 $title = ! empty( $this->sections[$section] ) ? $this->sections[$section] : ''; … … 648 648 649 649 650 if ( 'admin-ajax.php' === $GLOBALS[ 'pagenow' ] || 'wp-activate.php' === $GLOBALS[ 'pagenow' ] || 'wp-cron.php' === $GLOBALS[ 'pagenow' ] || 651 'wp-signup.php' === $GLOBALS[ 'pagenow' ] ) 650 if ( 'admin-ajax.php' === $GLOBALS['pagenow'] || 'wp-activate.php' === $GLOBALS['pagenow'] || 'wp-cron.php' === $GLOBALS['pagenow'] || 'wp-signup.php' === $GLOBALS['pagenow'] ) 652 651 { 653 652 return; 654 653 } 655 elseif ( 'wp-login.php' === $GLOBALS[ 'pagenow'] )654 elseif ( 'wp-login.php' === $GLOBALS['pagenow'] ) 656 655 { 657 if ( ! empty( $_COOKIE[ 'hyper-pwa-admin-tab'] ) )656 if ( ! empty( $_COOKIE['hyper-pwa-admin-tab'] ) ) 658 657 { 659 658 $current_timestamp = time(); … … 668 667 } 669 668 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 671 add_action( 'admin_menu', [ $hyper_pwa_admin, 'add_menu' ] ); 672 add_action( 'admin_init', [ $hyper_pwa_admin, 'register_settings' ] ); -
hyper-pwa/trunk/cfg/cfg.php
r3141086 r3172446 5 5 } 6 6 7 define( 'HYPER_PWA_VERSION', '4. 0.0' );7 define( 'HYPER_PWA_VERSION', '4.1.0' ); 8 8 9 9 define( 'HYPER_PWA_TRANSIENT_SCHEDULE_RECURRENCE', HOUR_IN_SECONDS ); -
hyper-pwa/trunk/fallback/manifest.php
r3141086 r3172446 62 62 "icons": [ 63 63 { 64 "src": "' . $this->host_dir . $icons[ 'icon_192'] . '",64 "src": "' . $this->host_dir . $icons['icon_192'] . '", 65 65 "sizes": "192x192", 66 66 "type": "image/png", … … 68 68 }, 69 69 { 70 "src": "' . $this->host_dir . $icons[ 'icon_512'] . '",70 "src": "' . $this->host_dir . $icons['icon_512'] . '", 71 71 "sizes": "512x512", 72 72 "type": "image/png", … … 74 74 }, 75 75 { 76 "src": "' . $this->host_dir . $icons[ 'maskable_icon_192'] . '",76 "src": "' . $this->host_dir . $icons['maskable_icon_192'] . '", 77 77 "sizes": "192x192", 78 78 "type": "image/png", … … 80 80 }, 81 81 { 82 "src": "' . $this->host_dir . $icons[ 'maskable_icon_512'] . '",82 "src": "' . $this->host_dir . $icons['maskable_icon_512'] . '", 83 83 "sizes": "512x512", 84 84 "type": "image/png", … … 91 91 "screenshots": [ 92 92 { 93 "src": "' . $this->host_dir . $screenshots[ 'wide'] . '",93 "src": "' . $this->host_dir . $screenshots['wide'] . '", 94 94 "sizes": "512x384", 95 95 "type": "image/gif", … … 98 98 }, 99 99 { 100 "src": "' . $this->host_dir . $screenshots[ 'narrow'] . '",100 "src": "' . $this->host_dir . $screenshots['narrow'] . '", 101 101 "sizes": "384x512", 102 102 "type": "image/gif", -
hyper-pwa/trunk/flx/flx.php
r3141086 r3172446 33 33 $list = []; 34 34 35 $num = rand( 1, 6 );35 $num = wp_rand( 1, 6 ); 36 36 if ( 1 === $num ) 37 37 { -
hyper-pwa/trunk/hyper-pwa.php
r3141086 r3172446 4 4 Plugin URI: https://wordpress.org/plugins/hyper-pwa/ 5 5 Description: Provide Manifest and Service Worker, convert WordPress into Progressive Web Apps (PWA). 6 Version: 4. 0.06 Version: 4.1.0 7 7 Author: Rickey Gu 8 8 Author URI: https://flexplat.com … … 20 20 define( 'HYPER_PWA_PATH', plugin_dir_path( __FILE__ ) ); 21 21 22 include_once ABSPATH . 'wp-admin/includes/plugin.php'; 23 22 24 require_once HYPER_PWA_PATH . 'cfg/cfg.php'; 23 25 require_once HYPER_PWA_PATH . 'lib/transient.php'; … … 47 49 $this->base_pattern = str_replace( [ '/', '.' ], [ '\/', '\.' ], $this->home_url ); 48 50 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( [] ); 51 53 52 54 $this->current_timestamp = time(); … … 249 251 } 250 252 251 $icon _192 = '/wp-content/plugins/hyper-pwa/img/icon-192.png';253 $icons = $this->option->get_icons(); 252 254 $install_button = $this->option->get_install_button(); 253 255 $popup_messages = $this->option->get_popup_messages(); 254 256 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 262 257 $footer = '<div id="hyper-pwa-notification-bar" class="hyper-pwa-hidden hyper-pwa-notification-bar" style="display:flex;"> 263 258 <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"> 265 260 </div> 266 261 <div style="flex:1;"> … … 280 275 <div id="hyper-pwa-popup-window-ios-safari" class="hyper-pwa-popup-window"> 281 276 <div id="hyper-pwa-popup-text-ios-safari" class="hyper-pwa-popup-text"> 282 ' . $popup_messages[ 'ios_safari'] . '277 ' . $popup_messages['ios_safari'] . ' 283 278 <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"> 284 279 <path fill="dodgerblue" d="M30.3 13.7L25 8.4l-5.3 5.3-1.4-1.4L25 5.6l6.7 6.7z"/> … … 286 281 <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"/> 287 282 </svg> 288 ' . $popup_messages[ 'ios_safari_2'] . '283 ' . $popup_messages['ios_safari_2'] . ' 289 284 </div> 290 285 </div> 291 286 <div id="hyper-pwa-popup-window-ios-chrome" class="hyper-pwa-popup-window"> 292 287 <div id="hyper-pwa-popup-text-ios-chrome" class="hyper-pwa-popup-text"> 293 ' . $popup_messages[ 'ios_chrome'] . '288 ' . $popup_messages['ios_chrome'] . ' 294 289 </div> 295 290 </div>' . "\n"; … … 317 312 $url = esc_url( $url ); 318 313 319 $link = '<a href="' . $url . '">' . __( 'Settings' ) . '</a>';314 $link = '<a href="' . $url . '">' . __( 'Settings', 'hyper-pwa' ) . '</a>'; 320 315 array_push( $links, $link ); 321 316 … … 332 327 333 328 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 ); 335 330 } 336 331 … … 343 338 344 339 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 345 if ( is_plugin_active( 'flx-woo/flx-woo.php' ) ) 346 { 347 return; 348 } 349 349 350 350 include_once HYPER_PWA_PATH . 'admin/admin.php'; 351 351 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' ] ) 352 if ( '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'] ) 355 353 { 356 354 return; -
hyper-pwa/trunk/readme.txt
r3141086 r3172446 4 4 Tags: progressive web apps, pwa, add to home screen, a2hs, offline 5 5 Requires at least: 5.1 6 Tested up to: 6.6. 16 Tested up to: 6.6.2 7 7 Requires PHP: 7.2 8 Stable tag: 4. 0.08 Stable tag: 4.1.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 63 63 == Changelog == 64 64 65 = 4.1.0 66 (Sun., Oct. 20, 2024) 67 * Improve according to Plugin Check 68 65 69 = 4.0.0 66 70 (Sun., Aug. 25, 2024)
Note: See TracChangeset
for help on using the changeset viewer.