Plugin Directory

Changeset 3170160


Ignore:
Timestamp:
10/16/2024 01:33:43 PM (18 months ago)
Author:
slimndap
Message:

v1.30

Location:
jeero/trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • jeero/trunk/Jeero.php

    r3148703 r3170160  
    66 * Author:          Slim & Dapper
    77 * Author URI:      https://slimndap.com
    8  * Version:         1.29.4
     8 * Version:         1.30
    99 * Text Domain:     jeero
    1010 *
     
    1919}
    2020
    21 define( 'Jeero\VERSION', '1.29.4' );
     21define( 'Jeero\VERSION', '1.30' );
    2222define( 'Jeero\PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    2323define( 'Jeero\PLUGIN_URI', plugin_dir_url( __FILE__ ) );
  • jeero/trunk/assets/css/admin.css

    r3097470 r3170160  
    1 body.toplevel_page_jeero-imports .jeero-field-message dl {
     1body.jeero_page_jeero-imports .jeero-field-message dl {
    22  display: flex;
    33  flex-wrap: wrap;
    44}
    5 body.toplevel_page_jeero-imports .jeero-field-message dl dt {
     5body.jeero_page_jeero-imports .jeero-field-message dl dt {
    66  flex: 0 0 200px;
    77}
    8 body.toplevel_page_jeero-imports .jeero-field-message dl dd {
     8body.jeero_page_jeero-imports .jeero-field-message dl dd {
    99  flex: 0 0 calc(100% - 200px);
    1010  margin-left: 0;
    1111}
    12 body.toplevel_page_jeero-imports .jeero-template-example pre {
     12body.jeero_page_jeero-imports .jeero-template-example pre {
    1313  padding: 3px 5px 2px 5px;
    1414  margin: 0 1px;
     
    2323       tab-size: 2;
    2424}
    25 body.toplevel_page_jeero-imports .CodeMirror {
     25body.jeero_page_jeero-imports .CodeMirror {
    2626  height: auto;
    2727}
    28 body.toplevel_page_jeero-imports .jeero-field-post_fields table,
    29 body.toplevel_page_jeero-imports .jeero-field-custom_fields table {
     28body.jeero_page_jeero-imports .jeero-field-post_fields table,
     29body.jeero_page_jeero-imports .jeero-field-custom_fields table {
    3030  width: 100%;
    3131  table-layout: fixed;
    3232}
    33 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr th,
    34 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr th,
    35 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr td,
    36 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr td {
     33body.jeero_page_jeero-imports .jeero-field-post_fields table tr th,
     34body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th,
     35body.jeero_page_jeero-imports .jeero-field-post_fields table tr td,
     36body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td {
    3737  width: 100%;
    3838  padding: 0 10px 15px 0;
    3939  vertical-align: top;
    4040}
    41 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr th.name,
    42 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr th.name,
    43 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr td.name,
    44 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr td.name {
     41body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.name,
     42body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.name,
     43body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.name,
     44body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.name {
    4545  width: 200px;
    4646}
    47 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr th.name input,
    48 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr th.name input,
    49 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr td.name input,
    50 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr td.name input {
     47body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.name input,
     48body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.name input,
     49body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.name input,
     50body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.name input {
    5151  max-width: 100%;
    5252}
    53 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr th.actions,
    54 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr th.actions,
    55 body.toplevel_page_jeero-imports .jeero-field-post_fields table tr td.actions,
    56 body.toplevel_page_jeero-imports .jeero-field-custom_fields table tr td.actions {
     53body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.actions,
     54body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.actions,
     55body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.actions,
     56body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.actions {
    5757  width: 100px;
    5858  padding-right: 0;
    5959}
    60 body.admin_page_jeero-debug #jeero_debug_content {
     60body.jeero_page_jeero-debug #jeero_debug_content {
    6161  table-layout: fixed;
    6262}
  • jeero/trunk/assets/js/debug.js

    r3097470 r3170160  
    1 "use strict";(function(){jQuery((function(){var e,t,r;return r=function(){return e.each((function(){var e;return(e=jQuery(this)).scrollTop(e[0].scrollHeight)}))},e=jQuery(".jeero_debug_log"),r(),(t=jQuery("#jeero_debug_settings")).length>0&&wp.codeEditor.initialize(t,jeero_debug.settings),jQuery(document).on("heartbeat-tick",(function(t,u){return e.each((function(){var e,t;if(t="jeero_debug_log_"+(e=jQuery(this)).data("debug_log_slug"),null!=u[t])return e.text(u[t]),r()}))})),jQuery(document).on("heartbeat-send",(function(e,t){return t.jeero_heartbeat="get_debug_log"}))}))}).call(void 0);
     1"use strict";
     2
     3(function () {
     4  var format_His, get_chart_args, get_processed_stats, update_stats;
     5  format_His = function (date) {
     6    var hours, minutes, seconds;
     7    hours = date.getHours().toString().padStart(2, '0');
     8    minutes = date.getMinutes().toString().padStart(2, '0');
     9    seconds = date.getSeconds().toString().padStart(2, '0');
     10    return "".concat(hours, ":").concat(minutes, ":").concat(seconds);
     11  };
     12  get_processed_stats = function (stats) {
     13    var data, labels;
     14    labels = [];
     15    data = {
     16      'items_pickup': [],
     17      'items_processed': [],
     18      'duration_processed': []
     19    };
     20    stats.forEach(function (stat) {
     21      var stat_time, stat_time_str;
     22      stat_time = new Date(stat.time);
     23      if (isNaN(stat_time.getTime())) {
     24        console.warn('Invalid date:', stat.time);
     25        return;
     26      }
     27      stat_time_str = format_His(stat_time);
     28      if (labels.indexOf(stat_time_str) === -1) {
     29        labels.push(stat_time_str);
     30      }
     31      return data[stat.name].push({
     32        x: stat_time_str,
     33        y: stat.value
     34      });
     35    });
     36    return {
     37      labels: labels,
     38      data: data
     39    };
     40  };
     41  get_chart_args = function (stats) {
     42    return {
     43      type: 'line',
     44      data: {
     45        labels: stats.labels,
     46        datasets: [{
     47          label: 'Items pickup',
     48          data: stats.data.items_pickup,
     49          borderColor: 'rgba(75, 192, 192, 1)',
     50          borderWidth: 1,
     51          fill: false
     52        }, {
     53          label: 'Items processed',
     54          data: stats.data.items_processed,
     55          borderColor: 'rgba(153, 102, 255, 1)',
     56          borderWidth: 1,
     57          fill: false
     58        }, {
     59          label: 'Duration (s)',
     60          data: stats.data.duration_processed,
     61          borderColor: 'rgba(255, 99, 132, 1)',
     62          borderWidth: 1,
     63          fill: false
     64        }]
     65      },
     66      options: {
     67        scales: {
     68          x: {
     69            type: 'category'
     70          }
     71        },
     72        animation: false
     73      }
     74    };
     75  };
     76  update_stats = function (stats, chart) {
     77    var $debug_stats, args, processed_stats;
     78    processed_stats = get_processed_stats(stats);
     79    args = get_chart_args(processed_stats);
     80    if (chart == null) {
     81      $debug_stats = jQuery('#jeero_debug_stats');
     82      if ($debug_stats.length < 1) {
     83        return;
     84      }
     85      return new Chart($debug_stats[0].getContext('2d'), args);
     86    }
     87    chart.data = args.data;
     88    chart.update();
     89    return chart;
     90  };
     91  jQuery(function () {
     92    var $debug_logs, $debug_settings, scroll_to_bottom, stats_chart;
     93    scroll_to_bottom = function () {
     94      return $debug_logs.each(function () {
     95        var $debug_log;
     96        $debug_log = jQuery(this);
     97        return $debug_log.scrollTop($debug_log[0].scrollHeight);
     98      });
     99    };
     100
     101    // The textareas that contain the debug logs.
     102    $debug_logs = jQuery('.jeero_debug_log');
     103    scroll_to_bottom();
     104    stats_chart = update_stats(jeero_debug.stats, null);
     105    $debug_settings = jQuery('#jeero_debug_settings');
     106    if ($debug_settings.length > 0) {
     107      wp.codeEditor.initialize($debug_settings, jeero_debug.settings);
     108    }
     109    jQuery(document).on('heartbeat-tick', function (event, data) {
     110      $debug_logs.each(function () {
     111        var $debug_log, debug_log_slug;
     112        $debug_log = jQuery(this);
     113        debug_log_slug = 'jeero_debug_log_' + $debug_log.data('debug_log_slug');
     114        if (data[debug_log_slug] == null) {
     115          return;
     116        }
     117
     118        // Refresh the debug log with the fresh debug log coming from the Heartbeat API.
     119        $debug_log.text(data[debug_log_slug]);
     120        return scroll_to_bottom();
     121      });
     122      if (data['jeero_debug_stats'] != null) {
     123        return stats_chart = update_stats(data['jeero_debug_stats'], stats_chart);
     124      }
     125    });
     126    return jQuery(document).on('heartbeat-send', function (event, data) {
     127      // Request a fresh debug log using the Heartbeat API.
     128      return data.jeero_heartbeat = 'get_debug_log';
     129    });
     130  });
     131}).call(void 0);
     132
     133//# sourceMappingURL=debug.js.map
  • jeero/trunk/includes/Admin/Admin.php

    r3031625 r3170160  
    1616 * @since   1.24.1  Changed parent slug of debug admin page to ' ', to prevent a PHP 8.1+ warning.
    1717 *                  @see https://core.trac.wordpress.org/ticket/57579#comment:9
     18 * @since   1.30    Added Settings and Logs submenus.
    1819 * @return  void
    1920 */
     
    2122   
    2223    add_menu_page(
     24        'Jeero',
     25        'Jeero',
     26        'manage_options',
     27        'jeero',
     28        '',
     29        'dashicons-tickets-alt',
     30        90
     31    );
     32
     33    add_submenu_page(
     34        'jeero',
    2335        __( 'Jeero Imports', 'jeero' ),
    24         'Jeero',
     36        __( 'Imports', 'jeero' ),
    2537        'manage_options',
    2638        'jeero/imports',
    2739        __NAMESPACE__.'\Subscriptions\do_admin_page',
    28         'dashicons-tickets-alt',
    29         90
    3040    );
    3141   
    3242    add_submenu_page(
    33         ' ',
    34         __( 'Jeero Logs', 'jeero' ),
    35         __( 'Jeero Logs', 'jeero' ),
     43        'jeero',
     44        __( 'Jeero Settings', 'jeero' ),
     45        __( 'Settings' ),
    3646        'manage_options',
    37         'jeero/debug',
    38         __NAMESPACE__.'\Debug\do_admin_page',
     47        'jeero/settings',
     48        __NAMESPACE__.'\Settings\do_admin_page',
    3949    );
     50   
     51    if ( \get_option( 'jeero/enable_logs' ) ) {
     52        add_submenu_page(
     53            'jeero',
     54            __( 'Jeero Logs', 'jeero' ),
     55            __( 'Logs', 'jeero' ),
     56            'manage_options',
     57            'jeero/debug',
     58            __NAMESPACE__.'\Debug\do_admin_page',
     59        );
     60    }
     61   
     62    remove_submenu_page( 'jeero', 'jeero' );
    4063   
    4164}
  • jeero/trunk/includes/Admin/Debug/Debug.php

    r3097470 r3170160  
    1414
    1515    $current_screen = get_current_screen();
    16    
    17     if ( 'admin_page_jeero/debug' != $current_screen->id ) {
     16
     17    if ( 'jeero_page_jeero/debug' != $current_screen->id ) {
    1818        return;
    1919    }
    20     \wp_enqueue_script( 'jeero/debug', \Jeero\PLUGIN_URI . 'assets/js/debug.js', array( 'jquery', 'wp-theme-plugin-editor' ), \Jeero\VERSION );
     20
     21    \wp_register_script( 'chart', 'https://cdn.jsdelivr.net/npm/chart.js@^3', array(), null, true );   
     22    \wp_enqueue_script(
     23        'jeero/debug',
     24        \Jeero\PLUGIN_URI . 'assets/js/debug.js',
     25        array( 'jquery', 'chart', 'wp-theme-plugin-editor' ),
     26        \Jeero\VERSION
     27    );
    2128    \wp_localize_script( 'jeero/debug', 'jeero_debug_logs', \Jeero\Logs\get_logs() );
    2229
    2330    $jeero_debug = array(
     31        'stats' => \Jeero\Logs\Stats\get_stats(),
    2432        'settings' => array(
    2533            'codeEditor' => \wp_enqueue_code_editor(
     
    4149 * Adds the Jeero debug log to the heartbeat response.
    4250 *
    43  * The debug admin screen uses the WordPress Heartbeat API to auto-update the Jeero debug log that is displayed in the screen.
     51 * The debug admin screen uses the WordPress Heartbeat API to auto-update the Jeero debug log and stats that are displayed in the screen.
    4452 *
    4553 * @since   1.24
     54 * @since   1.30    Added stats to heartbeat response.
    4655 * @return  array   $response   The heartbeat response.
    4756 */
     
    6877    }
    6978   
     79    $response[ 'jeero_debug_stats' ] = \Jeero\Logs\Stats\get_stats();
     80   
    7081    return $response;
    7182   
    7283}
    7384
     85/**
     86 * Output the Jeero debug admin page.
     87 *
     88 * @since   1.24
     89 * @since   1.30    Added stats.
     90 * @return  void
     91 */
    7492function do_admin_page() {
    7593   
     
    7896        <hr class="wp-header-end">
    7997       
    80         <p>This page contains debug information about Jeero that can help us investigate any issues with your imports.<br>
    81              Do not share this information with anyone, except when requested specifically by Jeero support.</p>
     98        <p><?php
     99            _e( 'This page contains debug information about Jeero that can help us investigate any issues with your imports.', 'jeero' );
     100            ?><br><?php
     101            _e( 'Do not share this information with anyone, except when requested specifically by Jeero support.', 'jeero' ); ?></p>
    82102       
    83103        <table class="form-table" role="presentation" id="jeero_debug_content">
     
    95115                }
    96116                ?><tr>
    97                     <th scope="row">Settings</th>
     117                    <th scope="row"><?php _e( 'Stats', 'jeero' ); ?></th>
     118                    <td><canvas id="jeero_debug_stats"></canvas></td>
     119                </tr>
     120                <tr>
     121                    <th scope="row"><?php _e( 'Settings' ); ?></th>
    98122                    <td>
    99123                        <textarea id="jeero_debug_settings" class="large-text code" rows="20" readonly><?php
  • jeero/trunk/includes/Admin/Templates/Templates.php

    r2543765 r3170160  
    1414
    1515    $current_screen = get_current_screen();
    16     if ( 'toplevel_page_jeero/imports' != $current_screen->id ) {
     16
     17    if ( 'jeero_page_jeero/imports' != $current_screen->id ) {
    1718        return;
    1819    }
  • jeero/trunk/includes/Inbox/Inbox.php

    r3079220 r3170160  
    1919use Jeero\Subscriptions;
    2020use Jeero\Logs;
     21use Jeero\Logs\Stats;
    2122
    2223const PICKUP_ITEMS_HOOK = 'jeero\inbox\pickup_items';
     
    5455 * @since   1.18    @uses \Jeero\Logs\log().
    5556 * @since   1.27    @uses get_inbox_no_of_items_per_pickup() to set the number of items in each inbox pickup.
     57 * @since   1.30    Added stats.
    5658 * @return  void
    5759 */
     
    8284    if ( empty( $items ) ) {
    8385        Logs\Log( 'No items found in inbox.' );     
     86        Logs\Stats\add_stat( 'items_pickup', 0 );
    8487    } else {
    85         Logs\Log( sprintf( '%d items found in inbox.', count( $items ) ) );
     88        $items_found = count( $items );
     89        Logs\Log( sprintf( '%d items found in inbox.', $items_found ) );
     90        Logs\Stats\add_stat( 'items_pickup', $items_found );
    8691    }
    8792       
     
    292297 * @since   1.27.2  Remove inbox items after processing.
    293298 *                  @uses get_inbox_pickup_interval() to stop processing items before the next pick up begins.
     299 * @since   1.30    Added stats.
    294300 *
    295301 * @param   array   $items
     
    330336   
    331337    Logs\Log( sprintf( 'Processed %d out of %d items in %.2f seconds.', count( $items_processed ), count( $items ), $elapsed_time ) );
     338    Logs\Stats\add_stat( 'items_processed', count( $items_processed ) );
     339    Logs\Stats\add_stat( 'duration_processed', $elapsed_time );
    332340   
    333341}
  • jeero/trunk/includes/Jeero.php

    r2773539 r3170160  
    1717include_once PLUGIN_PATH.'includes/Admin/Admin.php';
    1818include_once PLUGIN_PATH.'includes/Admin/Debug/Debug.php';
     19include_once PLUGIN_PATH.'includes/Admin/Settings/Settings.php';
    1920include_once PLUGIN_PATH.'includes/Admin/Subscriptions/Subscriptions.php';
    2021include_once PLUGIN_PATH.'includes/Admin/Subscriptions/List_Table.php';
     
    3637include_once PLUGIN_PATH.'includes/Calendars/Sugar_Calendar.php';
    3738include_once PLUGIN_PATH.'includes/Calendars/WP_Event_Manager.php';
     39include_once PLUGIN_PATH.'includes/Calendars/Custom_Post_Type.php';
    3840
    3941include_once PLUGIN_PATH.'includes/Theaters/Theaters.php';
     
    5961
    6062include_once PLUGIN_PATH.'includes/Logs/Logs.php';
     63include_once PLUGIN_PATH.'includes/Logs/Stats.php';
    6164
    6265include_once PLUGIN_PATH.'includes/Mother/Mother.php';
  • jeero/trunk/includes/Logs/Logs.php

    r3104430 r3170160  
    9696    $upload_dir = get_upload_dir();
    9797   
    98     if ( \is_wp_error(  $upload_dir ) ) {
     98    if ( \is_wp_error( $upload_dir ) ) {
    9999        return $upload_dir;
    100100    }
     
    108108 *
    109109 * @since   1.18
    110  * @since   1.21    Improved error handling is getting logfile path fails.
     110 * @since   1.21    Improved error handling if getting logfile path fails.
    111111 *
    112112 * @return  void
     
    138138 * @since   1.21    Improved error handling is getting logfile path fails.
    139139 * @since   1.29    Fixed timestamp of logs, now uses local time.
     140 * @since   1.30    Check if logs are enabled before logging.
    140141 *
    141142 * @param   string  $message
     
    143144 */
    144145function log( $message, $slug = 'local' ) {
     146   
     147    if ( !\get_option( 'jeero/enable_logs' ) ) {
     148        return;
     149    }
    145150   
    146151    rotate_logs( $slug );
  • jeero/trunk/readme.txt

    r3148703 r3170160  
    6464* [Very Simple Event List](/plugins/very-simple-event-list/)
    6565* [WP Event Manager](/plugins/wp-event-manager/)
     66* Custom Post Types
    6667
    6768= Are you missing a ticketing solution? =
     
    8788= How do I upgrade? =
    8889
    89 I am still working on the subscription engine. Once it is ready the possibility to upgrade will be made available inside the plugin. It shouldn't take long. For now you can [contact me](mailto:jeroen@slimndap.com) so I can upgrade you manually.
    90 
    91 = How much will it cost? =
    92 
    93 Subscription rates will range from €20 - €30 per month, depending on your total number of events.
     90Go to the Jeero menu in the WordPress admin and click on the upgrade link next the import that needs to import more than 10 upcoming events.
     91
     92= How much does it cost? =
     93
     94Subscription rates range from €30 - €70 per month, depending on your total number of upcoming events.
    9495
    9596== Changelog ==
     97
     98= 1.30 =
     99* Added support for imports to custom post types.
     100* Added a settings page.
    96101
    97102= 1.29 =
     
    256261== Upgrade Notice ==
    257262
     263= 1.30 =
     264* Adds support for imports to custom post types.
     265
    258266= 1.29.4 =
    259267* Improved detection of malfunctioning WP-Cron.
Note: See TracChangeset for help on using the changeset viewer.