Plugin Directory

Changeset 3039297


Ignore:
Timestamp:
02/21/2024 03:32:51 PM (2 years ago)
Author:
jimmitchell
Message:

tagging version 1.0.5

Location:
jmitch-tinylytics
Files:
12 edited
11 copied

Legend:

Unmodified
Added
Removed
  • jmitch-tinylytics/tags/1.0.5/css/style.css

    r3035382 r3039297  
    1 .wp-admin .tiny-warning-message {
    2     color: crimson;
    3     font-weight: bold;
    4     text-decoration: underline;
    5 }
    61.wp-admin .tab-content {
    72    display: flex;
  • jmitch-tinylytics/tags/1.0.5/inc/admin-settings.php

    r3035382 r3039297  
    1313    <form method="post" action="options.php">
    1414    <?php
    15         settings_fields('jmitch_tinylytics_settings_group');
    16         do_settings_sections('jmitch-tinylytics');
     15        settings_fields( 'jmitch_tinylytics_settings_group' );
     16        do_settings_sections( 'jmitch-tinylytics' );
    1717        submit_button();
    1818        ?>
  • jmitch-tinylytics/tags/1.0.5/inc/admin-shortcodes.php

    r3035382 r3039297  
    1212?>
    1313
    14 <h2><?php esc_html_e( 'Shortcodes','jmitch-tinylytics' ); ?></h2>
     14<h2><?php esc_html_e( 'Shortcodes', 'jmitch-tinylytics' ); ?></h2>
    1515
    16 <p>Tinylytics <?php esc_html_e( 'comes comes with a variety of shortcodes which can be embedded directly in a post, page, or theme block to reduce the need for extensive HTML customizations','jmitch-tinylytics' ); ?>.</p>
     16<p>Tinylytics <?php esc_html_e( 'comes comes with a variety of shortcodes which can be embedded directly in a post, page, or theme block to reduce the need for extensive HTML customizations', 'jmitch-tinylytics' ); ?>.</p>
    1717
    1818<table class="form-table" role="presentation" style="width:100%;">
    19     <tr><th style="width:20%;">[tinykudos]</th><td><?php esc_html_e( 'Displays an interactive button to track "kudos" given by readers. Best used directly in posts and pages','jmitch-tinylytics' ); ?>.</td></tr>
    20     <tr><th>[tinyhits]</th><td><?php esc_html_e( 'Displays a count of page loads of the page viewed. Best used directly in posts and pages','jmitch-tinylytics' ); ?>.</td></tr>
    21     <tr><th>[tinystats]</th><td><?php esc_html_e( 'Displays both overall site hits and uptime (Note: a Tinylytics subscription is required to display uptime). Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
    22     <tr><th>[tinywebring]</th><td><?php esc_html_e( 'Displays a random link to a Tinylytics webring site. Enabling the "Display webring avatars?" option will include the avatar if the site has one. Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
    23     <tr><th>[tinyflags]</th><td><?php esc_html_e( 'Displays flags from all the countries of site visitors. Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
     19    <tr><th style="width:20%;">[tinykudos]</th><td><?php esc_html_e( 'Displays an interactive button to track "kudos" given by readers. Best used directly in posts and pages', 'jmitch-tinylytics' ); ?>.</td></tr>
     20    <tr><th>[tinyhits]</th><td><?php esc_html_e( 'Displays a count of page loads of the page viewed. Best used directly in posts and pages', 'jmitch-tinylytics' ); ?>.</td></tr>
     21    <tr><th>[tinystats]</th><td><?php esc_html_e( 'Displays both overall site hits and uptime (Note: a Tinylytics subscription is required to display uptime). Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
     22    <tr><th>[tinywebring]</th><td><?php esc_html_e( 'Displays a random link to a Tinylytics webring site. Enabling the "Display webring avatars?" option will include the avatar if the site has one. Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
     23    <tr><th>[tinyflags]</th><td><?php esc_html_e( 'Displays flags from all the countries of site visitors. Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
    2424</table>
    2525
    26 <p><?php esc_html_e( 'Learn how to use the','jmitch-tinylytics' ); ?> <a href="https://wordpress.org/documentation/article/shortcode-block/" target="_blank"><?php esc_html_e( 'Shortcode Block','jmitch-tinylytics' ); ?></a> <?php esc_html_e( 'in your theme. More information about','jmitch-tinylytics' ); ?> <a href="https://tinylytics.app" target="_blank">Tinylytics</a> <?php esc_html_e( 'options can be found in the','jmitch-tinylytics' ); ?> <a href="https://tinylytics.app/docs" target="_blank"><?php esc_html_e( 'documentation','jmitch-tinylytics' ); ?></a>.</p>
     26<p><?php esc_html_e( 'Learn how to use the', 'jmitch-tinylytics' ); ?> <a href="https://wordpress.org/documentation/article/shortcode-block/" target="_blank"><?php esc_html_e( 'Shortcode Block', 'jmitch-tinylytics' ); ?></a> <?php esc_html_e( 'in your theme. More information about', 'jmitch-tinylytics' ); ?> <a href="https://tinylytics.app" target="_blank">Tinylytics</a> <?php esc_html_e( 'options can be found in the', 'jmitch-tinylytics' ); ?> <a href="https://tinylytics.app/docs" target="_blank"><?php esc_html_e( 'documentation', 'jmitch-tinylytics' ); ?></a>.</p>
  • jmitch-tinylytics/tags/1.0.5/inc/admin-support.php

    r3037227 r3039297  
    1212?>
    1313
    14 <h2 style="text-align:center;"><?php esc_html_e( 'Your Support Matters','jmitch-tinylytics' ); ?></h2>
     14<h2 style="text-align:center;"><?php esc_html_e( 'Your Support Matters', 'jmitch-tinylytics' ); ?></h2>
    1515
    16 <p><?php esc_html_e( 'Though I freely provide this plugin to the WordPress community, consider making a small donation. A few bucks goes a long way towards making improvements','jmitch-tinylytics' ); ?>.</p>
    17 <p><strong><?php esc_html_e( 'Note:','jmitch-tinylytics' ); ?></strong> <?php esc_html_e( 'Making a donation gets you priority support if you need it','jmitch-tinylytics' ); ?>.</p>
     16<p><?php esc_html_e( 'Though I freely provide this plugin to the WordPress community, consider making a small donation. A few bucks goes a long way towards making improvements', 'jmitch-tinylytics' ); ?>.</p>
     17<p><strong><?php esc_html_e( 'Note:', 'jmitch-tinylytics' ); ?></strong> <?php esc_html_e( 'Making a donation gets you priority support if you need it', 'jmitch-tinylytics' ); ?>.</p>
    1818<p style="margin-top:25px;"><a href="https://donate.stripe.com/9AQ8Ab6Yr8Y67cYdQR" target="_blank" class="donate-button"><?php esc_html_e( 'Support Continued Development' ); ?></a></p>
  • jmitch-tinylytics/tags/1.0.5/inc/user-shortcodes.php

    r3035382 r3039297  
    1313function jmitch_tinylytics_kudos_function() {
    1414    $output = '';
    15     $options = get_option('jmitch_tinylytics_settings');
     15    $options = get_option( 'jmitch_tinylytics_settings' );
    1616    $kudos = $options['display_kudos'];
    17     if ($kudos) {
    18         $output = '<button class="tinylytics_kudos" data-path="'. wp_make_link_relative(get_permalink()) .'"></button>';
     17    if ( $kudos ) {
     18        $output = '<button class="tinylytics_kudos" data-path="'. wp_make_link_relative( get_permalink() ) .'"></button>';
    1919    }
    2020    return $output;
    2121}
    22 add_shortcode('tinykudos','jmitch_tinylytics_kudos_function');
     22add_shortcode( 'tinykudos', 'jmitch_tinylytics_kudos_function' );
    2323
    2424// *** Hits shortcode
    2525function jmitch_tinylytics_hits_function() {
    2626    $output = '';
    27     $options = get_option('jmitch_tinylytics_settings');
     27    $options = get_option( 'jmitch_tinylytics_settings' );
    2828    $hits = $options['display_hits'];
    29     if ($hits) {
    30         $output = '<span class="tinylytics_hits" data-path="'. wp_make_link_relative(get_permalink()) .'"></span>';
     29    if ( $hits ) {
     30        $output = '<span class="tinylytics_hits" data-path="'. wp_make_link_relative( get_permalink() ) .'"></span>';
    3131    }
    3232    return $output;
    3333}
    34 add_shortcode('tinyhits','jmitch_tinylytics_hits_function');
     34add_shortcode( 'tinyhits', 'jmitch_tinylytics_hits_function' );
    3535
    3636// *** Web ring shortcode
    3737function jmitch_tinylytics_webring_function() {
    3838    $output = '';
    39     $options = get_option('jmitch_tinylytics_settings');
     39    $options = get_option( 'jmitch_tinylytics_settings' );
    4040    $webring = $options['display_webring'];
    4141    $webring_label = $options['webring_label'];
    4242    $avatars = $options['display_avatars'];
    43     if ($webring) {
     43    if ( $webring ) {
    4444        $show_avatar = $avatars ? '<img class="tinylytics_webring_avatar" src="" style="display: none"/>' : '';
    45         if ($webring_label === '') {
    46             $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring','jmitch-tinylytics' ) . '">🕸️' . $show_avatar . '💍</a></span>';
     45        if ( $webring_label === '' ) {
     46            $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring', 'jmitch-tinylytics' ) . '">🕸️' . $show_avatar . '💍</a></span>';
    4747        } else {
    48             $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring','jmitch-tinylytics' ) . '">'. $show_avatar . $webring_label . '</a></span>';
     48            $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring', 'jmitch-tinylytics' ) . '">'. $show_avatar . $webring_label . '</a></span>';
    4949        }
    5050    }
    5151    return $output;
    5252}
    53 add_shortcode('tinywebring','jmitch_tinylytics_webring_function');
     53add_shortcode( 'tinywebring', 'jmitch_tinylytics_webring_function' );
    5454
    5555// *** Country flags shortcode
    5656function jmitch_tinylytics_flags_function() {
    5757    $output = '';
    58     $options = get_option('jmitch_tinylytics_settings');
     58    $options = get_option( 'jmitch_tinylytics_settings' );
    5959    $flags = $options['display_flags'];
    60     if ($flags) {
     60    if ( $flags ) {
    6161        $output = '<p><span class="tinylytics_countries"></span></p>';
    6262    }
    6363    return $output;
    6464}
    65 add_shortcode('tinyflags','jmitch_tinylytics_flags_function');
     65add_shortcode( 'tinyflags', 'jmitch_tinylytics_flags_function' );
    6666
    6767// *** Stats shortcode
    6868function jmitch_tinylytics_stats_function() {
    6969    $output = '';
    70     $options = get_option('jmitch_tinylytics_settings');
     70    $options = get_option( 'jmitch_tinylytics_settings' );
    7171    $stats = $options['display_stats'];
    7272    $hits = $options['display_hits'];
    7373    $uptime = $options['display_uptime'];
    74     if ($stats && $hits) {
    75         $output .= '<span class="tiny_counter"><a href="" target="_blank" class="tinylytics_public_stats">' . esc_html__( 'My Stats','jmitch-tinylytics' ) . '</a>: <span class="tinylytics_hits"></span></span>';
     74    if ( $stats && $hits ) {
     75        $output .= '<span class="tiny_counter"><a href="" target="_blank" class="tinylytics_public_stats">' . esc_html__( 'My Stats', 'jmitch-tinylytics' ) . '</a>: <span class="tinylytics_hits"></span></span>';
    7676    }
    77     else if ($hits) {
     77    else if ( $hits ) {
    7878        $output .= '<span class="tiny_counter"><a href="https://tinylytics.app">Tinylytics</a>: <span class="tinylytics_hits"></span></span>';
    7979    }
    80     if ($uptime) {
     80    if ( $uptime ) {
    8181        $output .= ' <span class="tiny_uptime">Uptime: <span class="tinylytics_uptime"></span></span>';
    8282    }
    8383    return $output;
    8484}
    85 add_shortcode('tinystats','jmitch_tinylytics_stats_function');
     85add_shortcode( 'tinystats', 'jmitch_tinylytics_stats_function' );
    8686
    8787?>
  • jmitch-tinylytics/tags/1.0.5/jmitch-tinylytics.php

    r3037227 r3039297  
    1010 * Requires at least: 4.6
    1111 * Test up to: 6.4.3
    12  * Version: 1.0.4
     12 * Version: 1.0.5
    1313 * Requires PHP: 5.6.20
    1414 * Text Domain: jmitch-tinylytics
     
    3434*/
    3535
    36  if (!defined('ABSPATH')) die();
    37 
    38  define( 'TINYLYTICS__VERSION', '1.0.4' );
     36if ( !defined( 'ABSPATH' )) die();
     37
     38define( 'TINYLYTICS__VERSION', '1.0.5' );
    3939
    4040// Hook functions into WordPress
    41 add_action('admin_init', 'jmitch_tinylytics_register_settings');
    42 add_action('admin_menu', 'jmitch_tinylytics_add_menu_page');
    43 add_action('init', 'jmitch_tinylytics_load_i18n');
     41add_action( 'admin_init', 'jmitch_tinylytics_register_settings' );
     42add_action( 'admin_menu', 'jmitch_tinylytics_add_menu_page' );
     43add_action( 'init', 'jmitch_tinylytics_load_i18n' );
    4444
    4545// Register the settings
    4646function jmitch_tinylytics_register_settings() {
    4747
    48     register_setting('jmitch_tinylytics_settings_group', 'jmitch_tinylytics_settings', 'jmitch_tinylytics_sanitize_options');
    49    
    50     add_settings_section('jmitch_tinylytics_general_section', esc_html__( 'General Settings','jmitch-tinylytics' ), 'jmitch_tinylytics_general_section_callback', 'jmitch-tinylytics');
    51     add_settings_section('jmitch_tinylytics_options_section', esc_html__( 'Tinylytics Options','jmitch-tinylytics' ), 'jmitch_tinylytics_options_section_callback', 'jmitch-tinylytics');
    52    
    53     add_settings_field('site_id', esc_html__( 'Site ID','jmitch-tinylytics' ), 'jmitch_tinylytics_site_id_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_general_section');
    54     add_settings_field('display_hits', esc_html__( 'Display hits?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_hits_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    55     add_settings_field('display_stats', esc_html__( 'Link to your public stats?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_stats_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    56     add_settings_field('display_uptime', esc_html__( 'Display uptime?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_uptime_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    57     add_settings_field('display_kudos', esc_html__( 'Display Kudos?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_kudos_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    58     add_settings_field('kudos_label', esc_html__( 'Kudos label','jmitch-tinylytics' ), 'jmitch_tinylytics_kudos_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    59     add_settings_field('display_webring', esc_html__( 'Display webring?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_webring_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    60     add_settings_field('webring_label', esc_html__( 'Webring label','jmitch-tinylytics' ), 'jmitch_tinylytics_webring_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    61     add_settings_field('display_avatars', esc_html__( 'Display webring avatars?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_avatars_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    62     add_settings_field('display_flags', esc_html__( 'Display country flags?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_flags_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
     48    register_setting( 'jmitch_tinylytics_settings_group', 'jmitch_tinylytics_settings', 'jmitch_tinylytics_sanitize_options' );
     49   
     50    add_settings_section( 'jmitch_tinylytics_general_section', esc_html__( 'General Settings','jmitch-tinylytics' ), 'jmitch_tinylytics_general_section_callback', 'jmitch-tinylytics' );
     51    add_settings_section( 'jmitch_tinylytics_options_section', esc_html__( 'Tinylytics Options','jmitch-tinylytics' ), 'jmitch_tinylytics_options_section_callback', 'jmitch-tinylytics' );
     52   
     53    add_settings_field( 'site_id', esc_html__( 'Site ID','jmitch-tinylytics' ), 'jmitch_tinylytics_site_id_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_general_section' );
     54    add_settings_field( 'display_hits', esc_html__( 'Display hits?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_hits_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     55    add_settings_field( 'display_stats', esc_html__( 'Link to your public stats?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_stats_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     56    add_settings_field( 'display_uptime', esc_html__( 'Display uptime?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_uptime_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     57    add_settings_field( 'display_kudos', esc_html__( 'Display Kudos?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_kudos_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     58    add_settings_field( 'kudos_label', esc_html__( 'Kudos label','jmitch-tinylytics' ), 'jmitch_tinylytics_kudos_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     59    add_settings_field( 'display_webring', esc_html__( 'Display webring?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_webring_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     60    add_settings_field( 'webring_label', esc_html__( 'Webring label','jmitch-tinylytics' ), 'jmitch_tinylytics_webring_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     61    add_settings_field( 'display_avatars', esc_html__( 'Display webring avatars?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_avatars_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     62    add_settings_field( 'display_flags', esc_html__( 'Display country flags?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_flags_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
    6363
    6464}
     
    6969    $sanitized_input = array();
    7070
    71     if (isset($input['site_id'])) {
    72         $sanitized_input['site_id'] = sanitize_text_field($input['site_id']);
    73     }
    74 
    75     if (isset($input['kudos_label'])) {
    76         $sanitized_input['kudos_label'] = sanitize_text_field($input['kudos_label']);
    77     }
    78    
    79     if (isset($input['webring_label'])) {
    80         $sanitized_input['webring_label'] = sanitize_text_field($input['webring_label']);
    81     }
    82 
    83     $sanitized_input['display_hits'] = isset($input['display_hits']) ? true : false;
    84     $sanitized_input['display_stats'] = isset($input['display_stats']) ? true : false;
    85     $sanitized_input['display_uptime'] = isset($input['display_uptime']) ? true : false;
    86     $sanitized_input['display_kudos'] = isset($input['display_kudos']) ? true : false;
    87     $sanitized_input['display_webring'] = isset($input['display_webring']) ? true : false;
    88     $sanitized_input['display_avatars'] = isset($input['display_avatars']) ? true : false;
    89     $sanitized_input['display_flags'] = isset($input['display_flags']) ? true : false;
     71    if ( isset( $input['site_id'] ) ) {
     72        $sanitized_input['site_id']         = sanitize_text_field( $input['site_id'] );
     73    }
     74
     75    if ( isset( $input['kudos_label'] ) ) {
     76        $sanitized_input['kudos_label']     = sanitize_text_field( $input['kudos_label'] );
     77    }
     78   
     79    if ( isset( $input['webring_label'] ) ) {
     80        $sanitized_input['webring_label']   = sanitize_text_field( $input['webring_label'] );
     81    }
     82
     83    $sanitized_input['display_hits']        = isset( $input['display_hits'] ) ? true : false;
     84    $sanitized_input['display_stats']       = isset( $input['display_stats'] ) ? true : false;
     85    $sanitized_input['display_uptime']      = isset( $input['display_uptime'] ) ? true : false;
     86    $sanitized_input['display_kudos']       = isset( $input['display_kudos'] ) ? true : false;
     87    $sanitized_input['display_webring']     = isset( $input['display_webring'] ) ? true : false;
     88    $sanitized_input['display_avatars']     = isset( $input['display_avatars'] ) ? true : false;
     89    $sanitized_input['display_flags']       = isset( $input['display_flags'] ) ? true : false;
    9090
    9191    return $sanitized_input;
     
    109109function jmitch_tinylytics_site_id_callback() {
    110110
    111     $options = get_option('jmitch_tinylytics_settings');
    112     echo '<input type="text" id="site_id" size="40" name="jmitch_tinylytics_settings[site_id]" placeholder="' . esc_html__( 'Enter your Tinylytics unique site id...','jmitch-tinylytics' ) . '" value="' . esc_attr($options['site_id'] ?? '') . '" />';
     111    $options = get_option( 'jmitch_tinylytics_settings' );
     112    echo '<input type="text" id="site_id" size="40" name="jmitch_tinylytics_settings[site_id]" placeholder="' . esc_html__( 'Enter your Tinylytics unique site id...','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['site_id'] ?? '' ) . '" />';
    113113
    114114}
     
    117117function jmitch_tinylytics_kudos_label_callback() {
    118118
    119     $options = get_option('jmitch_tinylytics_settings');
    120     echo '<input type="text" id="kudos_label" size="40" name="jmitch_tinylytics_settings[kudos_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 👋','jmitch-tinylytics' ) . '" value="' . esc_attr($options['kudos_label'] ?? '') . '" />';
     119    $options = get_option( 'jmitch_tinylytics_settings' );
     120    echo '<input type="text" id="kudos_label" size="40" name="jmitch_tinylytics_settings[kudos_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 👋','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['kudos_label'] ?? '' ) . '" />';
    121121
    122122}
     
    125125function jmitch_tinylytics_webring_label_callback() {
    126126
    127     $options = get_option('jmitch_tinylytics_settings');
    128     echo '<input type="text" id="webring_label" size="40" name="jmitch_tinylytics_settings[webring_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 🕸️💍','jmitch-tinylytics' ) . '" value="' . esc_attr($options['webring_label'] ?? '') . '" />';
     127    $options = get_option( 'jmitch_tinylytics_settings' );
     128    echo '<input type="text" id="webring_label" size="40" name="jmitch_tinylytics_settings[webring_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 🕸️💍','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['webring_label'] ?? '' ) . '" />';
    129129
    130130}
     
    133133function jmitch_tinylytics_display_hits_callback() {
    134134
    135     $options = get_option('jmitch_tinylytics_settings');
    136     echo '<input type="checkbox" id="display_hits" name="jmitch_tinylytics_settings[display_hits]" ' . checked(true, $options['display_hits'] ?? false, false) . ' />';
     135    $options = get_option( 'jmitch_tinylytics_settings' );
     136    echo '<input type="checkbox" id="display_hits" name="jmitch_tinylytics_settings[display_hits]" ' . checked( true, $options['display_hits'] ?? false, false ) . ' />';
    137137
    138138}
     
    141141function jmitch_tinylytics_display_stats_callback() {
    142142
    143     $options = get_option('jmitch_tinylytics_settings');
    144     echo '<input type="checkbox" id="display_stats" name="jmitch_tinylytics_settings[display_stats]" ' . checked(true, $options['display_stats'] ?? false, false) . ' />';
     143    $options = get_option( 'jmitch_tinylytics_settings' );
     144    echo '<input type="checkbox" id="display_stats" name="jmitch_tinylytics_settings[display_stats]" ' . checked( true, $options['display_stats'] ?? false, false ) . ' />';
    145145
    146146}
     
    149149function jmitch_tinylytics_display_uptime_callback() {
    150150
    151     $options = get_option('jmitch_tinylytics_settings');
    152     echo '<input type="checkbox" id="display_uptime" name="jmitch_tinylytics_settings[display_uptime]" ' . checked(true, $options['display_uptime'] ?? false, false) . ' />';
     151    $options = get_option( 'jmitch_tinylytics_settings' );
     152    echo '<input type="checkbox" id="display_uptime" name="jmitch_tinylytics_settings[display_uptime]" ' . checked( true, $options['display_uptime'] ?? false, false ) . ' />';
    153153
    154154}
     
    157157function jmitch_tinylytics_display_kudos_callback() {
    158158
    159     $options = get_option('jmitch_tinylytics_settings');
    160     echo '<input type="checkbox" id="display_kudos" name="jmitch_tinylytics_settings[display_kudos]" ' . checked(true, $options['display_kudos'] ?? false, false) . ' />';
     159    $options = get_option( 'jmitch_tinylytics_settings' );
     160    echo '<input type="checkbox" id="display_kudos" name="jmitch_tinylytics_settings[display_kudos]" ' . checked( true, $options['display_kudos'] ?? false, false ) . ' />';
    161161
    162162}
     
    165165function jmitch_tinylytics_display_webring_callback() {
    166166
    167     $options = get_option('jmitch_tinylytics_settings');
    168     echo '<input type="checkbox" id="display_webring" name="jmitch_tinylytics_settings[display_webring]" ' . checked(true, $options['display_webring'] ?? false, false) . ' />';
     167    $options = get_option( 'jmitch_tinylytics_settings' );
     168    echo '<input type="checkbox" id="display_webring" name="jmitch_tinylytics_settings[display_webring]" ' . checked( true, $options['display_webring'] ?? false, false ) . ' />';
    169169
    170170}
     
    173173function jmitch_tinylytics_display_avatars_callback() {
    174174
    175     $options = get_option('jmitch_tinylytics_settings');
    176     echo '<input type="checkbox" id="display_avatars" name="jmitch_tinylytics_settings[display_avatars]" ' . checked(true, $options['display_avatars'] ?? false, false) . ' />';
     175    $options = get_option( 'jmitch_tinylytics_settings' );
     176    echo '<input type="checkbox" id="display_avatars" name="jmitch_tinylytics_settings[display_avatars]" ' . checked( true, $options['display_avatars'] ?? false, false ) . ' />';
    177177
    178178}
     
    181181function jmitch_tinylytics_display_flags_callback() {
    182182
    183     $options = get_option('jmitch_tinylytics_settings');
    184     echo '<input type="checkbox" id="display_flags" name="jmitch_tinylytics_settings[display_flags]" ' . checked(true, $options['display_flags'] ?? false, false) . ' />';
     183    $options = get_option( 'jmitch_tinylytics_settings' );
     184    echo '<input type="checkbox" id="display_flags" name="jmitch_tinylytics_settings[display_flags]" ' . checked( true, $options['display_flags'] ?? false, false ) . ' />';
    185185
    186186}
     
    189189function jmitch_tinylytics_add_menu_page() {
    190190   
    191     add_menu_page('Tinylytics', 'Tinylytics', 'manage_options', 'jmitch-tinylytics', 'jmitch_tinylytics_settings_page', 'dashicons-chart-bar');
     191    add_menu_page( 'Tinylytics', 'Tinylytics', 'manage_options', 'jmitch-tinylytics', 'jmitch_tinylytics_settings_page', 'dashicons-chart-bar' );
    192192
    193193}
     
    208208
    209209    $default_tab = null;
    210     $tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : $default_tab;
     210    $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : $default_tab;
    211211
    212212    ?>
     
    215215
    216216        <nav class="nav-tab-wrapper">
    217             <a href="?page=jmitch-tinylytics" class="nav-tab <?php if($tab===null):?>nav-tab-active<?php endif; ?>"><?php esc_html_e('General Settings','jmitch-tinylytics'); ?></a>
    218             <a href="?page=jmitch-tinylytics&tab=shortcode" class="nav-tab <?php if($tab==='shortcode'):?>nav-tab-active<?php endif; ?>"><?php esc_html_e('Shortcodes','jmitch-tinylytics'); ?></a>
     217            <a href="?page=jmitch-tinylytics" class="nav-tab <?php if($tab===null):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'General Settings', 'jmitch-tinylytics' ); ?></a>
     218            <a href="?page=jmitch-tinylytics&tab=shortcode" class="nav-tab <?php if($tab==='shortcode'):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Shortcodes', 'jmitch-tinylytics' ); ?></a>
    219219        </nav>
    220220        <div class="tab-content">
    221221            <div class="admin-left">
    222             <?php switch($tab) :
     222            <?php switch( $tab ) :
    223223                case 'shortcode':
    224224                    include plugin_dir_path( __FILE__ ) . '/inc/admin-shortcodes.php';
     
    239239function jmitch_tinylytics_output_script() {
    240240
    241     $options = get_option('jmitch_tinylytics_settings');
    242 
    243     $site_id = esc_attr($options['site_id'] ?? '');
    244     $hits = $options['display_hits'];
    245     $stats = $options['display_stats'];
    246     $uptime = $options['display_uptime'];
    247     $kudos = $options['display_kudos'];
    248     $kudos_label = esc_attr($options['kudos_label'] ?? '');
    249     $webring = $options['display_webring'];
    250     $webring_label = esc_attr($options['webring_label'] ?? '');
    251     $avatars = $options['display_avatars'];
    252     $flags = $options['display_flags'];
    253    
    254     if (!empty($site_id)) {
     241    $options = get_option( 'jmitch_tinylytics_settings' );
     242   
     243    if ( $options ) {
     244
     245        $site_id = esc_attr( $options['site_id'] ?? '' );
     246        $hits = $options['display_hits'];
     247        $stats = $options['display_stats'];
     248        $uptime = $options['display_uptime'];
     249        $kudos = $options['display_kudos'];
     250        $kudos_label = esc_attr( $options['kudos_label'] ?? '' );
     251        $webring = $options['display_webring'];
     252        $webring_label = esc_attr( $options['webring_label'] ?? '' );
     253        $avatars = $options['display_avatars'];
     254        $flags = $options['display_flags'];
     255   
    255256        $script_url = "https://tinylytics.app/embed/{$site_id}.js?";
    256257        $script_url .= $hits ? 'hits&' : '';
     
    262263        $script_url .= $webring && $avatars ? 'webring=avatars&' : '';
    263264        $script_url .= $flags ? 'countries&' : '';
    264         $script_url = rtrim($script_url, '&?');
     265        $script_url = rtrim( $script_url, '&?' );
    265266       
    266267        wp_enqueue_script(
     
    275276        );
    276277    }
    277 
    278 }
    279 add_action('wp_footer', 'jmitch_tinylytics_output_script');
     278}
     279add_action( 'wp_footer', 'jmitch_tinylytics_output_script' );
    280280
    281281// *** Enqueue user scripts
     
    312312           
    313313    $domain = 'jmitch-tinylytics';
    314     $locale = apply_filters('jmitch_tinylytics_locale', get_locale(), $domain);
    315     $dir    = trailingslashit(WP_LANG_DIR);
    316     $file   = $domain .'-'. $locale .'.mo';
     314    $locale = apply_filters( 'jmitch_tinylytics_locale', get_locale(), $domain );
     315    $dir    = trailingslashit( WP_LANG_DIR );
     316    $file   = $domain . '-' . $locale . '.mo';
    317317    $path_1 = $dir . $file;
    318     $path_2 = $dir . $domain .'/'. $file;
    319     $path_3 = $dir .'plugins/'. $file;
    320     $path_4 = $dir .'plugins/'. $domain .'/'. $file;
    321     $paths = array($path_1, $path_2, $path_3, $path_4);
    322    
    323     foreach ($paths as $path) {
    324         if ($loaded = load_textdomain($domain, $path)) {
     318    $path_2 = $dir . $domain . '/' . $file;
     319    $path_3 = $dir . 'plugins/' . $file;
     320    $path_4 = $dir . 'plugins/' . $domain . '/' . $file;
     321    $paths = array( $path_1, $path_2, $path_3, $path_4 );
     322   
     323    foreach ( $paths as $path ) {
     324        if ( $loaded = load_textdomain( $domain, $path ) ) {
    325325            return $loaded;
    326326        } else {
    327             return load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) .'/languages/');
     327            return load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
    328328        }
    329329    }
  • jmitch-tinylytics/tags/1.0.5/readme.txt

    r3037227 r3039297  
    1010Requires at least: 4.6
    1111Tested up to: 6.4.3
    12 Stable tag: 1.0.4
    13 Version:    1.0.4
     12Stable tag: 1.0.5
     13Version:    1.0.5
    1414Requires PHP: 5.6.20
    1515Text Domain: jmitch-tinylytics
     
    142142If you like Tinylytics, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/jmitch-tinylytics/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
    143143
     144**Version 1.0.5 (02-21-2024)**
     145
     146* Fix a minor site error if options have not been set in the plugin yet.
     147* Remove an unused CSS style.
     148* Code clean up for readability sake.
     149
    144150**Version 1.0.4 (02-17-2024)**
    145151
  • jmitch-tinylytics/tags/1.0.5/uninstall.php

    r3035382 r3039297  
    11<?php // delete the Tinylytics settings on uninstall...
    22
    3 if ( ! defined('ABSPATH') ) exit();
     3if ( ! defined( 'ABSPATH' ) ) exit();
    44
    55// delete options
    6 delete_option('jmitch_tinylytics_settings');
     6delete_option( 'jmitch_tinylytics_settings' );
  • jmitch-tinylytics/trunk/css/style.css

    r3035382 r3039297  
    1 .wp-admin .tiny-warning-message {
    2     color: crimson;
    3     font-weight: bold;
    4     text-decoration: underline;
    5 }
    61.wp-admin .tab-content {
    72    display: flex;
  • jmitch-tinylytics/trunk/inc/admin-settings.php

    r3035382 r3039297  
    1313    <form method="post" action="options.php">
    1414    <?php
    15         settings_fields('jmitch_tinylytics_settings_group');
    16         do_settings_sections('jmitch-tinylytics');
     15        settings_fields( 'jmitch_tinylytics_settings_group' );
     16        do_settings_sections( 'jmitch-tinylytics' );
    1717        submit_button();
    1818        ?>
  • jmitch-tinylytics/trunk/inc/admin-shortcodes.php

    r3035382 r3039297  
    1212?>
    1313
    14 <h2><?php esc_html_e( 'Shortcodes','jmitch-tinylytics' ); ?></h2>
     14<h2><?php esc_html_e( 'Shortcodes', 'jmitch-tinylytics' ); ?></h2>
    1515
    16 <p>Tinylytics <?php esc_html_e( 'comes comes with a variety of shortcodes which can be embedded directly in a post, page, or theme block to reduce the need for extensive HTML customizations','jmitch-tinylytics' ); ?>.</p>
     16<p>Tinylytics <?php esc_html_e( 'comes comes with a variety of shortcodes which can be embedded directly in a post, page, or theme block to reduce the need for extensive HTML customizations', 'jmitch-tinylytics' ); ?>.</p>
    1717
    1818<table class="form-table" role="presentation" style="width:100%;">
    19     <tr><th style="width:20%;">[tinykudos]</th><td><?php esc_html_e( 'Displays an interactive button to track "kudos" given by readers. Best used directly in posts and pages','jmitch-tinylytics' ); ?>.</td></tr>
    20     <tr><th>[tinyhits]</th><td><?php esc_html_e( 'Displays a count of page loads of the page viewed. Best used directly in posts and pages','jmitch-tinylytics' ); ?>.</td></tr>
    21     <tr><th>[tinystats]</th><td><?php esc_html_e( 'Displays both overall site hits and uptime (Note: a Tinylytics subscription is required to display uptime). Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
    22     <tr><th>[tinywebring]</th><td><?php esc_html_e( 'Displays a random link to a Tinylytics webring site. Enabling the "Display webring avatars?" option will include the avatar if the site has one. Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
    23     <tr><th>[tinyflags]</th><td><?php esc_html_e( 'Displays flags from all the countries of site visitors. Best used in the footer of your site','jmitch-tinylytics' ); ?>.</td></tr>
     19    <tr><th style="width:20%;">[tinykudos]</th><td><?php esc_html_e( 'Displays an interactive button to track "kudos" given by readers. Best used directly in posts and pages', 'jmitch-tinylytics' ); ?>.</td></tr>
     20    <tr><th>[tinyhits]</th><td><?php esc_html_e( 'Displays a count of page loads of the page viewed. Best used directly in posts and pages', 'jmitch-tinylytics' ); ?>.</td></tr>
     21    <tr><th>[tinystats]</th><td><?php esc_html_e( 'Displays both overall site hits and uptime (Note: a Tinylytics subscription is required to display uptime). Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
     22    <tr><th>[tinywebring]</th><td><?php esc_html_e( 'Displays a random link to a Tinylytics webring site. Enabling the "Display webring avatars?" option will include the avatar if the site has one. Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
     23    <tr><th>[tinyflags]</th><td><?php esc_html_e( 'Displays flags from all the countries of site visitors. Best used in the footer of your site', 'jmitch-tinylytics' ); ?>.</td></tr>
    2424</table>
    2525
    26 <p><?php esc_html_e( 'Learn how to use the','jmitch-tinylytics' ); ?> <a href="https://wordpress.org/documentation/article/shortcode-block/" target="_blank"><?php esc_html_e( 'Shortcode Block','jmitch-tinylytics' ); ?></a> <?php esc_html_e( 'in your theme. More information about','jmitch-tinylytics' ); ?> <a href="https://tinylytics.app" target="_blank">Tinylytics</a> <?php esc_html_e( 'options can be found in the','jmitch-tinylytics' ); ?> <a href="https://tinylytics.app/docs" target="_blank"><?php esc_html_e( 'documentation','jmitch-tinylytics' ); ?></a>.</p>
     26<p><?php esc_html_e( 'Learn how to use the', 'jmitch-tinylytics' ); ?> <a href="https://wordpress.org/documentation/article/shortcode-block/" target="_blank"><?php esc_html_e( 'Shortcode Block', 'jmitch-tinylytics' ); ?></a> <?php esc_html_e( 'in your theme. More information about', 'jmitch-tinylytics' ); ?> <a href="https://tinylytics.app" target="_blank">Tinylytics</a> <?php esc_html_e( 'options can be found in the', 'jmitch-tinylytics' ); ?> <a href="https://tinylytics.app/docs" target="_blank"><?php esc_html_e( 'documentation', 'jmitch-tinylytics' ); ?></a>.</p>
  • jmitch-tinylytics/trunk/inc/admin-support.php

    r3037227 r3039297  
    1212?>
    1313
    14 <h2 style="text-align:center;"><?php esc_html_e( 'Your Support Matters','jmitch-tinylytics' ); ?></h2>
     14<h2 style="text-align:center;"><?php esc_html_e( 'Your Support Matters', 'jmitch-tinylytics' ); ?></h2>
    1515
    16 <p><?php esc_html_e( 'Though I freely provide this plugin to the WordPress community, consider making a small donation. A few bucks goes a long way towards making improvements','jmitch-tinylytics' ); ?>.</p>
    17 <p><strong><?php esc_html_e( 'Note:','jmitch-tinylytics' ); ?></strong> <?php esc_html_e( 'Making a donation gets you priority support if you need it','jmitch-tinylytics' ); ?>.</p>
     16<p><?php esc_html_e( 'Though I freely provide this plugin to the WordPress community, consider making a small donation. A few bucks goes a long way towards making improvements', 'jmitch-tinylytics' ); ?>.</p>
     17<p><strong><?php esc_html_e( 'Note:', 'jmitch-tinylytics' ); ?></strong> <?php esc_html_e( 'Making a donation gets you priority support if you need it', 'jmitch-tinylytics' ); ?>.</p>
    1818<p style="margin-top:25px;"><a href="https://donate.stripe.com/9AQ8Ab6Yr8Y67cYdQR" target="_blank" class="donate-button"><?php esc_html_e( 'Support Continued Development' ); ?></a></p>
  • jmitch-tinylytics/trunk/inc/user-shortcodes.php

    r3035382 r3039297  
    1313function jmitch_tinylytics_kudos_function() {
    1414    $output = '';
    15     $options = get_option('jmitch_tinylytics_settings');
     15    $options = get_option( 'jmitch_tinylytics_settings' );
    1616    $kudos = $options['display_kudos'];
    17     if ($kudos) {
    18         $output = '<button class="tinylytics_kudos" data-path="'. wp_make_link_relative(get_permalink()) .'"></button>';
     17    if ( $kudos ) {
     18        $output = '<button class="tinylytics_kudos" data-path="'. wp_make_link_relative( get_permalink() ) .'"></button>';
    1919    }
    2020    return $output;
    2121}
    22 add_shortcode('tinykudos','jmitch_tinylytics_kudos_function');
     22add_shortcode( 'tinykudos', 'jmitch_tinylytics_kudos_function' );
    2323
    2424// *** Hits shortcode
    2525function jmitch_tinylytics_hits_function() {
    2626    $output = '';
    27     $options = get_option('jmitch_tinylytics_settings');
     27    $options = get_option( 'jmitch_tinylytics_settings' );
    2828    $hits = $options['display_hits'];
    29     if ($hits) {
    30         $output = '<span class="tinylytics_hits" data-path="'. wp_make_link_relative(get_permalink()) .'"></span>';
     29    if ( $hits ) {
     30        $output = '<span class="tinylytics_hits" data-path="'. wp_make_link_relative( get_permalink() ) .'"></span>';
    3131    }
    3232    return $output;
    3333}
    34 add_shortcode('tinyhits','jmitch_tinylytics_hits_function');
     34add_shortcode( 'tinyhits', 'jmitch_tinylytics_hits_function' );
    3535
    3636// *** Web ring shortcode
    3737function jmitch_tinylytics_webring_function() {
    3838    $output = '';
    39     $options = get_option('jmitch_tinylytics_settings');
     39    $options = get_option( 'jmitch_tinylytics_settings' );
    4040    $webring = $options['display_webring'];
    4141    $webring_label = $options['webring_label'];
    4242    $avatars = $options['display_avatars'];
    43     if ($webring) {
     43    if ( $webring ) {
    4444        $show_avatar = $avatars ? '<img class="tinylytics_webring_avatar" src="" style="display: none"/>' : '';
    45         if ($webring_label === '') {
    46             $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring','jmitch-tinylytics' ) . '">🕸️' . $show_avatar . '💍</a></span>';
     45        if ( $webring_label === '' ) {
     46            $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring', 'jmitch-tinylytics' ) . '">🕸️' . $show_avatar . '💍</a></span>';
    4747        } else {
    48             $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring','jmitch-tinylytics' ) . '">'. $show_avatar . $webring_label . '</a></span>';
     48            $output = '<span class="tiny_webring"><a href="" class="tinylytics_webring" target="_blank" title="Tinylytics '. esc_html__( 'Web Ring', 'jmitch-tinylytics' ) . '">'. $show_avatar . $webring_label . '</a></span>';
    4949        }
    5050    }
    5151    return $output;
    5252}
    53 add_shortcode('tinywebring','jmitch_tinylytics_webring_function');
     53add_shortcode( 'tinywebring', 'jmitch_tinylytics_webring_function' );
    5454
    5555// *** Country flags shortcode
    5656function jmitch_tinylytics_flags_function() {
    5757    $output = '';
    58     $options = get_option('jmitch_tinylytics_settings');
     58    $options = get_option( 'jmitch_tinylytics_settings' );
    5959    $flags = $options['display_flags'];
    60     if ($flags) {
     60    if ( $flags ) {
    6161        $output = '<p><span class="tinylytics_countries"></span></p>';
    6262    }
    6363    return $output;
    6464}
    65 add_shortcode('tinyflags','jmitch_tinylytics_flags_function');
     65add_shortcode( 'tinyflags', 'jmitch_tinylytics_flags_function' );
    6666
    6767// *** Stats shortcode
    6868function jmitch_tinylytics_stats_function() {
    6969    $output = '';
    70     $options = get_option('jmitch_tinylytics_settings');
     70    $options = get_option( 'jmitch_tinylytics_settings' );
    7171    $stats = $options['display_stats'];
    7272    $hits = $options['display_hits'];
    7373    $uptime = $options['display_uptime'];
    74     if ($stats && $hits) {
    75         $output .= '<span class="tiny_counter"><a href="" target="_blank" class="tinylytics_public_stats">' . esc_html__( 'My Stats','jmitch-tinylytics' ) . '</a>: <span class="tinylytics_hits"></span></span>';
     74    if ( $stats && $hits ) {
     75        $output .= '<span class="tiny_counter"><a href="" target="_blank" class="tinylytics_public_stats">' . esc_html__( 'My Stats', 'jmitch-tinylytics' ) . '</a>: <span class="tinylytics_hits"></span></span>';
    7676    }
    77     else if ($hits) {
     77    else if ( $hits ) {
    7878        $output .= '<span class="tiny_counter"><a href="https://tinylytics.app">Tinylytics</a>: <span class="tinylytics_hits"></span></span>';
    7979    }
    80     if ($uptime) {
     80    if ( $uptime ) {
    8181        $output .= ' <span class="tiny_uptime">Uptime: <span class="tinylytics_uptime"></span></span>';
    8282    }
    8383    return $output;
    8484}
    85 add_shortcode('tinystats','jmitch_tinylytics_stats_function');
     85add_shortcode( 'tinystats', 'jmitch_tinylytics_stats_function' );
    8686
    8787?>
  • jmitch-tinylytics/trunk/jmitch-tinylytics.php

    r3037227 r3039297  
    1010 * Requires at least: 4.6
    1111 * Test up to: 6.4.3
    12  * Version: 1.0.4
     12 * Version: 1.0.5
    1313 * Requires PHP: 5.6.20
    1414 * Text Domain: jmitch-tinylytics
     
    3434*/
    3535
    36  if (!defined('ABSPATH')) die();
    37 
    38  define( 'TINYLYTICS__VERSION', '1.0.4' );
     36if ( !defined( 'ABSPATH' )) die();
     37
     38define( 'TINYLYTICS__VERSION', '1.0.5' );
    3939
    4040// Hook functions into WordPress
    41 add_action('admin_init', 'jmitch_tinylytics_register_settings');
    42 add_action('admin_menu', 'jmitch_tinylytics_add_menu_page');
    43 add_action('init', 'jmitch_tinylytics_load_i18n');
     41add_action( 'admin_init', 'jmitch_tinylytics_register_settings' );
     42add_action( 'admin_menu', 'jmitch_tinylytics_add_menu_page' );
     43add_action( 'init', 'jmitch_tinylytics_load_i18n' );
    4444
    4545// Register the settings
    4646function jmitch_tinylytics_register_settings() {
    4747
    48     register_setting('jmitch_tinylytics_settings_group', 'jmitch_tinylytics_settings', 'jmitch_tinylytics_sanitize_options');
    49    
    50     add_settings_section('jmitch_tinylytics_general_section', esc_html__( 'General Settings','jmitch-tinylytics' ), 'jmitch_tinylytics_general_section_callback', 'jmitch-tinylytics');
    51     add_settings_section('jmitch_tinylytics_options_section', esc_html__( 'Tinylytics Options','jmitch-tinylytics' ), 'jmitch_tinylytics_options_section_callback', 'jmitch-tinylytics');
    52    
    53     add_settings_field('site_id', esc_html__( 'Site ID','jmitch-tinylytics' ), 'jmitch_tinylytics_site_id_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_general_section');
    54     add_settings_field('display_hits', esc_html__( 'Display hits?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_hits_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    55     add_settings_field('display_stats', esc_html__( 'Link to your public stats?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_stats_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    56     add_settings_field('display_uptime', esc_html__( 'Display uptime?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_uptime_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    57     add_settings_field('display_kudos', esc_html__( 'Display Kudos?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_kudos_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    58     add_settings_field('kudos_label', esc_html__( 'Kudos label','jmitch-tinylytics' ), 'jmitch_tinylytics_kudos_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    59     add_settings_field('display_webring', esc_html__( 'Display webring?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_webring_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    60     add_settings_field('webring_label', esc_html__( 'Webring label','jmitch-tinylytics' ), 'jmitch_tinylytics_webring_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    61     add_settings_field('display_avatars', esc_html__( 'Display webring avatars?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_avatars_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
    62     add_settings_field('display_flags', esc_html__( 'Display country flags?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_flags_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section');
     48    register_setting( 'jmitch_tinylytics_settings_group', 'jmitch_tinylytics_settings', 'jmitch_tinylytics_sanitize_options' );
     49   
     50    add_settings_section( 'jmitch_tinylytics_general_section', esc_html__( 'General Settings','jmitch-tinylytics' ), 'jmitch_tinylytics_general_section_callback', 'jmitch-tinylytics' );
     51    add_settings_section( 'jmitch_tinylytics_options_section', esc_html__( 'Tinylytics Options','jmitch-tinylytics' ), 'jmitch_tinylytics_options_section_callback', 'jmitch-tinylytics' );
     52   
     53    add_settings_field( 'site_id', esc_html__( 'Site ID','jmitch-tinylytics' ), 'jmitch_tinylytics_site_id_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_general_section' );
     54    add_settings_field( 'display_hits', esc_html__( 'Display hits?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_hits_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     55    add_settings_field( 'display_stats', esc_html__( 'Link to your public stats?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_stats_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     56    add_settings_field( 'display_uptime', esc_html__( 'Display uptime?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_uptime_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     57    add_settings_field( 'display_kudos', esc_html__( 'Display Kudos?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_kudos_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     58    add_settings_field( 'kudos_label', esc_html__( 'Kudos label','jmitch-tinylytics' ), 'jmitch_tinylytics_kudos_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     59    add_settings_field( 'display_webring', esc_html__( 'Display webring?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_webring_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     60    add_settings_field( 'webring_label', esc_html__( 'Webring label','jmitch-tinylytics' ), 'jmitch_tinylytics_webring_label_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     61    add_settings_field( 'display_avatars', esc_html__( 'Display webring avatars?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_avatars_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
     62    add_settings_field( 'display_flags', esc_html__( 'Display country flags?','jmitch-tinylytics' ), 'jmitch_tinylytics_display_flags_callback', 'jmitch-tinylytics', 'jmitch_tinylytics_options_section' );
    6363
    6464}
     
    6969    $sanitized_input = array();
    7070
    71     if (isset($input['site_id'])) {
    72         $sanitized_input['site_id'] = sanitize_text_field($input['site_id']);
    73     }
    74 
    75     if (isset($input['kudos_label'])) {
    76         $sanitized_input['kudos_label'] = sanitize_text_field($input['kudos_label']);
    77     }
    78    
    79     if (isset($input['webring_label'])) {
    80         $sanitized_input['webring_label'] = sanitize_text_field($input['webring_label']);
    81     }
    82 
    83     $sanitized_input['display_hits'] = isset($input['display_hits']) ? true : false;
    84     $sanitized_input['display_stats'] = isset($input['display_stats']) ? true : false;
    85     $sanitized_input['display_uptime'] = isset($input['display_uptime']) ? true : false;
    86     $sanitized_input['display_kudos'] = isset($input['display_kudos']) ? true : false;
    87     $sanitized_input['display_webring'] = isset($input['display_webring']) ? true : false;
    88     $sanitized_input['display_avatars'] = isset($input['display_avatars']) ? true : false;
    89     $sanitized_input['display_flags'] = isset($input['display_flags']) ? true : false;
     71    if ( isset( $input['site_id'] ) ) {
     72        $sanitized_input['site_id']         = sanitize_text_field( $input['site_id'] );
     73    }
     74
     75    if ( isset( $input['kudos_label'] ) ) {
     76        $sanitized_input['kudos_label']     = sanitize_text_field( $input['kudos_label'] );
     77    }
     78   
     79    if ( isset( $input['webring_label'] ) ) {
     80        $sanitized_input['webring_label']   = sanitize_text_field( $input['webring_label'] );
     81    }
     82
     83    $sanitized_input['display_hits']        = isset( $input['display_hits'] ) ? true : false;
     84    $sanitized_input['display_stats']       = isset( $input['display_stats'] ) ? true : false;
     85    $sanitized_input['display_uptime']      = isset( $input['display_uptime'] ) ? true : false;
     86    $sanitized_input['display_kudos']       = isset( $input['display_kudos'] ) ? true : false;
     87    $sanitized_input['display_webring']     = isset( $input['display_webring'] ) ? true : false;
     88    $sanitized_input['display_avatars']     = isset( $input['display_avatars'] ) ? true : false;
     89    $sanitized_input['display_flags']       = isset( $input['display_flags'] ) ? true : false;
    9090
    9191    return $sanitized_input;
     
    109109function jmitch_tinylytics_site_id_callback() {
    110110
    111     $options = get_option('jmitch_tinylytics_settings');
    112     echo '<input type="text" id="site_id" size="40" name="jmitch_tinylytics_settings[site_id]" placeholder="' . esc_html__( 'Enter your Tinylytics unique site id...','jmitch-tinylytics' ) . '" value="' . esc_attr($options['site_id'] ?? '') . '" />';
     111    $options = get_option( 'jmitch_tinylytics_settings' );
     112    echo '<input type="text" id="site_id" size="40" name="jmitch_tinylytics_settings[site_id]" placeholder="' . esc_html__( 'Enter your Tinylytics unique site id...','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['site_id'] ?? '' ) . '" />';
    113113
    114114}
     
    117117function jmitch_tinylytics_kudos_label_callback() {
    118118
    119     $options = get_option('jmitch_tinylytics_settings');
    120     echo '<input type="text" id="kudos_label" size="40" name="jmitch_tinylytics_settings[kudos_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 👋','jmitch-tinylytics' ) . '" value="' . esc_attr($options['kudos_label'] ?? '') . '" />';
     119    $options = get_option( 'jmitch_tinylytics_settings' );
     120    echo '<input type="text" id="kudos_label" size="40" name="jmitch_tinylytics_settings[kudos_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 👋','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['kudos_label'] ?? '' ) . '" />';
    121121
    122122}
     
    125125function jmitch_tinylytics_webring_label_callback() {
    126126
    127     $options = get_option('jmitch_tinylytics_settings');
    128     echo '<input type="text" id="webring_label" size="40" name="jmitch_tinylytics_settings[webring_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 🕸️💍','jmitch-tinylytics' ) . '" value="' . esc_attr($options['webring_label'] ?? '') . '" />';
     127    $options = get_option( 'jmitch_tinylytics_settings' );
     128    echo '<input type="text" id="webring_label" size="40" name="jmitch_tinylytics_settings[webring_label]" placeholder="' . esc_html__( 'Enter any combination of text or emoji 🕸️💍','jmitch-tinylytics' ) . '" value="' . esc_attr( $options['webring_label'] ?? '' ) . '" />';
    129129
    130130}
     
    133133function jmitch_tinylytics_display_hits_callback() {
    134134
    135     $options = get_option('jmitch_tinylytics_settings');
    136     echo '<input type="checkbox" id="display_hits" name="jmitch_tinylytics_settings[display_hits]" ' . checked(true, $options['display_hits'] ?? false, false) . ' />';
     135    $options = get_option( 'jmitch_tinylytics_settings' );
     136    echo '<input type="checkbox" id="display_hits" name="jmitch_tinylytics_settings[display_hits]" ' . checked( true, $options['display_hits'] ?? false, false ) . ' />';
    137137
    138138}
     
    141141function jmitch_tinylytics_display_stats_callback() {
    142142
    143     $options = get_option('jmitch_tinylytics_settings');
    144     echo '<input type="checkbox" id="display_stats" name="jmitch_tinylytics_settings[display_stats]" ' . checked(true, $options['display_stats'] ?? false, false) . ' />';
     143    $options = get_option( 'jmitch_tinylytics_settings' );
     144    echo '<input type="checkbox" id="display_stats" name="jmitch_tinylytics_settings[display_stats]" ' . checked( true, $options['display_stats'] ?? false, false ) . ' />';
    145145
    146146}
     
    149149function jmitch_tinylytics_display_uptime_callback() {
    150150
    151     $options = get_option('jmitch_tinylytics_settings');
    152     echo '<input type="checkbox" id="display_uptime" name="jmitch_tinylytics_settings[display_uptime]" ' . checked(true, $options['display_uptime'] ?? false, false) . ' />';
     151    $options = get_option( 'jmitch_tinylytics_settings' );
     152    echo '<input type="checkbox" id="display_uptime" name="jmitch_tinylytics_settings[display_uptime]" ' . checked( true, $options['display_uptime'] ?? false, false ) . ' />';
    153153
    154154}
     
    157157function jmitch_tinylytics_display_kudos_callback() {
    158158
    159     $options = get_option('jmitch_tinylytics_settings');
    160     echo '<input type="checkbox" id="display_kudos" name="jmitch_tinylytics_settings[display_kudos]" ' . checked(true, $options['display_kudos'] ?? false, false) . ' />';
     159    $options = get_option( 'jmitch_tinylytics_settings' );
     160    echo '<input type="checkbox" id="display_kudos" name="jmitch_tinylytics_settings[display_kudos]" ' . checked( true, $options['display_kudos'] ?? false, false ) . ' />';
    161161
    162162}
     
    165165function jmitch_tinylytics_display_webring_callback() {
    166166
    167     $options = get_option('jmitch_tinylytics_settings');
    168     echo '<input type="checkbox" id="display_webring" name="jmitch_tinylytics_settings[display_webring]" ' . checked(true, $options['display_webring'] ?? false, false) . ' />';
     167    $options = get_option( 'jmitch_tinylytics_settings' );
     168    echo '<input type="checkbox" id="display_webring" name="jmitch_tinylytics_settings[display_webring]" ' . checked( true, $options['display_webring'] ?? false, false ) . ' />';
    169169
    170170}
     
    173173function jmitch_tinylytics_display_avatars_callback() {
    174174
    175     $options = get_option('jmitch_tinylytics_settings');
    176     echo '<input type="checkbox" id="display_avatars" name="jmitch_tinylytics_settings[display_avatars]" ' . checked(true, $options['display_avatars'] ?? false, false) . ' />';
     175    $options = get_option( 'jmitch_tinylytics_settings' );
     176    echo '<input type="checkbox" id="display_avatars" name="jmitch_tinylytics_settings[display_avatars]" ' . checked( true, $options['display_avatars'] ?? false, false ) . ' />';
    177177
    178178}
     
    181181function jmitch_tinylytics_display_flags_callback() {
    182182
    183     $options = get_option('jmitch_tinylytics_settings');
    184     echo '<input type="checkbox" id="display_flags" name="jmitch_tinylytics_settings[display_flags]" ' . checked(true, $options['display_flags'] ?? false, false) . ' />';
     183    $options = get_option( 'jmitch_tinylytics_settings' );
     184    echo '<input type="checkbox" id="display_flags" name="jmitch_tinylytics_settings[display_flags]" ' . checked( true, $options['display_flags'] ?? false, false ) . ' />';
    185185
    186186}
     
    189189function jmitch_tinylytics_add_menu_page() {
    190190   
    191     add_menu_page('Tinylytics', 'Tinylytics', 'manage_options', 'jmitch-tinylytics', 'jmitch_tinylytics_settings_page', 'dashicons-chart-bar');
     191    add_menu_page( 'Tinylytics', 'Tinylytics', 'manage_options', 'jmitch-tinylytics', 'jmitch_tinylytics_settings_page', 'dashicons-chart-bar' );
    192192
    193193}
     
    208208
    209209    $default_tab = null;
    210     $tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : $default_tab;
     210    $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : $default_tab;
    211211
    212212    ?>
     
    215215
    216216        <nav class="nav-tab-wrapper">
    217             <a href="?page=jmitch-tinylytics" class="nav-tab <?php if($tab===null):?>nav-tab-active<?php endif; ?>"><?php esc_html_e('General Settings','jmitch-tinylytics'); ?></a>
    218             <a href="?page=jmitch-tinylytics&tab=shortcode" class="nav-tab <?php if($tab==='shortcode'):?>nav-tab-active<?php endif; ?>"><?php esc_html_e('Shortcodes','jmitch-tinylytics'); ?></a>
     217            <a href="?page=jmitch-tinylytics" class="nav-tab <?php if($tab===null):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'General Settings', 'jmitch-tinylytics' ); ?></a>
     218            <a href="?page=jmitch-tinylytics&tab=shortcode" class="nav-tab <?php if($tab==='shortcode'):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Shortcodes', 'jmitch-tinylytics' ); ?></a>
    219219        </nav>
    220220        <div class="tab-content">
    221221            <div class="admin-left">
    222             <?php switch($tab) :
     222            <?php switch( $tab ) :
    223223                case 'shortcode':
    224224                    include plugin_dir_path( __FILE__ ) . '/inc/admin-shortcodes.php';
     
    239239function jmitch_tinylytics_output_script() {
    240240
    241     $options = get_option('jmitch_tinylytics_settings');
    242 
    243     $site_id = esc_attr($options['site_id'] ?? '');
    244     $hits = $options['display_hits'];
    245     $stats = $options['display_stats'];
    246     $uptime = $options['display_uptime'];
    247     $kudos = $options['display_kudos'];
    248     $kudos_label = esc_attr($options['kudos_label'] ?? '');
    249     $webring = $options['display_webring'];
    250     $webring_label = esc_attr($options['webring_label'] ?? '');
    251     $avatars = $options['display_avatars'];
    252     $flags = $options['display_flags'];
    253    
    254     if (!empty($site_id)) {
     241    $options = get_option( 'jmitch_tinylytics_settings' );
     242   
     243    if ( $options ) {
     244
     245        $site_id = esc_attr( $options['site_id'] ?? '' );
     246        $hits = $options['display_hits'];
     247        $stats = $options['display_stats'];
     248        $uptime = $options['display_uptime'];
     249        $kudos = $options['display_kudos'];
     250        $kudos_label = esc_attr( $options['kudos_label'] ?? '' );
     251        $webring = $options['display_webring'];
     252        $webring_label = esc_attr( $options['webring_label'] ?? '' );
     253        $avatars = $options['display_avatars'];
     254        $flags = $options['display_flags'];
     255   
    255256        $script_url = "https://tinylytics.app/embed/{$site_id}.js?";
    256257        $script_url .= $hits ? 'hits&' : '';
     
    262263        $script_url .= $webring && $avatars ? 'webring=avatars&' : '';
    263264        $script_url .= $flags ? 'countries&' : '';
    264         $script_url = rtrim($script_url, '&?');
     265        $script_url = rtrim( $script_url, '&?' );
    265266       
    266267        wp_enqueue_script(
     
    275276        );
    276277    }
    277 
    278 }
    279 add_action('wp_footer', 'jmitch_tinylytics_output_script');
     278}
     279add_action( 'wp_footer', 'jmitch_tinylytics_output_script' );
    280280
    281281// *** Enqueue user scripts
     
    312312           
    313313    $domain = 'jmitch-tinylytics';
    314     $locale = apply_filters('jmitch_tinylytics_locale', get_locale(), $domain);
    315     $dir    = trailingslashit(WP_LANG_DIR);
    316     $file   = $domain .'-'. $locale .'.mo';
     314    $locale = apply_filters( 'jmitch_tinylytics_locale', get_locale(), $domain );
     315    $dir    = trailingslashit( WP_LANG_DIR );
     316    $file   = $domain . '-' . $locale . '.mo';
    317317    $path_1 = $dir . $file;
    318     $path_2 = $dir . $domain .'/'. $file;
    319     $path_3 = $dir .'plugins/'. $file;
    320     $path_4 = $dir .'plugins/'. $domain .'/'. $file;
    321     $paths = array($path_1, $path_2, $path_3, $path_4);
    322    
    323     foreach ($paths as $path) {
    324         if ($loaded = load_textdomain($domain, $path)) {
     318    $path_2 = $dir . $domain . '/' . $file;
     319    $path_3 = $dir . 'plugins/' . $file;
     320    $path_4 = $dir . 'plugins/' . $domain . '/' . $file;
     321    $paths = array( $path_1, $path_2, $path_3, $path_4 );
     322   
     323    foreach ( $paths as $path ) {
     324        if ( $loaded = load_textdomain( $domain, $path ) ) {
    325325            return $loaded;
    326326        } else {
    327             return load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) .'/languages/');
     327            return load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
    328328        }
    329329    }
  • jmitch-tinylytics/trunk/readme.txt

    r3037227 r3039297  
    1010Requires at least: 4.6
    1111Tested up to: 6.4.3
    12 Stable tag: 1.0.4
    13 Version:    1.0.4
     12Stable tag: 1.0.5
     13Version:    1.0.5
    1414Requires PHP: 5.6.20
    1515Text Domain: jmitch-tinylytics
     
    142142If you like Tinylytics, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/jmitch-tinylytics/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
    143143
     144**Version 1.0.5 (02-21-2024)**
     145
     146* Fix a minor site error if options have not been set in the plugin yet.
     147* Remove an unused CSS style.
     148* Code clean up for readability sake.
     149
    144150**Version 1.0.4 (02-17-2024)**
    145151
  • jmitch-tinylytics/trunk/uninstall.php

    r3035382 r3039297  
    11<?php // delete the Tinylytics settings on uninstall...
    22
    3 if ( ! defined('ABSPATH') ) exit();
     3if ( ! defined( 'ABSPATH' ) ) exit();
    44
    55// delete options
    6 delete_option('jmitch_tinylytics_settings');
     6delete_option( 'jmitch_tinylytics_settings' );
Note: See TracChangeset for help on using the changeset viewer.