Changeset 3422012
- Timestamp:
- 12/17/2025 02:37:51 PM (3 months ago)
- Location:
- theatre/trunk
- Files:
-
- 6 edited
-
functions/jeero/class-theater-jeero-suggest.php (modified) (1 diff)
-
functions/wpt_event_editor.php (modified) (4 diffs)
-
functions/wpt_importer.php (modified) (4 diffs)
-
functions/wpt_setup.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
theater.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
theatre/trunk/functions/jeero/class-theater-jeero-suggest.php
r2373144 r3422012 93 93 94 94 <div class="desc column-description"><?php 95 esc_html_e( sprintf( 'Import %s events into Theater for WordPress.', $theater->title ), 'theatre'); ?></div>95 printf( esc_html__( 'Import %s events into Theater for WordPress.', 'theatre' ), $theater->title ); ?></div> 96 96 </div> 97 97 -
theatre/trunk/functions/wpt_event_editor.php
r3264336 r3422012 73 73 * @since 0.12 Event now inherits post_status from production. 74 74 * Fixes #141. 75 * @since 0.19.1 Requires capability to edit the production before creating events. 75 76 */ 76 77 public function create_event_over_ajax() { … … 80 81 parse_str( $_POST['post_data'], $post_data ); 81 82 83 $production_id = isset( $post_data['post_ID'] ) ? absint( $post_data['post_ID'] ) : 0; 84 85 if ( empty( $production_id ) || ! current_user_can( 'edit_post', $production_id ) ) { 86 wp_die( __( 'You are not allowed to create dates for this production.', 'theatre' ) ); 87 } 88 82 89 if ( ! empty($post_data['wpt_event_editor_event_date']) ) { 83 90 84 $post = array(85 'post_type' => WPT_Event::post_type_name,86 'post_status' => get_post_status( $post_data['post_ID']),87 );88 89 if ( $event_id = wp_insert_post( $post ) ) {90 91 add_post_meta( $event_id, WPT_Production::post_type_name, $post_data['post_ID'], true );91 $post = array( 92 'post_type' => WPT_Event::post_type_name, 93 'post_status' => get_post_status( $production_id ), 94 ); 95 96 if ( $event_id = wp_insert_post( $post ) ) { 97 98 add_post_meta( $event_id, WPT_Production::post_type_name, $production_id, true ); 92 99 93 100 foreach ( $this->get_fields( $event_id ) as $field ) { … … 97 104 } 98 105 99 echo $this->get_listing_html( $post_data['post_ID']);106 echo $this->get_listing_html( $production_id ); 100 107 101 108 wp_die(); … … 330 337 'title' => __( 'Tickets URL', 'theatre' ), 331 338 'edit' => array( 332 'placeholder' => 'http ://',339 'placeholder' => 'https://', 333 340 ), 334 341 ), -
theatre/trunk/functions/wpt_importer.php
r3388971 r3422012 77 77 add_action('update_option_'.$this->get('slug'), array($this,'update_options'), 10 ,2); 78 78 add_action('wp_loaded', array( $this, 'handle_import_linked' )); 79 80 add_filter( 'cron_schedules', array( $this, 'ensure_schedule_available' ) ); 79 81 80 82 add_filter('admin_init',array($this,'add_settings_fields')); … … 1182 1184 1183 1185 /** 1186 * Ensures the selected importer schedule is available during cron runs. 1187 * 1188 * @since 0.19.1 1189 * 1190 * @param array $schedules Current registered schedules. 1191 * @return array 1192 */ 1193 public function ensure_schedule_available( $schedules ) { 1194 1195 // Use the persisted importer options as the source of truth. These are loaded 1196 // on every request, including cron, so we can rebuild the recurrence definition 1197 // even when the original provider (e.g. Crontrol) is not loaded. 1198 $options = $this->get( 'options' ); 1199 1200 if ( empty( $options ) || ! is_array( $options ) ) { 1201 return $schedules; 1202 } 1203 1204 // No need to intervene when the importer is set to manual imports. 1205 if ( empty( $options['schedule'] ) || 'manual' === $options['schedule'] ) { 1206 return $schedules; 1207 } 1208 1209 $schedule = $options['schedule']; 1210 1211 // If the recurrence is already registered (either by us or another filter) we are done. 1212 if ( isset( $schedules[ $schedule ] ) ) { 1213 return $schedules; 1214 } 1215 1216 // Start with any metadata we stored when the user selected the recurrence. 1217 $meta = array(); 1218 1219 if ( ! empty( $options['schedule_meta'] ) && is_array( $options['schedule_meta'] ) ) { 1220 $meta = $options['schedule_meta']; 1221 } 1222 1223 // Fallback: try to read the interval from the currently scheduled event. 1224 // WordPress keeps the interval in the event payload even when the recurrence slug disappears. 1225 if ( empty( $meta['interval'] ) ) { 1226 $event = wp_get_scheduled_event( $this->get( 'slug' ) . '_import' ); 1227 1228 if ( $event && ! empty( $event->interval ) ) { 1229 $meta['interval'] = (int) $event->interval; 1230 } 1231 } 1232 1233 // Without an interval we can't recreate the recurrence; bail out silently. 1234 if ( empty( $meta['interval'] ) ) { 1235 return $schedules; 1236 } 1237 1238 // Use the slug as a human-readable label when none is stored. 1239 if ( empty( $meta['display'] ) ) { 1240 $meta['display'] = $schedule; 1241 } 1242 1243 // Cache the reconstructed metadata so subsequent cron runs do not need to repeat the work. 1244 $options['schedule_meta'] = array( 1245 'interval' => (int) $meta['interval'], 1246 'display' => $meta['display'], 1247 ); 1248 1249 $this->set( 'options', $options ); 1250 1251 // Finally inject the missing recurrence so wp_get_schedules() returns it for the remainder of the request. 1252 $schedules[ $schedule ] = array( 1253 'interval' => (int) $meta['interval'], 1254 'display' => $meta['display'], 1255 ); 1256 1257 return $schedules; 1258 } 1259 1260 /** 1261 * Derives schedule metadata for a recurrence slug. 1262 * 1263 * @since 0.20 1264 * 1265 * @param string $schedule Schedule slug. 1266 * @return array|false 1267 */ 1268 protected function get_schedule_meta( $schedule ) { 1269 if ( empty( $schedule ) || 'manual' === $schedule ) { 1270 return false; 1271 } 1272 1273 // Ask WordPress for the currently registered recurrences. In the admin this 1274 // includes third-party intervals such as those added by Crontrol. 1275 $schedules = wp_get_schedules(); 1276 1277 if ( ! isset( $schedules[ $schedule ] ) ) { 1278 return false; 1279 } 1280 1281 $interval = isset( $schedules[ $schedule ]['interval'] ) ? (int) $schedules[ $schedule ]['interval'] : 0; 1282 1283 // Intervals must be positive integers; invalid entries mean we cannot safely persist the schedule. 1284 if ( $interval <= 0 ) { 1285 return false; 1286 } 1287 1288 $display = isset( $schedules[ $schedule ]['display'] ) ? $schedules[ $schedule ]['display'] : $schedule; 1289 1290 return array( 1291 'interval' => $interval, 1292 'display' => $display, 1293 ); 1294 } 1295 1296 /** 1184 1297 * Runs after the settings are updated. 1185 1298 * … … 1188 1301 * 1189 1302 * @since 0.10 1303 * @since 0.20 Stores schedule metadata alongside the selected recurrence. 1190 1304 * 1191 1305 * @see WPT_Importer::init() … … 1195 1309 */ 1196 1310 function update_options($old_value,$value) { 1197 if (isset($value['schedule'])) { 1198 $this->schedule_import($value['schedule']); 1311 1312 $options = is_array( $value ) ? $value : array(); 1313 1314 if ( isset( $options['schedule'] ) ) { 1315 // Persist the interval/display so cron requests can rebuild the recurrence 1316 // even when the third-party plugin that defined it is not loaded. 1317 $meta = $this->get_schedule_meta( $options['schedule'] ); 1318 1319 if ( false !== $meta ) { 1320 $options['schedule_meta'] = $meta; 1321 } else { 1322 unset( $options['schedule_meta'] ); 1323 } 1324 } else { 1325 unset( $options['schedule_meta'] ); 1326 } 1327 1328 $this->set( 'options', $options ); 1329 1330 if ( $options !== $value ) { 1331 // Avoid infinite recursion: temporarily remove our own hook while writing the canonical options back. 1332 remove_action( 'update_option_'.$this->get('slug'), array($this,'update_options'), 10 ); 1333 update_option( $this->get('slug'), $options ); 1334 add_action( 'update_option_'.$this->get('slug'), array($this,'update_options'), 10, 2 ); 1335 } 1336 1337 if ( isset( $options['schedule'] ) ) { 1338 $this->schedule_import( $options['schedule'] ); 1199 1339 } 1200 1340 } -
theatre/trunk/functions/wpt_setup.php
r3388971 r3422012 310 310 * 311 311 * @since 0.11 312 * @since 0.19.1 Sanitizes price label to prevent HTML/JS injection. 312 313 * @param string $value The event_tickets_price value. 313 314 * @return string The sanitized event_tickets_price. … … 321 322 322 323 // Sanitize the name. 323 if ( !empty($prices_parts[1])) {324 $price_parts[1] = trim($price_parts[1]);324 if ( ! empty( $price_parts[1] ) ) { 325 $price_parts[1] = sanitize_text_field( $price_parts[1] ); 325 326 } 326 327 -
theatre/trunk/readme.txt
r3388971 r3422012 3 3 Tags: theatre, stage, venue, events, shows, concerts, tickets, ticketing, sports, performances, calendar, festival, workshops, theater, cinema 4 4 Requires at least: 4.7 5 Tested up to: 6. 65 Tested up to: 6.9 6 6 Requires PHP: 5.4 7 7 Stable tag: trunk … … 151 151 * Restores the original publication status when productions or events are untrashed, keeping revived content visible without extra clicks. 152 152 * Fixes PHP 8.2 warnings across Theater models. 153 * Fixes disappearing import cron schedules (0.19.1). 154 * Fixes two security issues inside the event editor (0.19.1). 153 155 * Deprecations 154 156 * Removed the long-abandoned custom CSS manager, simplifying legacy code paths. … … 323 325 == Upgrade Notice == 324 326 325 = 0.18.8 = 326 Security update and CSS improvements. 327 328 = 0.18.7 = 327 = 0.19.1 = 329 328 Security update. 330 331 = 0.18.5 =332 Fixes a PHP error when manually inserting an Event through wp_insert_post().333 334 = 0.18.4 =335 Fixes an XSS vulnerability.336 337 = 0.18.2 =338 Fixes a PHP warning.339 340 = 0.16.5 =341 Fixes some issues with WordPress 5.5.342 343 = 0.16 =344 New date and category filters on the events admin screen. New grouping by tag options for the front end.345 346 = 0.15.33 =347 Maintenance release fixing several long-standing minor issues.348 349 = 0.15.32 =350 Fixed an issue with the keyword filter for events.351 352 = 0.15.31 =353 Fixed another issue where sometimes events are shown in the wrong order.354 355 = 0.15.30 =356 Fixed an issue where sometimes events are shown in the wrong order.357 358 = 0.15.29 =359 Made it easier for developers to customize the event editor.360 361 = 0.15.28 =362 Fixes a problem with the Categories widget that was introduced in a previous update.363 364 = 0.15.27 =365 Added a new `{{tags}}` placeholder for events.366 367 = 0.15.26 =368 Fixes a problem with the Production events widget that was introduced in a previous update.369 370 = 0.15.25 =371 Fixes a problem with the Calendar widget that was introduced in the previous update.372 373 = 0.15.24 =374 Performance improvements, especially noticeable during imports.375 376 = 0.15.23 =377 The calendar widget now jumps to the active month if you show the widget on you events page.378 379 = 0.15.22 =380 Fixes performance issues with some websites that use full page caching plugins and services.381 382 = 0.15.21 =383 Tiny internal improvement to the events admin screen.384 385 = 0.15.20 =386 Added a filter to alter the default behaviour of an importer.387 388 = 0.15.17 =389 Added two WordPress filters to add extra filter controls to the events admin screen.390 391 = 0.15.15 =392 Fixes several compatibility issues with WordPress 4.7.393 394 = 0.15.14 =395 Fixes a problem with the changelog of extensions if you're running multiple extensions.396 397 = 0.15.13 =398 Fixes a problem with the sort order of events on the admin screen.399 400 = 0.15.12 =401 Fixes a problem that was introduced in 0.15.10 where past events were not visible in the admin.402 403 = 0.15.11 =404 Small bugfixes and CSS tweaks.405 406 = 0.15.10 =407 Fixes the ordering of events on archive pages. Fixes a problem with the 'end' filter for events.408 409 = 0.15.9 =410 Fixes a problem where search results got lost when navigating on the Theater Events page in the WordPress admin.411 412 = 0.15.8 =413 Fixes in the HTML output of the Calendar widget and improves the sanitization of ticket urls.414 415 = 0.15.7 =416 Fixes two issues with displaying event dates.417 418 = 0.15.6 =419 Fixes a problem with updates for Theater for WordPress extension plugins.420 421 = 0.15.5 =422 Adds support for a 'tag' filter in event lists. Fixes a problem when bulk publishing events.423 424 = 0.15.4 =425 Small bugfixes and improvements to the events admin screen.426 427 = 0.15.3 =428 Added a new `{{prices}}` placeholder for events.429 430 = 0.15.2 =431 Adds context information to fields in listings, useful for styling and context-aware hooks.432 433 = 0.15.1 =434 Fixes a problem with the 'date' filter in template placeholders.435 436 = 0.15 =437 This release focusses on a more streamlined experience when managing your events.438 439 = 0.14.7 =440 Adds context information to listings, useful for styling and context-aware hooks.441 442 = 0.14.6 =443 Adds two new filters to manipulate the appearance of events in lists.444 445 = 0.14.5 =446 Internal improvements that can be used by importer extensions. No real need to update if you are not importing events from an external ticketing solution.447 448 = 0.14.4 =449 The [wpt_events] shortcode now accepts a 'production' parameter to limit the a events list to one or more productions. -
theatre/trunk/theater.php
r3388984 r3422012 6 6 Description: Manage and publish events for your theater, live venue, cinema, club or festival. 7 7 Author: Jeroen Schmit 8 Version: 0.19 8 Version: 0.19.1 9 9 Author URI: http://slimndap.com/ 10 10 Text Domain: theatre … … 29 29 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 30 30 31 $wpt_version = '0.19 ';31 $wpt_version = '0.19.1'; 32 32 33 33 class WP_Theatre {
Note: See TracChangeset
for help on using the changeset viewer.