Changeset 3170160
- Timestamp:
- 10/16/2024 01:33:43 PM (18 months ago)
- Location:
- jeero/trunk
- Files:
-
- 4 added
- 10 edited
-
Jeero.php (modified) (2 diffs)
-
assets/css/admin.css (modified) (2 diffs)
-
assets/js/debug.js (modified) (1 diff)
-
includes/Admin/Admin.php (modified) (2 diffs)
-
includes/Admin/Debug/Debug.php (modified) (5 diffs)
-
includes/Admin/Settings (added)
-
includes/Admin/Settings/Settings.php (added)
-
includes/Admin/Templates/Templates.php (modified) (1 diff)
-
includes/Calendars/Custom_Post_Type.php (added)
-
includes/Inbox/Inbox.php (modified) (5 diffs)
-
includes/Jeero.php (modified) (3 diffs)
-
includes/Logs/Logs.php (modified) (4 diffs)
-
includes/Logs/Stats.php (added)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jeero/trunk/Jeero.php
r3148703 r3170160 6 6 * Author: Slim & Dapper 7 7 * Author URI: https://slimndap.com 8 * Version: 1. 29.48 * Version: 1.30 9 9 * Text Domain: jeero 10 10 * … … 19 19 } 20 20 21 define( 'Jeero\VERSION', '1. 29.4' );21 define( 'Jeero\VERSION', '1.30' ); 22 22 define( 'Jeero\PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 23 23 define( '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 {1 body.jeero_page_jeero-imports .jeero-field-message dl { 2 2 display: flex; 3 3 flex-wrap: wrap; 4 4 } 5 body. toplevel_page_jeero-imports .jeero-field-message dl dt {5 body.jeero_page_jeero-imports .jeero-field-message dl dt { 6 6 flex: 0 0 200px; 7 7 } 8 body. toplevel_page_jeero-imports .jeero-field-message dl dd {8 body.jeero_page_jeero-imports .jeero-field-message dl dd { 9 9 flex: 0 0 calc(100% - 200px); 10 10 margin-left: 0; 11 11 } 12 body. toplevel_page_jeero-imports .jeero-template-example pre {12 body.jeero_page_jeero-imports .jeero-template-example pre { 13 13 padding: 3px 5px 2px 5px; 14 14 margin: 0 1px; … … 23 23 tab-size: 2; 24 24 } 25 body. toplevel_page_jeero-imports .CodeMirror {25 body.jeero_page_jeero-imports .CodeMirror { 26 26 height: auto; 27 27 } 28 body. toplevel_page_jeero-imports .jeero-field-post_fields table,29 body. toplevel_page_jeero-imports .jeero-field-custom_fields table {28 body.jeero_page_jeero-imports .jeero-field-post_fields table, 29 body.jeero_page_jeero-imports .jeero-field-custom_fields table { 30 30 width: 100%; 31 31 table-layout: fixed; 32 32 } 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 {33 body.jeero_page_jeero-imports .jeero-field-post_fields table tr th, 34 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th, 35 body.jeero_page_jeero-imports .jeero-field-post_fields table tr td, 36 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td { 37 37 width: 100%; 38 38 padding: 0 10px 15px 0; 39 39 vertical-align: top; 40 40 } 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 {41 body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.name, 42 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.name, 43 body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.name, 44 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.name { 45 45 width: 200px; 46 46 } 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 {47 body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.name input, 48 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.name input, 49 body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.name input, 50 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.name input { 51 51 max-width: 100%; 52 52 } 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 {53 body.jeero_page_jeero-imports .jeero-field-post_fields table tr th.actions, 54 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr th.actions, 55 body.jeero_page_jeero-imports .jeero-field-post_fields table tr td.actions, 56 body.jeero_page_jeero-imports .jeero-field-custom_fields table tr td.actions { 57 57 width: 100px; 58 58 padding-right: 0; 59 59 } 60 body. admin_page_jeero-debug #jeero_debug_content {60 body.jeero_page_jeero-debug #jeero_debug_content { 61 61 table-layout: fixed; 62 62 } -
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 16 16 * @since 1.24.1 Changed parent slug of debug admin page to ' ', to prevent a PHP 8.1+ warning. 17 17 * @see https://core.trac.wordpress.org/ticket/57579#comment:9 18 * @since 1.30 Added Settings and Logs submenus. 18 19 * @return void 19 20 */ … … 21 22 22 23 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', 23 35 __( 'Jeero Imports', 'jeero' ), 24 'Jeero',36 __( 'Imports', 'jeero' ), 25 37 'manage_options', 26 38 'jeero/imports', 27 39 __NAMESPACE__.'\Subscriptions\do_admin_page', 28 'dashicons-tickets-alt',29 9030 40 ); 31 41 32 42 add_submenu_page( 33 ' ',34 __( 'Jeero Logs', 'jeero' ),35 __( ' Jeero Logs', 'jeero' ),43 'jeero', 44 __( 'Jeero Settings', 'jeero' ), 45 __( 'Settings' ), 36 46 'manage_options', 37 'jeero/ debug',38 __NAMESPACE__.'\ Debug\do_admin_page',47 'jeero/settings', 48 __NAMESPACE__.'\Settings\do_admin_page', 39 49 ); 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' ); 40 63 41 64 } -
jeero/trunk/includes/Admin/Debug/Debug.php
r3097470 r3170160 14 14 15 15 $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 ) { 18 18 return; 19 19 } 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 ); 21 28 \wp_localize_script( 'jeero/debug', 'jeero_debug_logs', \Jeero\Logs\get_logs() ); 22 29 23 30 $jeero_debug = array( 31 'stats' => \Jeero\Logs\Stats\get_stats(), 24 32 'settings' => array( 25 33 'codeEditor' => \wp_enqueue_code_editor( … … 41 49 * Adds the Jeero debug log to the heartbeat response. 42 50 * 43 * The debug admin screen uses the WordPress Heartbeat API to auto-update the Jeero debug log that isdisplayed 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. 44 52 * 45 53 * @since 1.24 54 * @since 1.30 Added stats to heartbeat response. 46 55 * @return array $response The heartbeat response. 47 56 */ … … 68 77 } 69 78 79 $response[ 'jeero_debug_stats' ] = \Jeero\Logs\Stats\get_stats(); 80 70 81 return $response; 71 82 72 83 } 73 84 85 /** 86 * Output the Jeero debug admin page. 87 * 88 * @since 1.24 89 * @since 1.30 Added stats. 90 * @return void 91 */ 74 92 function do_admin_page() { 75 93 … … 78 96 <hr class="wp-header-end"> 79 97 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> 82 102 83 103 <table class="form-table" role="presentation" id="jeero_debug_content"> … … 95 115 } 96 116 ?><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> 98 122 <td> 99 123 <textarea id="jeero_debug_settings" class="large-text code" rows="20" readonly><?php -
jeero/trunk/includes/Admin/Templates/Templates.php
r2543765 r3170160 14 14 15 15 $current_screen = get_current_screen(); 16 if ( 'toplevel_page_jeero/imports' != $current_screen->id ) { 16 17 if ( 'jeero_page_jeero/imports' != $current_screen->id ) { 17 18 return; 18 19 } -
jeero/trunk/includes/Inbox/Inbox.php
r3079220 r3170160 19 19 use Jeero\Subscriptions; 20 20 use Jeero\Logs; 21 use Jeero\Logs\Stats; 21 22 22 23 const PICKUP_ITEMS_HOOK = 'jeero\inbox\pickup_items'; … … 54 55 * @since 1.18 @uses \Jeero\Logs\log(). 55 56 * @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. 56 58 * @return void 57 59 */ … … 82 84 if ( empty( $items ) ) { 83 85 Logs\Log( 'No items found in inbox.' ); 86 Logs\Stats\add_stat( 'items_pickup', 0 ); 84 87 } 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 ); 86 91 } 87 92 … … 292 297 * @since 1.27.2 Remove inbox items after processing. 293 298 * @uses get_inbox_pickup_interval() to stop processing items before the next pick up begins. 299 * @since 1.30 Added stats. 294 300 * 295 301 * @param array $items … … 330 336 331 337 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 ); 332 340 333 341 } -
jeero/trunk/includes/Jeero.php
r2773539 r3170160 17 17 include_once PLUGIN_PATH.'includes/Admin/Admin.php'; 18 18 include_once PLUGIN_PATH.'includes/Admin/Debug/Debug.php'; 19 include_once PLUGIN_PATH.'includes/Admin/Settings/Settings.php'; 19 20 include_once PLUGIN_PATH.'includes/Admin/Subscriptions/Subscriptions.php'; 20 21 include_once PLUGIN_PATH.'includes/Admin/Subscriptions/List_Table.php'; … … 36 37 include_once PLUGIN_PATH.'includes/Calendars/Sugar_Calendar.php'; 37 38 include_once PLUGIN_PATH.'includes/Calendars/WP_Event_Manager.php'; 39 include_once PLUGIN_PATH.'includes/Calendars/Custom_Post_Type.php'; 38 40 39 41 include_once PLUGIN_PATH.'includes/Theaters/Theaters.php'; … … 59 61 60 62 include_once PLUGIN_PATH.'includes/Logs/Logs.php'; 63 include_once PLUGIN_PATH.'includes/Logs/Stats.php'; 61 64 62 65 include_once PLUGIN_PATH.'includes/Mother/Mother.php'; -
jeero/trunk/includes/Logs/Logs.php
r3104430 r3170160 96 96 $upload_dir = get_upload_dir(); 97 97 98 if ( \is_wp_error( $upload_dir ) ) {98 if ( \is_wp_error( $upload_dir ) ) { 99 99 return $upload_dir; 100 100 } … … 108 108 * 109 109 * @since 1.18 110 * @since 1.21 Improved error handling i sgetting logfile path fails.110 * @since 1.21 Improved error handling if getting logfile path fails. 111 111 * 112 112 * @return void … … 138 138 * @since 1.21 Improved error handling is getting logfile path fails. 139 139 * @since 1.29 Fixed timestamp of logs, now uses local time. 140 * @since 1.30 Check if logs are enabled before logging. 140 141 * 141 142 * @param string $message … … 143 144 */ 144 145 function log( $message, $slug = 'local' ) { 146 147 if ( !\get_option( 'jeero/enable_logs' ) ) { 148 return; 149 } 145 150 146 151 rotate_logs( $slug ); -
jeero/trunk/readme.txt
r3148703 r3170160 64 64 * [Very Simple Event List](/plugins/very-simple-event-list/) 65 65 * [WP Event Manager](/plugins/wp-event-manager/) 66 * Custom Post Types 66 67 67 68 = Are you missing a ticketing solution? = … … 87 88 = How do I upgrade? = 88 89 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 willit cost? =92 93 Subscription rates will range from €20 - €30 per month, depending on your total number ofevents.90 Go 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 94 Subscription rates range from €30 - €70 per month, depending on your total number of upcoming events. 94 95 95 96 == Changelog == 97 98 = 1.30 = 99 * Added support for imports to custom post types. 100 * Added a settings page. 96 101 97 102 = 1.29 = … … 256 261 == Upgrade Notice == 257 262 263 = 1.30 = 264 * Adds support for imports to custom post types. 265 258 266 = 1.29.4 = 259 267 * Improved detection of malfunctioning WP-Cron.
Note: See TracChangeset
for help on using the changeset viewer.