Plugin Directory

Changeset 3316572


Ignore:
Timestamp:
06/23/2025 10:54:19 PM (6 months ago)
Author:
majick
Message:

1.0.4 trunk updates

Location:
adminsanity/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • adminsanity/trunk/adminsanity.php

    r3115930 r3316572  
    55Plugin URI: https://wpmedic.tech/adminsanity/
    66Description: Add Sanity back to your WordPress Admin Area.
    7 Version: 1.0.3
     7Version: 1.0.4
    88Author: Tony Hayes
    99Author URI: https://wpmedic.tech
     
    9191
    9292    // --- bar frontend ---
    93     'bar_cycler' => array(
     93    // 1.0.4: fix to bar frontend settings key
     94    'bar_frontend' => array(
    9495        'type'    => 'checkbox',
    9596        'default' => 'yes',
  • adminsanity/trunk/adminsanity/adminsanity-bar.php

    r3115930 r3316572  
    531531// -----------------
    532532// 0.9.9: emqueue scripts with wp_after_admin_bar_render hook
    533 add_action( 'wp_after_admin_bar_render', 'adminsanity_bar_enqueue_scripts' );
    534 function adminsanity_bar_enqueue_scripts() {
    535     add_action( 'admin_footer', 'adminsanity_bar_scripts' );
    536     add_action( 'wp_footer', 'adminsanity_bar_scripts' );
    537 }
     533// add_action( 'wp_after_admin_bar_render', 'adminsanity_bar_enqueue_scripts' );
     534// function adminsanity_bar_enqueue_scripts() {
     535//  add_action( 'admin_footer', 'adminsanity_bar_scripts' );
     536//  add_action( 'wp_footer', 'adminsanity_bar_scripts' );
     537// }
     538// 1.0.4: do not enqueue as too late for frontend
     539add_action( 'wp_after_admin_bar_render', 'adminsanity_bar_scripts' );
    538540function adminsanity_bar_scripts() {
    539541
     
    636638        });
    637639    }" . "\n";
    638 
    639     if ( !$cycler && !$dropdown ) {
    640         return;
    641     }
    642640
    643641    // --- bar cycler script ---
  • adminsanity/trunk/loader.php

    r3115930 r3316572  
    55// =================================
    66
     7// -------------
     8// Loader v1.3.5
     9// -------------
     10// Note: Changelog at end of file.
     11
    712if ( !defined( 'ABSPATH' ) ) exit;
    813
    9 // --------------
    10 // Version: 1.3.0
    11 // --------------
    12 // Note: Changelog and structure at end of file.
    13 //
     14// === Loader Class ===
     15// - Initialize Loader
     16// - Setup Plugin
     17// - Get Plugin Data
     18// - Get Plugin Version
     19// - Set Pro Namespace
     20// === Plugin Settings ===
     21// - Get Default Settings
     22// - Add Settings
     23// - Maybe Transfer Settings
     24// - Get All Plugin Settings
     25// - Get Plugin Setting
     26// - Reset Plugin Settings
     27// - Update Plugin Settings
     28// - Validate Plugin Setting
     29// === Plugin Loading ===
     30// - Load Plugin Settings
     31// - Add Actions
     32// - Load Helper Libraries
     33// - Maybe Load Thickbox
     34// - Readme Viewer AJAX
     35// === Freemius Loading ===
     36// - Load Freemius
     37// - Filter Freemius Connect
     38// - Freemius Connect Message
     39// - Connect Update Message
     40// === Plugin Admin ===
     41// - Add Settings Menu
     42// - Plugin Page Links
     43// - Message Box
     44// - Notice Boxer
     45// - Plugin Page Header
     46// - Settings Page
     47// - Settings Table
     48// - Setting Row
     49// - Settings Scripts
     50// - Settings Styles
     51// === Namespaced Functions ===
     52
     53
    1454// ============
    1555// Loader Usage
    1656// ============
    1757// 1. replace all occurrences of adminsanity_ in this file with the plugin namespace prefix eg. my_plugin_
     58// 2. replace all occurrences of 'radio-station' in this file with the plugin's translation text domain
    1859// 2. define plugin options, default settings, and setup arguments your main plugin file
    1960// 3. require this file in the main plugin file and instantiate the loader class (see example below)
     
    59100//  'home'          => 'http://mysite.com/plugins/plugin/',
    60101//  'support'       => 'http://mysite.com/plugins/plugin/support/',
    61 //  'ratetext'      => __('Rate on WordPress.org'),     // (overrides default rate text)
     102//  'ratetext'      => __( 'Rate on WordPress.org', 'radio-station' ),      // (overrides default rate text)
    62103//  'share'         => 'http://mysites.com/plugins/plugin/#share', // (set sharing URL)
    63 //  'sharetext'     => __('Share the Plugin Love'),     // (overrides default sharing text)
     104//  'sharetext'     => __( 'Share the Plugin Love', 'radio-station' ),      // (overrides default sharing text)
    64105//  'donate'        => 'https://patreon.com/pagename',  // (overrides plugin Donate URI)
    65 //  'donatetext'    => __('Support this Plugin'),       // (overrides default donate text)
     106//  'donatetext'    => __( 'Support this Plugin', 'radio-station' ),        // (overrides default donate text)
    66107//  'readme'        => false,           // to not link to popup readme in settings page header
    67108//  'settingsmenu'  => false,           // to not automatically add a settings menu [non-WQ]
     
    76117//  'wporgslug'     => 'plugin-slug',   // WordPress.org plugin slug
    77118//  'wporg'         => false,           // * rechecked later (via presence of updatechecker.php) *
    78 //  'textdomain'    => 'text-domain',   // translation text domain (usually same as plugin slug)
     119//  'textdomain'    => 'radio-station', // translation text domain (usually same as plugin slug)
    79120//
    80121//  // --- Freemius ---
     
    439480            // 1.0.5: use sanitize_title on request variables
    440481            // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    441             if ( sanitize_text_field( $_REQUEST['page'] ) != $args['slug'] ) {
     482            if ( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) != $args['slug'] ) {
    442483                return;
    443484            }
     
    446487            }
    447488            // phpcs:ignore WordPress.Security.NonceVerification.Missing
    448             if ( 'reset' != sanitize_text_field( $_POST[$args['namespace'] . '_update_settings'] ) ) {
     489            if ( 'reset' != sanitize_text_field( wp_unslash( $_POST[$args['namespace'] . '_update_settings'] ) ) ) {
    449490                return;
    450491            }
     
    487528            // 1.0.3: only use namespace not settings key
    488529            // 1.0.9: check page is set and matches slug
    489             if ( !isset( $_REQUEST['page'] ) || ( sanitize_text_field( $_REQUEST['page'] != $args['slug'] ) ) ) {
     530            if ( !isset( $_REQUEST['page'] ) || ( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) != $args['slug'] ) ) ) {
    490531                return;
    491532            }
    492533            $updatekey = $args['namespace'] . '_update_settings';
    493534            // phpcs:ignore WordPress.Security.NonceVerification.Missing
    494             if ( !isset( $_POST[$updatekey] ) || ( 'yes' != sanitize_text_field( $_POST[$args['namespace'] . '_update_settings'] ) ) ) {
     535            if ( !isset( $_POST[$updatekey] ) || ( 'yes' != sanitize_text_field( wp_unslash( $_POST[$updatekey] ) ) ) ) {
    495536                return;
    496537            }
     
    505546            // $noncecheck = wp_verify_nonce( sanitize_text_field( $_POST['_wpnonce'] ), $args['slug'] . '_update_settings' );
    506547            check_admin_referer( $args['slug'] . '_update_settings' );
     548
     549            // --- debug posted values ---
     550            //  1.3.?: move debug output to after check_admin_referer
     551            $this->debug_posted( $settings );
    507552
    508553            // --- get plugin options and default settings ---
     
    598643
    599644                        // --- implicit radio / select ---
    600                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     645                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    601646                        $valid = explode( '/', $type );
    602647                        if ( in_array( $posted, $valid ) ) {
     
    609654                        // 1.0.6: fix to new unchecked checkbox value
    610655                        // 1.0.9: maybe validate to specified checkbox value
    611                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     656                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    612657                        if ( isset( $values['value'] ) ) {
    613658                            $valid = array( $values['value'] );
     
    625670                        // --- text area ---
    626671                        // 1.2.5: use sanitize_textarea_field with stripslashes
    627                         $posted = isset( $_POST[$postkey] ) ? sanitize_textarea_field( $_POST[$postkey] ) : null;
     672                        $posted = isset( $_POST[$postkey] ) ? sanitize_textarea_field( wp_unslash( $_POST[$postkey] ) ) : null;
    628673                        // 1.3.0: move use of stripslashes to separate line
    629674                        if ( !is_null( $posted ) ) {
     
    636681                        // --- text field (slug) ---
    637682                        // 1.0.9: move text field sanitization to validation
    638                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     683                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    639684                        if ( !is_string( $valid ) ) {
    640685                            $valid = 'TEXT';
     
    646691                        // --- email field ---
    647692                        // 1.3.0: added explicitly for email field type
    648                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     693                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    649694                        if ( !is_string( $valid ) ) {
    650695                            $valid = 'EMAIL';
     
    656701                        // --- number field value ---
    657702                        // 1.0.9: added support for number step, minimum and maximum
    658                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     703                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    659704                        $newsettings = $posted;
    660705                        $valid = 'NUMERIC';
     
    680725                                // 1.1.2: check for value if specified
    681726                                // 1.2.5: apply sanitize_text_field to posted value
    682                                 if ( ( isset( $values['value'] ) && ( sanitize_text_field( $_POST[$optionkey] ) == $values['value'] ) )
    683                                     || ( !isset( $values['value'] ) && ( 'yes' == sanitize_text_field( $_POST[$optionkey] ) ) ) ) {
     727                                if ( ( isset( $values['value'] ) && ( sanitize_text_field( wp_unslash( $_POST[$optionkey] ) ) == $values['value'] ) )
     728                                    || ( !isset( $values['value'] ) && ( 'yes' == sanitize_text_field( wp_unslash( $_POST[$optionkey] ) ) ) ) ) {
    684729                                    // 1.1.0: fixed to save only array of key values
    685730                                    $posted[] = $option;
     
    693738                        // -- comma separated values ---
    694739                        // 1.0.4: added comma separated values option
    695                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     740                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    696741                        if ( strstr( $posted, ',' ) ) {
    697742                            $posted = explode( ',', $posted );
     
    720765
    721766                        // --- explicit radio or select value ---
    722                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     767                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    723768                        if ( is_string( $valid ) ) {
    724769                            $newsettings = $posted;
     
    731776                        // --- multiselect values ---
    732777                        // 1.0.9: added multiselect value saving
    733                         $posted = isset( $_POST[$postkey] ) ? array_map( 'sanitize_text_field', $_POST[$postkey] ) : array();
     778                        $posted = isset( $_POST[$postkey] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST[$postkey] ) ) : array();
    734779                        $newsettings = array_values( $posted );
    735780
     
    738783                        // --- check attachment ID value ---
    739784                        // 1.1.7: add image attachment ID saving
    740                         $posted = isset( $_POST[$postkey] ) ? absint( $_POST[$postkey] ) : null;
     785                        $posted = isset( $_POST[$postkey] ) ? absint( wp_unslash( $_POST[$postkey] ) ) : null;
    741786                        if ( $posted ) {
    742787                            $attachment = wp_get_attachment_image_src( $posted, 'full' );
     
    751796                        // 1.1.7: added color picker value saving
    752797                        // 1.2.5: use sanitize_hex_color on color field
    753                         $posted = isset( $_POST[$postkey] ) ? sanitize_hex_color( $_POST[$postkey] ) : null;
     798                        $posted = isset( $_POST[$postkey] ) ? sanitize_hex_color( wp_unslash( $_POST[$postkey] ) ) : null;
    754799                        $settings[$key] = $posted;
    755800
     
    760805                        // 1.2.5: added rgba version of sanitization
    761806                        // ref: https://wordpress.stackexchange.com/a/262578/76440
    762                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     807                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    763808                        if ( !is_null( $posted ) ) {
    764809                            $posted = str_replace( ' ', '', $posted );
     
    807852                        // --- fallback to text type ---
    808853                        // 1.3.0: added for unspecified option field type
    809                         $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( $_POST[$postkey] ) : null;
     854                        $posted = isset( $_POST[$postkey] ) ? sanitize_text_field( wp_unslash( $_POST[$postkey] ) ) : null;
    810855                        if ( !is_string( $valid ) ) {
    811856                            $valid = 'TEXT';
     
    943988                    if ( count( $tabs ) > 0 ) {
    944989                        // 1.2.5: sanitize current tab value before validating
    945                         $currenttab = sanitize_text_field( $_POST['settingstab'] );
     990                        $currenttab = sanitize_text_field( wp_unslash( $_POST['settingstab'] ) );
    946991                        if ( in_array( $currenttab, $tabs ) ) {
    947992                            $settings['settingstab'] = $currenttab;
     
    9861031        }
    9871032
     1033        // --------------------------
     1034        // Debug Output Posted Values
     1035        // --------------------------
     1036        function debug_posted( $settings ) {
     1037            if ( $this->debug ) {
     1038                echo '<br><b>Current Settings:</b><br>';
     1039                // phpcs:ignore WordPress.PHP.DevelopmentFunctions
     1040                echo esc_html( print_r( $settings, true ) );
     1041                echo '<br><br>' . "\n";
     1042
     1043                echo '<br><b>Plugin Options:</b><br>';
     1044                // phpcs:ignore WordPress.PHP.DevelopmentFunctions
     1045                echo esc_html( print_r( $this->options, true ) );
     1046                echo '<br><br>' . "\n";
     1047
     1048                // phpcs:ignore WordPress.Security.NonceVerification.Missing
     1049                if ( isset( $_POST ) ) {
     1050                    echo '<br><b>Posted Values:</b><br>';
     1051                    // phpcs:ignore WordPress.Security.NonceVerification.Missing
     1052                    $post_keys = array_keys( $_POST );
     1053                    foreach ( $post_keys as $post_key ) {
     1054                        $post_key = sanitize_text_field( $post_key );
     1055                        $value = sanitize_text_field( $_POST[$post_key] );
     1056                        // phpcs:ignore WordPress.PHP.DevelopmentFunctions
     1057                        echo esc_html( $post_key ) . ': ' . esc_html( print_r( $value, true ) ) . '<br>' . "\n";
     1058                    }
     1059                }
     1060            }
     1061        }
     1062           
    9881063        // -----------------------
    9891064        // Validate Plugin Setting
     
    12651340            register_deactivation_hook( $args['file'], array( $this, 'delete_settings' ) );
    12661341
    1267             // --- maybe load thickbox ---
     1342            // --- maybe enqueue scripts / thickbox ---
    12681343            add_action( 'admin_enqueue_scripts', array( $this, 'maybe_load_thickbox' ) );
     1344            // 1.3.4: add earlier enqueue settings page resources check
     1345            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_resources' ) );
    12691346
    12701347            // --- AJAX readme viewer ---
     
    13481425            $args = $this->args;
    13491426            // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    1350             if ( isset( $_REQUEST['page'] ) && ( sanitize_title( $_REQUEST['page'] ) == $args['slug'] ) ) {
     1427            if ( isset( $_REQUEST['page'] ) && ( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) == $args['slug'] ) ) {
    13511428                add_thickbox();
    13521429            }
     
    13651442            // 1.0.7: changed readme.php to reader.php (for Github)
    13661443            $readme = $dir . '/readme.txt';
     1444            // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
    13671445            $contents = file_get_contents( $readme );
    13681446            $parser = $dir . '/reader.php';
     
    13731451                include $parser;
    13741452
    1375                 // --- remove license info as causes breakage! ---
    1376                 // TODO: find line start and end to handle other possible licenses
    1377                 $contents = str_replace( 'License: GPLv2 or later', '', $contents );
    1378                 $contents = str_replace( 'License URI: http://www.gnu.org/licenses/gpl-2.0.html', '', $contents );
     1453                // --- remove license lines as causing breakage! ---
     1454                // 1.3.1: find license lines to handle other possible licenses
     1455                // $contents = str_replace( 'License: GPLv2 or later', '', $contents );
     1456                // $contents = str_replace( 'License URI: http://www.gnu.org/licenses/gpl-2.0.html', '', $contents );
     1457                $strip_lines = array( 'License', 'License URI' );
     1458                foreach( $strip_lines as $strip_line ) {
     1459                    if ( strstr( $contents, $strip_line ) ) {
     1460                        $pos = strpos( $contents, $strip_line . ':' );
     1461                        $chunks = str_split( $contents, $pos );
     1462                        $before = $chunks[0];
     1463                        unset( $chunks[0] );
     1464                        $remainder = implode( '', $chunks );
     1465                        $posb = strpos( $remainder, "\n" );
     1466                        $chunks = str_split( $remainder, $posb );
     1467                        unset( $chunks[0] );
     1468                        $remainder = implode( '', $chunks );
     1469                        $contents = $before . $remainder;
     1470                    }
     1471                }
    13791472
    13801473                // --- instantiate Parser class ---
    1381                 $readme = new WordPress_Readme_Parser();
     1474                // 1.3.1: prefix readme parser
     1475                $readme = new adminsanity_readme_parser();
    13821476                $parsed = $readme->parse_readme_contents( $contents );
    13831477
    13841478                // --- output plugin info ---
    1385                 echo '<b>' . esc_html( __( 'Plugin Name' ) ) . '</b>: ' . esc_html( $parsed['name'] ) . '<br>' . "\n";
    1386                 // echo '<b>' . esc_html( __( 'Tags' ) ) . '</b>: ' . esc_html( implode( ', ', $parsed['tags'] ) ) . '<br>' . "\n";
    1387                 echo '<b>' . esc_html( __( 'Requires at least' ) ) . '</b>: ' . esc_html( __( 'WordPress' ) ) . ' v' . esc_html( $parsed['requires_at_least'] ) . '<br>' . "\n";
    1388                 echo '<b>' . esc_html( __( 'Tested up to' ) ) . '</b>: ' . esc_html( __( 'WordPress' ) ) . ' v' . esc_html( $parsed['tested_up_to'] ) . '<br>' . "\n";
     1479                echo '<b>' . esc_html( __( 'Plugin Name', 'radio-station' ) ) . '</b>: ' . esc_html( $parsed['name'] ) . '<br>' . "\n";
     1480                // echo '<b>' . esc_html( __( 'Tags', 'radio-station' ) ) . '</b>: ' . esc_html( implode( ', ', $parsed['tags'] ) ) . '<br>' . "\n";
     1481                echo '<b>' . esc_html( __( 'Requires at least', 'radio-station' ) ) . '</b>: ' . esc_html( __( 'WordPress', 'radio-station' ) ) . ' v' . esc_html( $parsed['requires_at_least'] ) . '<br>' . "\n";
     1482                echo '<b>' . esc_html( __( 'Tested up to', 'radio-station' ) ) . '</b>: ' . esc_html( __( 'WordPress', 'radio-station' ) ) . ' v' . esc_html( $parsed['tested_up_to'] ) . '<br>' . "\n";
    13891483                if ( isset( $parsed['stable_tag'] ) ) {
    1390                     echo '<b>' . esc_html( __( 'Stable Tag' ) ) . '</b>: ' . esc_html( $parsed['stable_tag'] ) . '<br>' . "\n";
    1391                 }
    1392                 echo '<b>' . esc_html( __( 'Contributors' ) ) . '</b>: ' . esc_html( implode( ', ', $parsed['contributors'] ) ) . '<br>' . "\n";
     1484                    echo '<b>' . esc_html( __( 'Stable Tag', 'radio-station' ) ) . '</b>: ' . esc_html( $parsed['stable_tag'] ) . '<br>' . "\n";
     1485                }
     1486                echo '<b>' . esc_html( __( 'Contributors', 'radio-station' ) ) . '</b>: ' . esc_html( implode( ', ', $parsed['contributors'] ) ) . '<br>' . "\n";
    13931487                // echo '<b>Donate Link</b>: <a href="' . esc_url( $parsed['donate_link'] ) . '" target="_blank">' . esc_html( $parsed['donate_link'] ) . '</a><br>';
    13941488                // 1.2.5: use wp_kses_post on plugin short description markup
     
    14161510                }
    14171511                if ( isset( $parsed['remaining_content'] ) && !empty( $remaining_content ) ) {
    1418                     echo '<h3>' . esc_html( __( 'Extra Notes' ) ) . '</h3>' . "\n";
     1512                    echo '<h3>' . esc_html( __( 'Extra Notes', 'radio-station' ) ) . '</h3>' . "\n";
    14191513                    // 1.2.5: use wp_kses_post on readme extra notes output
    14201514                    echo wp_kses_post( $parsed['remaining_content'] );
     
    14851579            // 1.0.5: use sanitize_text_field on request variable
    14861580            // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    1487             if ( isset( $_REQUEST['page'] ) && ( sanitize_title( $_REQUEST['page'] ) == $args['slug'] . '-wp-support-forum' ) && is_admin() ) {
    1488                 if ( !function_exists( 'wp_redirect' ) ) {
    1489                     include ABSPATH . WPINC . '/pluggable.php';
    1490                 }
     1581            if ( isset( $_REQUEST['page'] ) && ( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) == $args['slug'] . '-wp-support-forum' ) && is_admin() ) {
     1582                // 1.0.7: fix support URL undefined variable warning
    14911583                if ( isset( $args['support'] ) ) {
    1492                     // changes the support forum slug for premium based on the pro plugin file slug
    1493                     // 1.0.7: fix support URL undefined variable warning
    1494                     $support_url = $args['support'];
    1495                     // 1.2.1: removed in favour of filtering via Pro
    1496                     // if ( $premium && isset( $args['proslug'] ) ) {
    1497                     //  $support_url = str_replace( $args['slug'], $args['proslug'], $support_url );
    1498                     // }
    1499                     $support_url = apply_filters( 'freemius_plugin_support_url_redirect', $support_url, $args['slug'] );
    1500                     // phpcs:ignore WordPress.Security.SafeRedirect
    1501                     wp_redirect( $support_url );
    1502                     exit;
     1584                    // 1.3.6: add action and bug out on redirect
     1585                    add_action( 'admin_init', array( $this, 'support_redirect' ) );
     1586                    return;
    15031587                }
    15041588            }
     
    15101594                if ( !class_exists( 'Freemius' ) ) {
    15111595                    $freemiuspath = dirname( __FILE__ ) . '/freemius/start.php';
     1596                    $freemiuspath = apply_filters( 'freemius_load_path', $freemiuspath, $namespace, $args );
    15121597                    if ( !file_exists( $freemiuspath ) ) {
    15131598                        return;
     
    15461631                }
    15471632                if ( !isset( $args['affiliation'] ) ) {
    1548                     $args['affiliaation'] = false;
     1633                    // 1.3.1: fix to key typo (affiliaation)
     1634                    $args['affiliation'] = false;
    15491635                }
    15501636
     
    16241710        }
    16251711
     1712        // ----------------
     1713        // Support Redirect
     1714        // ----------------
     1715        // 1.3.6: enqueued on admin_init for slightly later execution
     1716        function support_redirect() {
     1717       
     1718            $args = $this->args;
     1719            $support_url = $args['support'];
     1720
     1721            // changes the support forum slug for premium based on the pro plugin file slug
     1722            // 1.2.1: removed in favour of filtering via Pro
     1723            // if ( $premium && isset( $args['proslug'] ) ) {
     1724            //  $support_url = str_replace( $args['slug'], $args['proslug'], $support_url );
     1725            // }
     1726            $support_url = apply_filters( 'freemius_plugin_support_url_redirect', $support_url, $args['slug'] );
     1727
     1728            // 1.3.6: removed conditional include of pluggable (no longer necessary)
     1729            // phpcs:ignore WordPress.Security.SafeRedirect
     1730            wp_redirect( $support_url );
     1731            exit;
     1732        }
     1733
    16261734        // ------------------------
    16271735        // Freemius Connect Message
     
    16341742            $message .= sprintf(
    16351743                // Translators: plugin title, user name, site link, freemius link
    1636                 __( 'If you want to more easily access support and feedback for this plugins features and functionality, %1$s can connect your user, %2$s at %3$s, to %4$s' ),
     1744                __( 'If you want to more easily access support and feedback for this plugins features and functionality, %1$s can connect your user, %2$s at %3$s, to %4$s', 'radio-station' ),
    16371745                '<b>' . $plugin_title . '</b>',
    16381746                '<b>' . $user_login . '</b>',
     
    16601768        // ====================
    16611769
     1770        // --------------------------------
     1771        // Enequeue Settings Page Resources
     1772        // --------------------------------
     1773        // 1.3.4: added enqueue resources function
     1774        public function enqueue_resources() {
     1775           
     1776            $args = $this->args;
     1777            $namespace = $this->namespace;
     1778
     1779            if ( isset( $_REQUEST['page'] ) && ( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) == $args['slug'] ) ) {
     1780
     1781                // --- get plugin options and default settings ---
     1782                // 1.1.2: fix for filtering of plugin options
     1783                $options = $this->options;
     1784                $options = apply_filters( $namespace . '_options', $options );
     1785
     1786                // --- maybe enqueue media scripts ---
     1787                // 1.1.7: added media gallery script enqueueing for image field
     1788                // 1.1.7: added color picker and color picker alpha script enqueueing
     1789                $enqueued_media = $enqueued_color_picker = $enqueue_color_picker = $enqueue_color_picker_alpha = false;
     1790                foreach ( $options as $option ) {
     1791                    if ( ( 'image' == $option['type'] ) && !$enqueued_media ) {
     1792                        wp_enqueue_media();
     1793                        $enqueued_media = true;
     1794                    } elseif ( 'color' == $option['type'] ) {
     1795                        $enqueue_color_picker = true;
     1796                    } elseif ( 'coloralpha' == $option['type'] ) {
     1797                        $enqueue_color_picker_alpha = true;
     1798                    }
     1799                }
     1800
     1801                // 1.2.5: moved out of
     1802                if ( $enqueue_color_picker_alpha ) {
     1803                    wp_enqueue_style( 'wp-color-picker' );
     1804                    $suffix = '.min';
     1805                    if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
     1806                        $suffix = '';
     1807                    }
     1808                    $url = plugins_url( '/js/wp-color-picker-alpha' . $suffix . '.js', $args['file'] );
     1809                    wp_enqueue_script( 'wp-color-picker-a', $url, array( 'wp-color-picker' ), '3.0.0', true );
     1810                    $enqueued_color_picker = true;
     1811                } elseif ( $enqueue_color_picker ) {
     1812                    wp_enqueue_style( 'wp-color-picker' );
     1813                    wp_enqueue_script( 'wp-color-picker' );
     1814                    $enqueued_color_picker = true;         
     1815                }
     1816
     1817                // --- enqueue print of settings scripts / styles ---
     1818                $this->settings_resources( $enqueued_media, $enqueued_color_picker );
     1819            }
     1820        }
     1821
    16621822        // -----------------
    16631823        // Add Settings Menu
     
    17181878                $page = $this->menu_added ? 'admin.php' : 'options-general.php';
    17191879                $settings_url = add_query_arg( 'page', $args['slug'], admin_url( $page ) );
    1720                 $settings_link = '<a href="' . esc_url( $settings_url ) . '">' . esc_html( __( 'Settings' ) ) . '</a>';
     1880                $settings_link = '<a href="' . esc_url( $settings_url ) . '">' . esc_html( __( 'Settings', 'radio-station' ) ) . '</a>';
    17211881                $link = array( 'settings' => $settings_link );
    17221882                $links = array_merge( $link, $links );
     
    17361896                            $upgrade_target = !strstr( $upgrade_url, '/wp-admin/' ) ? ' target="_blank"' : '';
    17371897                        }
    1738                         $upgrade_link = '<b><a href="' . esc_url( $upgrade_url ) . '"' . $upgrade_target . ">" . esc_html( __( 'Upgrade' ) ) . '</a></b>';
     1898                        $upgrade_link = '<b><a href="' . esc_url( $upgrade_url ) . '"' . $upgrade_target . ">" . esc_html( __( 'Upgrade', 'radio-station' ) ) . '</a></b>';
    17391899                        $link = array( 'upgrade' => $upgrade_link );
    17401900                        $links = array_merge( $link, $links );
     
    17441904                        if ( isset( $args['pro_link'] ) ) {
    17451905                            $pro_target = !strstr( $args['pro_link'], '/wp-admin/' ) ? ' target="_blank"' : '';
    1746                             $pro_link = '<b><a href="' . esc_url( $args['pro_link'] ) . '"' . $pro_target . '>' . esc_html( __( 'Pro Details' ) ) . '</a></b>';
     1906                            $pro_link = '<b><a href="' . esc_url( $args['pro_link'] ) . '"' . $pro_target . '>' . esc_html( __( 'Pro Details', 'radio-station' ) ) . '</a></b>';
    17471907                            $link = array( 'pro-details' => $pro_link );
    17481908                            $links = array_merge( $link, $links );
     
    17581918                        $addons_url = $args['addons_link'];
    17591919                        $addons_target = !strstr( $addons_url, '/wp-admin/' ) ? ' target="_blank"' : '';
    1760                         $addons_link = '<a href="' . esc_url( $addons_url ) . '"' . $addons_target . '>' . esc_html( __( 'Add Ons' ) ) . '</a>';
     1920                        $addons_link = '<a href="' . esc_url( $addons_url ) . '"' . $addons_target . '>' . esc_html( __( 'Add Ons', 'radio-station' ) ) . '</a>';
    17611921                        $link = array( 'addons' => $addons_link );
    17621922                        $links = array_merge( $link, $links );
     
    18131973            // 1.0.5: use sanitize_title on request variable
    18141974            // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    1815             if ( substr( sanitize_text_field( $_REQUEST['page'] ), 0, strlen( $args['slug'] ) ) != $args['slug'] ) {
     1975            if ( substr( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ), 0, strlen( $args['slug'] ) ) != $args['slug'] ) {
    18161976                return;
    18171977            }
     
    18261986            echo '<h3 class="admin-notices-title" style="cursor:pointer; margin:7px 14px; font-size:16px;" onclick="settings_toggle_notices();">' . "\n";
    18271987            echo '<span id="admin-notices-arrow" style="font-size:24px;">&#9656;</span> &nbsp; ' . "\n";
    1828             echo '<span id="admin-notices-title" style="vertical-align:top;">' . esc_html( __( 'Notices' ) ) . '</span>  &nbsp; ' . "\n";
     1988            echo '<span id="admin-notices-title" style="vertical-align:top;">' . esc_html( __( 'Notices', 'radio-station' ) ) . '</span>  &nbsp; ' . "\n";
    18291989            echo '<span id="admin-notices-count" style="vertical-align:top;"></span></h3>' . "\n";
    18301990
     
    18321992            echo '</div>' . "\n";
    18331993
    1834             // --- toggle notice box script ---
    1835             echo "<script>function settings_toggle_notices() {
    1836                 if (document.getElementById('admin-notices-wrap').style.display == '') {
    1837                     document.getElementById('admin-notices-wrap').style.display = 'none';
    1838                     document.getElementById('admin-notices-arrow').innerHTML = '&#9656;';
    1839                 } else {
    1840                     document.getElementById('admin-notices-wrap').style.display = '';
    1841                     document.getElementById('admin-notices-arrow').innerHTML= '&#9662;';
    1842                 }
    1843             } ";
    1844 
    1845             // --- modified from /wp-admin/js/common.js to move notices ---
    1846             echo "jQuery(document).ready(function() {
    1847                 setTimeout(function() {
    1848                     jQuery('div.update-nag, div.updated, div.error, div.notice').not('.inline, .below-h2').insertAfter(jQuery('#admin-notices-wrap h2'));
    1849                     count = parseInt(jQuery('#admin-notices-wrap').children().length - 1);
    1850                     if (count > 0) {jQuery('#admin-notices-count').html('('+count+')');}
    1851                     else {jQuery('#admin-notices-box').hide();}
    1852                 }, 500);
    1853             });</script>";
     1994            // 1.3.6: move notice boxer scripts to setting_scripts
     1995            // $this->scripts[] = 'notice_boxer';
    18541996
    18551997        }
     
    18632005            $namespace = $this->namespace;
    18642006            $settings = $GLOBALS[$namespace];
    1865 
    1866             // --- output debug values ---
    1867             if ( $this->debug ) {
    1868                 echo '<br><b>Current Settings:</b><br>';
    1869                 // phpcs:ignore WordPress.PHP.DevelopmentFunctions
    1870                 echo esc_html( print_r( $settings, true ) );
    1871                 echo '<br><br>' . "\n";
    1872 
    1873                 echo '<br><b>Plugin Options:</b><br>';
    1874                 // phpcs:ignore WordPress.PHP.DevelopmentFunctions
    1875                 echo esc_html( print_r( $this->options, true ) );
    1876                 echo '<br><br>' . "\n";
    1877 
    1878                 // phpcs:ignore WordPress.Security.NonceVerification.Missing
    1879                 if ( isset( $_POST ) ) {
    1880                     echo '<br><b>Posted Values:</b><br>';
    1881                     // phpcs:ignore WordPress.Security.NonceVerification.Missing
    1882                     $posted = array_map( 'sanitize_text_field', $_POST );
    1883                     foreach ( $posted as $key => $value ) {
    1884                         // phpcs:ignore WordPress.PHP.DevelopmentFunctions
    1885                         echo esc_html( $key ) . ': ' . esc_html( print_r( $value, true ) ) . '<br>' . "\n";
    1886                     }
    1887                 }
    1888             }
    18892007
    18902008            // --- check for animated gif icon with fallback to normal icon ---
     
    19552073            // 1.0.8: check if author URL is set
    19562074            if ( isset( $args['author_url'] ) ) {
    1957                 echo '<font style="font-size:16px;">' . esc_html( __( 'by' ) ) . '</font> ';
     2075                echo '<font style="font-size:16px;">' . esc_html( __( 'by', 'radio-station' ) ) . '</font> ';
    19582076                echo '<a href="' . esc_url( $args['author_url'] ) . '" target="_blank" style="text-decoration:none;font-size:16px;" target="_blank"><b>' . esc_html( $args['author'] ) . '</b></a><br><br>' . "\n";
    19592077            }
     
    19652083            $links = array();
    19662084            if ( isset( $args['home'] ) ) {
    1967                 $links[] = '<a href="' . esc_url( $args['home'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Homepage' ) ) . '" target="_blank"><b>' . esc_html( __( 'Home' ) ) . '</b></a>';
     2085                $links[] = '<a href="' . esc_url( $args['home'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Homepage', 'radio-station' ) ) . '" target="_blank"><b>' . esc_html( __( 'Home', 'radio-station' ) ) . '</b></a>';
    19682086            }
    19692087            if ( !isset( $args['readme'] ) || ( false !== $args['readme'] ) ) {
    19702088                $readme_url = add_query_arg( 'action', $namespace . '_readme_viewer', admin_url( 'admin-ajax.php' ) );
    1971                 $links[] = '<a href="' . esc_url( $readme_url ) . '" class="pluginlink smalllink thickbox" title="' . esc_attr( __( 'View Plugin' ) ) . ' readme.txt"><b>' . esc_html( __( 'Readme' ) ) . '</b></a>';
     2089                $links[] = '<a href="' . esc_url( $readme_url ) . '" class="pluginlink smalllink thickbox" title="' . esc_attr( __( 'View Plugin', 'radio-station' ) ) . ' readme.txt"><b>' . esc_html( __( 'Readme', 'radio-station' ) ) . '</b></a>';
    19722090            }
    19732091            if ( isset( $args['docs'] ) ) {
    1974                 $links[] = '<a href="' . esc_url( $args['docs'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Documentation' ) ) . '" target="_blank"><b>' . esc_html( __( 'Docs' ) ) . '</b></a>';
     2092                $links[] = '<a href="' . esc_url( $args['docs'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Documentation', 'radio-station' ) ) . '" target="_blank"><b>' . esc_html( __( 'Docs', 'radio-station' ) ) . '</b></a>';
    19752093            }
    19762094            if ( isset( $args['support'] ) ) {
    1977                 $links[] = '<a href="' . esc_url( $args['support'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Support' ) ) . '" target="_blank"><b>' . esc_html( __( 'Support' ) ) . '</b></a>';
     2095                $links[] = '<a href="' . esc_url( $args['support'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Support', 'radio-station' ) ) . '" target="_blank"><b>' . esc_html( __( 'Support', 'radio-station' ) ) . '</b></a>';
    19782096            }
    19792097            if ( isset( $args['development'] ) ) {
    1980                 $links[] = '<a href="' . esc_url( $args['development'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Development' ) ) . '" target="_blank"><b>' . esc_html( __( 'Dev' ) ) . '</b></a>';
     2098                $links[] = '<a href="' . esc_url( $args['development'] ) . '" class="pluginlink smalllink" title="' . esc_attr( __( 'Plugin Development', 'radio-station' ) ) . '" target="_blank"><b>' . esc_html( __( 'Dev', 'radio-station' ) ) . '</b></a>';
    19812099            }
    19822100
     
    20262144                    $rate_text = $args['ratetext'];
    20272145                } else {
    2028                     $rate_text = __( 'Rate on WordPress.Org' );
     2146                    $rate_text = __( 'Rate on WordPress.Org', 'radio-station' );
    20292147                }
    20302148                $rate_link = '<a href="' . esc_url( $rate_url ) . '" class="pluginlink" target="_blank">';
     
    20432161                    $share_text = $args['sharetext'];
    20442162                } else {
    2045                     $share_text = __( 'Share the Plugin Love' );
     2163                    $share_text = __( 'Share the Plugin Love', 'radio-station' );
    20462164                }
    20472165                $share_link = '<a href="' . esc_url( $args['share'] ) . '" class="pluginlink" target="_blank">';
     
    20602178                    $donate_text = $args['donatetext'];
    20612179                } else {
    2062                     $donate_text = __( 'Support this Plugin' );
     2180                    $donate_text = __( 'Support this Plugin', 'radio-station' );
    20632181                }
    20642182                $donate_link = '<a href="' . esc_url( $args['donate'] ) . '" class="pluginlink" target="_blank">';
     
    20782196            if ( isset( $_GET['updated'] ) ) {
    20792197                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    2080                 $updated = sanitize_text_field( $_GET['updated'] );
     2198                $updated = sanitize_text_field( wp_unslash( $_GET['updated'] ) );
    20812199                if ( 'yes' == $updated ) {
    2082                     $message = $settings['title'] . ' ' . __( 'Settings Updated.' );
     2200                    $message = $settings['title'] . ' ' . __( 'Settings Updated.', 'radio-station' );
    20832201                } elseif ( 'no' == $updated ) {
    2084                     $message = __( 'Error! Settings NOT Updated.' );
     2202                    $message = __( 'Error! Settings NOT Updated.', 'radio-station' );
    20852203                } elseif ( 'reset' == $updated ) {
    2086                     $message = $settings['title'] . ' ' . __( 'Settings Reset!' );
     2204                    $message = $settings['title'] . ' ' . __( 'Settings Reset!', 'radio-station' );
    20872205                }
    20882206                if ( isset( $message ) ) {
     
    20962214                // 1.0.5: use sanitize_title on request variable
    20972215                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    2098                 if ( isset( $_REQUEST['welcome'] ) && ( 'true' == sanitize_text_field( $_REQUEST['welcome'] ) ) ) {
     2216                if ( isset( $_REQUEST['welcome'] ) && ( 'true' == sanitize_text_field( wp_unslash( $_REQUEST['welcome'] ) ) ) ) {
    20992217                    // 1.2.3: skip output if welcome message argument is empty
    21002218                    if ( isset( $args['welcome'] ) && ( '' != $args['welcome'] ) ) {
    21012219                        echo '<tr><td colspan="3" align="center">';
    2102                         // 1.2.5: use direct echo option for message box
    2103                         $this->message_box( $args['welcome'], true );
     2220                            // 1.2.5: use direct echo option for message box
     2221                            $this->message_box( $args['welcome'], true );
    21042222                        echo '</td></tr>' . "\n";
    21052223                    }
     
    21532271            $options = apply_filters( $namespace . '_options', $options );
    21542272
    2155             // --- maybe enqueue media scripts ---
    2156             // 1.1.7: added media gallery script enqueueing for image field
    2157             // 1.1.7: added color picker and color picker alpha script enqueueing
    2158             $enqueued_media = $enqueued_color_picker = $enqueue_color_picker = $enqueue_color_picker_alpha = false;
    2159             foreach ( $options as $option ) {
    2160                 if ( ( 'image' == $option['type'] ) && !$enqueued_media ) {
    2161                     wp_enqueue_media();
    2162                     $enqueued_media = true;
    2163                 } elseif ( 'color' == $option['type'] ) {
    2164                     $enqueue_color_picker = true;
    2165                 } elseif ( 'coloralpha' == $option['type'] ) {
    2166                     $enqueue_color_picker_alpha = true;
    2167                 }
    2168             }
    2169 
    2170             // 1.2.5: moved out of
    2171             if ( $enqueue_color_picker_alpha ) {
    2172                 wp_enqueue_style( 'wp-color-picker' );
    2173                 $suffix = '.min';
    2174                 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    2175                     $suffix = '';
    2176                 }
    2177                 $url = plugins_url( '/js/wp-color-picker-alpha' . $suffix . '.js', $args['file'] );
    2178                 wp_enqueue_script( 'wp-color-picker-a', $url, array( 'wp-color-picker' ), '3.0.0', true );
    2179                 $enqueued_color_picker = true;
    2180             } elseif ( $enqueue_color_picker ) {
    2181                 wp_enqueue_style( 'wp-color-picker' );
    2182                 wp_enqueue_script( 'wp-color-picker' );
    2183                 $enqueued_color_picker = true;         
    2184             }
    2185 
    21862273            $defaults = $this->default_settings();
    21872274            $settings = $this->get_settings( false );
     
    22002287
    22012288            $currenttab = '';
    2202             if ( isset( $settings['settingstab'] ) ) {
     2289            // 1.3.4: allow for switching setting tab via querystring
     2290            if ( isset( $_REQUEST['tab'] ) ) {
     2291                $currenttab = sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) );
     2292            } elseif ( isset( $settings['settingstab'] ) ) {
    22032293                $currenttab = $settings['settingstab'];
    22042294            }
     
    22452335                // 1.0.9: add to settings scripts
    22462336                // 1.2.5: only store script reference
    2247                 $this->scripts[] = 'tab_switcher';
     2337                // $this->scripts[] = 'tab_switcher';
    22482338
    22492339                $i = 0;
     
    22612351                echo '</ul>' . "\n";
    22622352            } else {
    2263                 $tabs = array( 'general' => __( 'General' ) );
     2353                $tabs = array( 'general' => __( 'General', 'radio-station' ) );
    22642354            }
    22652355
    22662356            // --- reset to default script ---
    22672357            // 1.0.9: add to settings scripts
    2268             $this->scripts[] = 'settings_reset';
     2358            // $this->scripts[] = 'settings_reset';
    22692359
    22702360            // --- start settings form ---
     
    23532443                $buttons .= '<tr><td align="center">' . "\n";
    23542444                // 1.2.5: remove reset onclick attribute
    2355                 $buttons .= '<input type="button" id="settingsresetbutton" class="button-secondary settings-button" value="' . esc_attr( __( 'Reset Settings' ) ) . '">' . "\n";
     2445                $buttons .= '<input type="button" id="settingsresetbutton" class="button-secondary settings-button" value="' . esc_attr( __( 'Reset Settings', 'radio-station' ) ) . '">' . "\n";
    23562446                $buttons .= '</td><td colspan="3"></td><td align="center">' . "\n";
    2357                 $buttons .= '<input type="submit" class="button-primary settings-button" value="' . esc_attr( __( 'Save Settings' ) ) . '">' . "\n";
     2447                $buttons .= '<input type="submit" class="button-primary settings-button" value="' . esc_attr( __( 'Save Settings', 'radio-station' ) ) . '">' . "\n";
    23582448                $buttons .= '</td></tr>' . "\n";
    23592449                $buttons .= '<tr height="25"><td></td></tr>' . "\n";
     
    23832473
    23842474            // --- enqueue settings resources ---
    2385             $this->settings_resources( $enqueued_media, $enqueued_color_picker );
     2475            // 1.3.4: moved settings resources enqueue to admin_enqueue_scripts
    23862476        }
    23872477
     
    24562546        public function settings_resources( $media = true, $color_picker = true ) {
    24572547
     2548            // 1.3.5: set default scripts to enqueue
     2549            $this->scripts = array( 'notice_boxer', 'tab_switcher', 'settings_reset' );
     2550
    24582551            // --- number input step script ---
    24592552            // 1.0.9: added to script array
     
    24732566
    24742567            // --- enqueue settings scripts ---
    2475             add_action( 'admin_footer', array( $this, 'setting_scripts' ) );
     2568            // 1.3.4: change from admin_footer hook
     2569            // 1.3.5: change back to admin_footer hook (for jQuery!)
     2570            // 1.3.6: enqueue and append to dummy admin script
     2571            // add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     2572            // add_action( 'admin_footer', array( $this, 'setting_scripts' ) );
     2573            $this->enqueue_scripts();
    24762574
    24772575            // --- enqueue settings styles ---
    2478             add_action( 'admin_footer', array( $this, 'setting_styles' ) );
     2576            // 1.3.4: change from admin_footer hook
     2577            // 1.3.6: enqueue and append to dummy admin style
     2578            // add_action( 'admin_enqueue_styles', array( $this, 'enqueue_styles' ) );
     2579            // add_action( 'admin_print_styles', array( $this, 'setting_styles' ) );
     2580            $this->enqueue_styles();
    24792581
    24802582        }
     
    25422644            $row .= '<td class="settings-label">' . $option['label'] . "\n";
    25432645            if ( 'multiselect' == $type ) {
    2544                 $row .= '<br><span>' . esc_html( __( 'Use Ctrl and Click to Select' ) ) . '</span>' . "\n";
     2646                $row .= '<br><span>' . esc_html( __( 'Use Ctrl and Click to Select', 'radio-station' ) ) . '</span>' . "\n";
    25452647            }
    25462648            $row .= '</td><td width="25"></td>' . "\n";
     
    25812683                    if ( $upgrade_link || isset( $pro_link ) ) {
    25822684                        // 1.2.2: change text from Available in Pro
    2583                         $row .= __( 'Premium Feature.' ) . '<br>';
     2685                        $row .= __( 'Premium Feature.', 'radio-station' ) . '<br>';
    25842686                        if ( $upgrade_link ) {
    2585                             $row .= '<a href="' . esc_url( $upgrade_link ) . '"' . $upgrade_target . '>' . esc_html( __( 'Upgrade Now' ) ) . '</a>';
     2687                            $row .= '<a href="' . esc_url( $upgrade_link ) . '"' . $upgrade_target . '>' . esc_html( __( 'Upgrade Now', 'radio-station' ) ) . '</a>';
    25862688                        }
    25872689                        if ( $upgrade_link && isset( $pro_link ) ) {
     
    25922694                            // 1.3.0: add hash link anchor for Pro feature options
    25932695                            $option_anchor = str_replace( '_', '-', $option['key'] );
    2594                             $row .= '<a href="' . esc_url( $pro_link ) . '#' . esc_attr( $option_anchor ) . '"' . $pro_target . '>' . esc_html( __( 'Details' ) ) . '</a>' . "\n";
     2696                            $row .= '<a href="' . esc_url( $pro_link ) . '#' . esc_attr( $option_anchor ) . '"' . $pro_target . '>' . esc_html( __( 'Details', 'radio-station' ) ) . '</a>' . "\n";
    25952697                        }
    25962698                    } else {
    2597                         $row .= esc_html( __( 'Coming soon in Pro version!' ) );
     2699                        $row .= esc_html( __( 'Coming soon in Pro version!', 'radio-station' ) );
    25982700                    }
    25992701                    $row .= '</td>' . "\n";
     
    29173019                            }
    29183020                            $row .= '<a class="upload-custom-image' . esc_attr( $hidden ) . '" href="' . esc_url( $upload_link ) . '">' . "\n";
    2919                             $row .= esc_html( __( 'Add Image' ) );
     3021                            $row .= esc_html( __( 'Add Image', 'radio-station' ) );
    29203022                            $row .= '</a>' . "\n";
    29213023
     
    29253027                            }
    29263028                            $row .= '<a class="delete-custom-image' . esc_attr( $hidden ) . '" href="#">' . "\n";
    2927                             $row .= esc_html( __( 'Remove Image' ) );
     3029                            $row .= esc_html( __( 'Remove Image', 'radio-station' ) );
    29283030                            $row .= '</a>' . "\n";
    29293031                        $row .= '</p>' . "\n";
     
    29633065
    29643066            return $row;
     3067        }
     3068
     3069        // ---------------
     3070        // Enqueue Scripts
     3071        // ---------------
     3072        // 1.3.6: enqueue scripts inline via dummy script
     3073        public function enqueue_scripts() {
     3074           
     3075            $version = $this->plugin_version();
     3076            wp_register_script( 'plugin-admin-settings', null, array( 'jquery' ), $version, true );
     3077            wp_enqueue_script( 'plugin-admin-settings' );
     3078            $js = $this->setting_scripts();
     3079            wp_add_inline_script( 'plugin-admin-settings', $js, 'after' );
     3080
    29653081        }
    29663082
     
    29733089            $args = $this->args;
    29743090            $scripts = $this->scripts;
     3091
    29753092            if ( count( $scripts ) > 0 ) {
    2976                 echo "<script>";
     3093
     3094                // 1.3.6: buffer script output
     3095                ob_start();
     3096               
    29773097                foreach ( $scripts as $script ) {
    29783098
     
    30003120                        echo "});" . "\n";
    30013121
     3122                    } elseif ( 'notice_boxer' == $script ) {
     3123                       
     3124                        // --- toggle notice box script ---
     3125                        echo "function settings_toggle_notices() {
     3126                            if (document.getElementById('admin-notices-wrap').style.display == '') {
     3127                                document.getElementById('admin-notices-wrap').style.display = 'none';
     3128                                document.getElementById('admin-notices-arrow').innerHTML = '&#9656;';
     3129                            } else {
     3130                                document.getElementById('admin-notices-wrap').style.display = '';
     3131                                document.getElementById('admin-notices-arrow').innerHTML= '&#9662;';
     3132                            }
     3133                        }" . "\n";
     3134
     3135                        // --- modified from /wp-admin/js/common.js to move notices ---
     3136                        echo "jQuery(document).ready(function() {
     3137                            setTimeout(function() {
     3138                                jQuery('div.update-nag, div.updated, div.error, div.notice').not('.inline, .below-h2').insertAfter(jQuery('#admin-notices-wrap h2'));
     3139                                count = parseInt(jQuery('#admin-notices-wrap').children().length - 1);
     3140                                if (count > 0) {jQuery('#admin-notices-count').html('('+count+')');}
     3141                                else {jQuery('#admin-notices-box').hide();}
     3142                            }, 500);
     3143                        });" . "\n";
     3144                       
    30023145                    } elseif ( 'settings_reset' == $script ) {
    30033146
     
    30053148                        // 1.2.5: changed function prefix for consistency
    30063149                        // 1.2.5: changed to jQuery click function to remove onclick button attribute
    3007                         $confirmreset = __( 'Are you sure you want to reset to default settings?' );
     3150                        $confirmreset = __( 'Are you sure you want to reset to default settings?', 'radio-station' );
    30083151                        // echo "function plugin_panel_reset_defaults() {" . "\n";
    30093152                        echo "jQuery('#settingsresetbutton').on('click', function() {" . "\n";
     
    30463189
    30473190                        // --- media functions ---
    3048                         $confirm_remove = __( 'Are you sure you want to remove this image?' );
     3191                        $confirm_remove = __( 'Are you sure you want to remove this image?', 'radio-station' );
    30493192                        echo "jQuery(function(){
    30503193
     
    31023245
    31033246                    }
    3104                     // else {
    3105                         // [no longer implemented - no escape option]
    3106                         // echo $script;
    3107                     // }
     3247
    31083248                }
    31093249
    31103250                // 1.2.5: added for possible extra settings scripts
    31113251                do_action( $args['namespace'] . '_settings_scripts', $args );
    3112 
    3113                 echo "</script>";
    3114             }
     3252               
     3253                $js = ob_get_contents();
     3254                ob_end_clean();
     3255                return $js;
     3256
     3257            }
     3258        }
     3259       
     3260        // --------------
     3261        // Enqueue Styles
     3262        // --------------
     3263        // 1.3.6: enqueue styles inline via dummy stylesheet
     3264        public function enqueue_styles() {
     3265           
     3266            $version = $this->plugin_version();
     3267            wp_register_style( 'plugin-admin-settings', null, array(), $version, 'all' );
     3268            wp_enqueue_style( 'plugin-admin-settings' );
     3269            $css = $this->setting_styles();
     3270            wp_add_inline_style( 'plugin-admin-settings', $css );
     3271           
    31153272        }
    31163273
     
    31883345            $namespace = $this->namespace;
    31893346            $styles = apply_filters( $namespace . '_admin_page_styles', $styles );
     3347            $styles_string = implode( "\n", $styles );
     3348
    31903349            // 1.2.5: added wp_strip_all_tags to styles output
    31913350            // 1.3.0: use wp_kses_post on styles output
    3192             // echo wp_strip_all_tags( implode( "\n", $styles ) );
    3193             echo "<style>" . wp_kses_post( implode( "\n", $styles ) ) . "</style>";
    3194 
     3351            // 1.3.6: return style string instead of echo
     3352            // echo wp_strip_all_tags( istyles_string ) );
     3353            return $styles_string;
    31953354        }
    31963355
     
    34633622
    34643623// =========
    3465 // STRUCTURE
    3466 // =========
    3467 //
    3468 // === Loader Class ===
    3469 // - Initialize Loader
    3470 // - Setup Plugin
    3471 // - Get Plugin Data
    3472 // - Get Plugin Version
    3473 // - Set Pro Namespace
    3474 // === Plugin Settings ===
    3475 // - Get Default Settings
    3476 // - Add Settings
    3477 // - Maybe Transfer Settings
    3478 // - Get All Plugin Settings
    3479 // - Get Plugin Setting
    3480 // - Reset Plugin Settings
    3481 // - Update Plugin Settings
    3482 // - Validate Plugin Setting
    3483 // === Plugin Loading ===
    3484 // - Load Plugin Settings
    3485 // - Add Actions
    3486 // - Load Helper Libraries
    3487 // - Maybe Load Thickbox
    3488 // - Readme Viewer AJAX
    3489 // === Freemius Loading ===
    3490 // - Load Freemius
    3491 // - Filter Freemius Connect
    3492 // - Freemius Connect Message
    3493 // - Connect Update Message
    3494 // === Plugin Admin ===
    3495 // - Add Settings Menu
    3496 // - Plugin Page Links
    3497 // - Message Box
    3498 // - Notice Boxer
    3499 // - Plugin Page Header
    3500 // - Settings Page
    3501 // - Settings Table
    3502 // - Setting Row
    3503 // - Settings Scripts
    3504 // - Settings Styles
    3505 // === Namespaced Functions ===
    3506 
    3507 
    3508 // =========
    35093624// CHANGELOG
    35103625// =========
     3626
     3627// == 1.3.4 ==
     3628// - switch to settings tab via querystring
     3629// - enqueue settings page resources earlier
     3630
     3631// == 1.3.3 ==
     3632// - move post debug output to after check_admin_referer
     3633
     3634// == 1.3.2 ==
     3635// - added isset and wp_unslash to $_REQUEST inputs
     3636
     3637// == 1.3.1 ==
     3638// - use prefixed markdown reader function
     3639// - when reading strip any license lines causing breakage
     3640// - update to color picker alpha library (3.0.4)
     3641// - added text domain to translation wrappers (for replacing)
    35113642
    35123643// == 1.3.0 ==
  • adminsanity/trunk/readme.md

    r3115930 r3316572  
    44Tags: wordpress admin, admin menu, admin notices, admin bar, cleaner
    55Requires at least: 4.0.0
    6 Tested up to: 6.5.5
    7 Stable tag: 1.0.3
     6Tested up to: 6.8.1
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    124124== Changelog ==
    125125
     126= 1.0.4 =
     127* Updated: Plugin Panel (1.3.5)
     128* Fixed: Admin Bar Frontend module loading option key
     129
    126130= 1.0.3 =
    127131* Improved: do not load Menu/Notices on Block Editor pages
  • adminsanity/trunk/readme.txt

    r3115930 r3316572  
    44Tags: wordpress admin, admin menu, admin notices, admin bar, cleaner
    55Requires at least: 4.0.0
    6 Tested up to: 6.5.5
    7 Stable tag: 1.0.3
     6Tested up to: 6.8.1
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    124124== Changelog ==
    125125
     126= 1.0.4 =
     127* Updated: Plugin Panel (1.3.5)
     128* Fixed: Admin Bar Frontend module loading option key
     129
    126130= 1.0.3 =
    127131* Improved: do not load Menu/Notices on Block Editor pages
Note: See TracChangeset for help on using the changeset viewer.