| @@ -14,12 +14,18 @@ | ||
| 14 | 14 | 'future', |
| 15 | 15 | 'private', |
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | - public $module_url; | |
| 18 | + /** | |
| 19 | + * Associative array of hook_name => callback_name | |
| 20 | + * This is used for Gutenberg-compat initialization | |
| 21 | + * [ | |
| 22 | + * 'init' => 'init_callback_on_module_instance' | |
| 23 | + * ] | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | + protected $compat_hooks = []; | |
| 19 | 27 | |
| 20 | - public $module; | |
| 21 | - | |
| 22 | 28 | function __construct() {} |
| 23 | 29 | |
| 24 | 30 | /** |
| 25 | 31 | * Returns whether the current module is enabled. |
| @@ -208,14 +214,16 @@ | ||
| 208 | 214 | * @since 0.7 |
| 209 | 215 | */ |
| 210 | 216 | function enqueue_datepicker_resources() { |
| 211 | 217 | |
| 218 | + // Add the first day of the week as an available variable to wp_head | |
| 219 | + echo "<script type=\"text/javascript\">var ef_week_first_day=\"" . get_option( 'start_of_week' ) . "\";</script>"; | |
| 220 | + | |
| 212 | 221 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 213 | 222 | |
| 214 | 223 | //Timepicker needs to come after jquery-ui-datepicker and jquery |
| 215 | 224 | wp_enqueue_script( 'edit_flow-timepicker', EDIT_FLOW_URL . 'common/js/jquery-ui-timepicker-addon.js', array( 'jquery', 'jquery-ui-datepicker' ), EDIT_FLOW_VERSION, true ); |
| 216 | 225 | wp_enqueue_script( 'edit_flow-date_picker', EDIT_FLOW_URL . 'common/js/ef_date.js', array( 'jquery', 'jquery-ui-datepicker', 'edit_flow-timepicker' ), EDIT_FLOW_VERSION, true ); |
| 217 | - wp_add_inline_script( 'edit_flow-date_picker', sprintf( 'var ef_week_first_day = %s;', wp_json_encode( get_option( 'start_of_week' ) ) ), 'before' ); | |
| 218 | 226 | |
| 219 | 227 | // Now styles |
| 220 | 228 | wp_enqueue_style( 'jquery-ui-datepicker', EDIT_FLOW_URL . 'common/css/jquery.ui.datepicker.css', array( 'wp-jquery-ui-dialog' ), EDIT_FLOW_VERSION, 'screen' ); |
| 221 | 229 | wp_enqueue_style( 'jquery-ui-theme', EDIT_FLOW_URL . 'common/css/jquery.ui.theme.css', false, EDIT_FLOW_VERSION, 'screen' ); |
| @@ -440,9 +448,9 @@ | ||
| 440 | 448 | break; |
| 441 | 449 | } |
| 442 | 450 | } |
| 443 | 451 | |
| 444 | - return sprintf( _n( "1 $name ago", "$count {$name}s ago", $count), $count); | |
| 452 | + return sprintf( _n( "1 $name ago", "$count ${name}s ago", $count), $count); | |
| 445 | 453 | } |
| 446 | 454 | |
| 447 | 455 | /** |
| 448 | 456 | * Displays a list of users that can be selected! |
| @@ -464,9 +472,9 @@ | ||
| 464 | 472 | $parsed_args = wp_parse_args( $args, $defaults ); |
| 465 | 473 | extract($parsed_args, EXTR_SKIP); |
| 466 | 474 | |
| 467 | 475 | $args = array( |
| 468 | - 'capability' => 'publish_posts', | |
| 476 | + 'who' => 'authors', | |
| 469 | 477 | 'fields' => array( |
| 470 | 478 | 'ID', |
| 471 | 479 | 'display_name', |
| 472 | 480 | 'user_email' |
| @@ -481,9 +489,9 @@ | ||
| 481 | 489 | ?> |
| 482 | 490 | |
| 483 | 491 | <?php if( !empty($users) ) : ?> |
| 484 | 492 | <ul class="<?php echo esc_attr( $list_class ) ?>"> |
| 485 | - <?php foreach( $users as $user ) : | |
| 493 | + <?php foreach( $users as $user ) : | |
| 486 | 494 | $checked = ( in_array($user->ID, $selected) ) ? 'checked="checked"' : ''; |
| 487 | 495 | // Add a class to checkbox of current user so we know not to add them in notified list during notifiedMessage() js function |
| 488 | 496 | $current_user_class = ( get_current_user_id() == $user->ID ) ? 'class="post_following_list-current_user" ' : ''; |
| 489 | 497 | ?> |
| @@ -589,7 +597,16 @@ | ||
| 589 | 597 | $new_description = $this->get_encoded_description( $description_args ); |
| 590 | 598 | wp_update_term( $term->term_id, $taxonomy, array( 'description' => $new_description ) ); |
| 591 | 599 | } |
| 592 | 600 | } |
| 601 | + | |
| 602 | + /** | |
| 603 | + * Return compatibility hooks for the current instance | |
| 604 | + * | |
| 605 | + * @return array | |
| 606 | + */ | |
| 607 | + function get_compat_hooks() { | |
| 608 | + return isset( $this->compat_hooks ) && is_array( $this->compat_hooks ) ? $this->compat_hooks : []; | |
| 609 | + } | |
| 610 | + | |
| 593 | 611 | } |
| 594 | - | |
| 595 | 612 | } |