Plugin Directory

Changeset 3356826

Timestamp:
09/05/2025 05:06:51 PM (3 months ago)
Author:
bracketspace
Message:

Update to version 2.6.4 from GitHub

Location:
advanced-cron-manager
Files:
44 edited
1 copied

Legend:

Unmodified
Added
Removed
  • advanced-cron-manager/tags/2.6.4/advanced-cron-manager.php

    r3353664 r3356826  
    33 * Plugin Name: Advanced Cron Manager
    44 * Description: View, pause, remove, edit and add WP Cron events.
    5  * Version: 2.6.3
     5 * Version: 2.6.4
    66 * Author: BracketSpace
    77 * Author URI: https://bracketspace.com
     
    1212 */
    1313
    14 $plugin_version = '2.6.3';
     14$plugin_version = '2.6.4';
    1515$plugin_file    = __FILE__;
    1616
     
    6060        }
    6161    }
    62 
    6362}
    6463
     
    8079$files = new underDEV\Utils\Files( $plugin_file );
    8180
    82 $view = function() use ( $files ) {
     81$view = function () use ( $files ) {
    8382    return new underDEV\Utils\View( $files );
    8483};
    8584
    86 $ajax = function() {
     85$ajax = function () {
    8786    return new underDEV\Utils\Ajax();
    8887};
    8988
    90 $server_settings = function() use ( $view, $ajax ) {
     89$server_settings = function () use ( $view, $ajax ) {
    9190    return new underDEV\AdvancedCronManager\Server\Settings( $view(), $ajax() );
    9291};
    9392
    94 $misc = function() use ( $view ) {
     93$misc = function () use ( $view ) {
    9594    return new underDEV\AdvancedCronManager\Misc( $view() );
    9695};
    9796
    98 $server_processor = function() use ( $server_settings ) {
     97$server_processor = function () use ( $server_settings ) {
    9998    return new underDEV\AdvancedCronManager\Server\Processor( $server_settings() );
    10099};
     
    102101$schedules_library = new underDEV\AdvancedCronManager\Cron\SchedulesLibrary( $ajax() );
    103102
    104 $schedules = function() use ( $schedules_library ) {
     103$schedules = function () use ( $schedules_library ) {
    105104    return new underDEV\AdvancedCronManager\Cron\Schedules( $schedules_library );
    106105};
    107106
    108 $schedules_actions = function() use ( $ajax, $schedules_library ) {
     107$schedules_actions = function () use ( $ajax, $schedules_library ) {
    109108    return new underDEV\AdvancedCronManager\Cron\SchedulesActions( $ajax(), $schedules_library );
    110109};
    111110
    112 $events = function() use ( $schedules ) {
     111$events = function () use ( $schedules ) {
    113112    return new underDEV\AdvancedCronManager\Cron\Events( $schedules() );
    114113};
    115114
    116 $events_library = function() use ( $schedules, $events ) {
     115$events_library = function () use ( $schedules, $events ) {
    117116    return new underDEV\AdvancedCronManager\Cron\EventsLibrary( $schedules(), $events() );
    118117};
    119118
    120 $events_actions = function() use ( $ajax, $events, $events_library, $schedules ) {
     119$events_actions = function () use ( $ajax, $events, $events_library, $schedules ) {
    121120    return new underDEV\AdvancedCronManager\Cron\EventsActions( $ajax(), $events(), $events_library(), $schedules() );
    122121};
     
    184183
    185184// Notification promo.
    186 add_action( 'plugins_loaded', function() use ( $misc ) {
     185add_action( 'plugins_loaded', function () use ( $misc ) {
    187186    if ( ! function_exists( 'register_trigger' ) ) {
    188187        add_action( 'advanced-cron-manager/screen/sidebar', array( $misc(), 'load_notification_promo_part' ), 1000, 1 );
  • advanced-cron-manager/tags/2.6.4/inc/AdminScreen.php

    r3353664 r3356826  
    7474        $this->schedules = $schedules;
    7575        $this->events    = $events;
    76 
    7776    }
    7877
     
    126125
    127126        }
    128 
    129127    }
    130128
     
    143141     * because we want to separate scopes
    144142     *
    145      * @param  object $view instance of parent view.
    146      * @return void
    147      */
    148     public function load_searchbox_part( $view ) {
     143     * @return void
     144     */
     145    public function load_searchbox_part() {
    149146        $this->view->get_view( 'parts/searchbox' );
    150147    }
     
    155152     * because we want to separate scopes
    156153     *
    157      * @param  object $view instance of parent view.
    158      * @return void
    159      */
    160     public function load_events_table_part( $view ) {
     154     * @return void
     155     */
     156    public function load_events_table_part() {
     157
     158        if ( ! current_user_can( 'manage_options' ) ) {
     159            return;
     160        }
    161161
    162162        $this->view->set_var( 'events', $this->events->get_events() );
     
    170170
    171171        $this->view->get_view( 'parts/events/section' );
    172 
    173172    }
    174173
     
    178177     * because we want to separate scopes
    179178     *
    180      * @param  object $view instance of parent view.
    181      * @return void
    182      */
    183     public function load_schedules_table_part( $view ) {
     179     * @return void
     180     */
     181    public function load_schedules_table_part() {
     182
     183        if ( ! current_user_can( 'manage_options' ) ) {
     184            return;
     185        }
    184186
    185187        $this->view->set_var( 'schedules', $this->schedules->get_schedules(), true );
    186188
    187189        $this->view->get_view( 'parts/schedules/section' );
    188 
    189190    }
    190191
     
    194195     * because we want to separate scopes
    195196     *
    196      * @param  object $view instance of parent view.
    197      * @return void
    198      */
    199     public function load_slidebar_part( $view ) {
     197     * @return void
     198     */
     199    public function load_slidebar_part() {
    200200        $this->view->get_view( 'elements/slidebar' );
    201201    }
     
    206206     * because we want to separate scopes
    207207     *
    208      * @param  object $view instance of parent view.
    209      * @return void
    210      */
    211     public function load_preview_modal_part( $view ) {
     208     * @return void
     209     */
     210    public function load_preview_modal_part() {
    212211        $this->view->get_view( 'elements/preview-modal' );
    213212    }
     
    227226
    228227        return $tabs;
    229 
    230228    }
    231229
     
    309307            array( $this, 'load_page_wrapper' )
    310308        );
    311 
    312309    }
    313310
     
    355352        }
    356353
    357         $args_length = array_sum( array_map( function( $ar ) {
     354        $args_length = array_sum( array_map( function ( $ar ) {
    358355            return strlen( $ar['msg'] );
    359356        }, $parsed_args ) );
     
    365362        );
    366363    }
    367 
    368364}
  • advanced-cron-manager/tags/2.6.4/inc/Assets.php

    r3353664 r3356826  
    4949        $this->files          = $files;
    5050        $this->screen         = $screen;
    51 
    5251    }
    5352
     
    8786
    8887        do_action( 'advanced-cron-manager/screen/enqueue', $current_page_hook );
    89 
    9088    }
    91 
    9289}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/Element/Event.php

    r3096140 r3356826  
    7979     * @param array   $args      Arguments.
    8080     * @param integer $next_call Next call timestamp.
    81      * @param boolean $protected If protected.
     81     * @param boolean $is_protected If protected.
    8282     * @param boolean $paused    If paused.
     83     * @throws \InvalidArgumentException When hook is empty.
    8384     */
    84     public function __construct( $hook = null, $schedule = '', $interval = 0, $args = array(), $next_call = 0, $protected = false, $paused = false ) {
     85    public function __construct( $hook = null, $schedule = '', $interval = 0, $args = array(), $next_call = 0, $is_protected = false, $paused = false ) {
    8586
    8687        if ( empty( $hook ) ) {
    87             trigger_error( 'Hook cannot be empty', E_USER_ERROR );
     88            throw new \InvalidArgumentException( 'Hook cannot be empty' );
    8889        }
    8990
     
    9394        $this->args      = $args;
    9495        $this->next_call = $next_call;
    95         $this->protected = $protected;
     96        $this->protected = $is_protected;
    9697        $this->paused    = $paused;
    9798
    9899        // phpcs:ignore
    99100        $this->hash = substr( md5( $this->hook . $this->schedule . $this->next_call . serialize( $this->args ) ), 0, 8 );
    100 
    101101    }
    102102
     
    128128        $imp = '';
    129129
    130         $imp .= 'function ' . $function_name . '(' . $arguments . ') {<br>';
    131         $imp .= '&nbsp;&nbsp;&nbsp;&nbsp;// do stuff<br>';
    132         $imp .= '}<br>';
    133         $imp .= '<br>';
    134         $imp .= "add_action( '" . $this->hook . "',  '" . $function_name . "', 10, " . count( $this->args ) . ' );';
     130        $imp       .= 'function ' . $function_name . '(' . $arguments . ') {<br>';
     131        $imp       .= '&nbsp;&nbsp;&nbsp;&nbsp;// do stuff<br>';
     132        $imp       .= '}<br>';
     133        $imp       .= '<br>';
     134        $args_count = is_array( $this->args ) ? count( $this->args ) : 0;
     135        $imp       .= "add_action( '" . $this->hook . "',  '" . $function_name . "', 10, " . $args_count . ' );';
    135136
    136137        return $imp;
    137 
    138138    }
    139139
     
    147147        return esc_attr( wp_create_nonce( 'acm/event/' . $action . '/' . $this->hash ) );
    148148    }
    149 
    150149}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/Element/Schedule.php

    r3096140 r3356826  
    4949     * @param integer $interval  Interval.
    5050     * @param string  $label     Label.
    51      * @param boolean $protected If protected.
     51     * @param boolean $is_protected If protected.
    5252     */
    53     public function __construct( $slug = null, $interval = 0, $label = null, $protected = false ) {
     53    public function __construct( $slug = null, $interval = 0, $label = null, $is_protected = false ) {
    5454
    5555        if ( empty( $label ) ) {
     
    6060        $this->interval  = $interval;
    6161        $this->label     = $label;
    62         $this->protected = $protected;
    63 
     62        $this->protected = $is_protected;
    6463    }
    6564
     
    103102
    104103        return $interval;
    105 
    106104    }
    107105
     
    138136
    139137        return trim( $human_time );
    140 
    141138    }
    142139
     
    150147        return esc_attr( wp_create_nonce( 'acm/schedule/' . $action . '/' . $this->slug ) );
    151148    }
    152 
    153149}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/Events.php

    r3096140 r3356826  
    106106
    107107        return $this->events;
    108 
    109108    }
    110109
     
    119118        $events = $this->get_events();
    120119        return isset( $events[ $hash ] ) ? $events[ $hash ] : false;
    121 
    122120    }
    123121
     
    157155
    158156        return ( $e1->next_call < $e2->next_call ) ? -1 : 1;
    159 
    160157    }
    161 
    162158}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/EventsActions.php

    r3096145 r3356826  
    5858        $this->library   = $library;
    5959        $this->schedules = $schedules;
    60 
    6160    }
    6261
     
    9594        }
    9695
    97         $hook = trim( wp_strip_all_tags( $data['hook'] ) );
     96        $hook = sanitize_text_field( trim( $data['hook'] ) );
     97
     98        if ( empty( $hook ) ) {
     99            $this->ajax->response( false, array(
     100                __( 'Hook name is required.', 'advanced-cron-manager' ),
     101            ) );
     102        }
    98103
    99104        $result = $this->library->insert( $hook, $execution, $data['schedule'], $args );
     
    116121
    117122        $this->ajax->response( $success, $errors );
    118 
    119123    }
    120124
     
    128132        global $acm_current_event;
    129133
    130         // phpcs:ignore
    131         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     134        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     135        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
    132136
    133137        if ( ! $event ) {
     
    157161
    158162        $this->ajax->response( $success, array() );
    159 
    160163    }
    161164
     
    167170    public function remove() {
    168171
    169         // phpcs:ignore
    170         $event  = $this->events->get_event_by_hash( $_REQUEST['event'] );
     172        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     173        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
    171174
    172175        if ( false === $event ) {
     
    175178            ) );
    176179        }
    177 
    178         $errors = array();
    179180
    180181        $this->ajax->verify_nonce( 'acm/event/remove/' . $event->hash );
     
    198199
    199200        $this->ajax->response( $success, $errors );
    200 
    201201    }
    202202
     
    208208    public function pause() {
    209209
    210         // phpcs:ignore
    211         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     210        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     211        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
     212
     213        if ( ! $event ) {
     214            $this->ajax->response( false, array(
     215                __( 'This event doesn\'t seem to exist anymore', 'advanced-cron-manager' ),
     216            ) );
     217        }
    212218
    213219        $this->ajax->verify_nonce( 'acm/event/pause/' . $event->hash );
     
    231237
    232238        $this->ajax->response( $success, $errors );
    233 
    234239    }
    235240
     
    241246    public function unpause() {
    242247
    243         // phpcs:ignore
    244         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     248        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     249        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
     250
     251        if ( ! $event ) {
     252            $this->ajax->response( false, array(
     253                __( 'This event doesn\'t seem to exist anymore', 'advanced-cron-manager' ),
     254            ) );
     255        }
    245256
    246257        $this->ajax->verify_nonce( 'acm/event/unpause/' . $event->hash );
     
    264275
    265276        $this->ajax->response( $success, $errors );
    266 
    267     }
    268 
     277    }
    269278}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/EventsLibrary.php

    r3096140 r3356826  
    4949
    5050        $this->paused_option_name = 'acm_paused_events';
    51 
    5251    }
    5352
     
    6766
    6867        return $events;
    69 
    7068    }
    7169
     
    7775     * @param  string  $schedule_slug       Schedule slug.
    7876     * @param  array   $args                arguments.
    79      * @param  boolean $new                 if event is new.
     77     * @param  boolean $new_event           if event is new.
    8078     * @return mixed                        array with errors on error or true
    8179     */
    82     public function insert( $hook, $execution_timestamp, $schedule_slug, $args, $new = true ) {
     80    public function insert( $hook, $execution_timestamp, $schedule_slug, $args, $new_event = true ) {
    8381
    8482        $errors = array();
     
    105103        }
    106104
    107         if ( $new ) {
     105        if ( $new_event ) {
    108106            do_action( 'advanced-cron-manager/event/scheduled', $hook, $execution_timestamp, $schedule, $args );
    109107        }
    110108
    111109        return true;
    112 
    113110    }
    114111
     
    142139
    143140        return true;
    144 
    145141    }
    146142
     
    180176
    181177        return true;
    182 
    183178    }
    184179
     
    214209
    215210        return $result;
    216 
    217211    }
    218212
     
    235229
    236230        update_option( $this->paused_option_name, $paused_events );
    237 
    238231    }
    239232
     
    253246
    254247        }
    255 
    256     }
    257 
     248    }
    258249}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/Schedules.php

    r3096140 r3356826  
    4343
    4444        $this->library = $library;
    45 
    4645    }
    4746
     
    7776
    7877        return apply_filters( 'advanced-cron-manager/schedules', $this->schedules );
    79 
    8078    }
    8179
     
    10098
    10199        return isset( $schedules[ $slug ] ) ? $schedules[ $slug ] : $this->get_single_event_schedule();
    102 
    103100    }
    104101
     
    115112
    116113        return $this->single_event_schedule;
    117 
    118114    }
    119 
    120115}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/SchedulesActions.php

    r3096140 r3356826  
    6363        $slug = str_replace( '-', '_', $slug );
    6464
    65         $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $data['interval'] );
     65        // Validate interval - must be between 60 seconds and 1 year.
     66        $interval = absint( $data['interval'] );
     67        if ( $interval < 60 || $interval > YEAR_IN_SECONDS ) {
     68            $this->ajax->response( false, array(
     69                __( 'Interval must be between 60 seconds and 1 year.', 'advanced-cron-manager' ),
     70            ) );
     71        }
     72
     73        $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $interval );
    6674
    6775        if ( is_array( $result ) ) {
     
    7583
    7684        $this->ajax->response( $success, $errors );
    77 
    7885    }
    7986
     
    99106        $slug = str_replace( '-', '_', $slug );
    100107
    101         $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $data['interval'], true );
     108        // Validate interval - must be between 60 seconds and 1 year.
     109        $interval = absint( $data['interval'] );
     110        if ( $interval < 60 || $interval > YEAR_IN_SECONDS ) {
     111            $this->ajax->response( false, array(
     112                __( 'Interval must be between 60 seconds and 1 year.', 'advanced-cron-manager' ),
     113            ) );
     114        }
     115
     116        $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $interval, true );
    102117
    103118        if ( is_array( $result ) ) {
     
    111126
    112127        $this->ajax->response( $success, $errors );
    113 
    114128    }
    115129
     
    121135    public function remove() {
    122136
    123         // phpcs:ignore
    124         $schedule_slug = $_REQUEST['schedule'];
     137        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need schedule slug for nonce string.
     138        $schedule_slug = sanitize_key( isset( $_REQUEST['schedule'] ) ? $_REQUEST['schedule'] : '' );
     139
     140        if ( empty( $schedule_slug ) ) {
     141            $this->ajax->response( false, array(
     142                __( 'Invalid schedule slug.', 'advanced-cron-manager' ),
     143            ) );
     144        }
    125145
    126146        $this->ajax->verify_nonce( 'acm/schedule/remove/' . $schedule_slug );
     
    144164
    145165        $this->ajax->response( $success, $errors );
    146 
    147166    }
    148 
    149167}
  • advanced-cron-manager/tags/2.6.4/inc/Cron/SchedulesLibrary.php

    r3096140 r3356826  
    4747        $this->ajax        = $ajax;
    4848        $this->option_name = 'acm_schedules';
    49 
    5049    }
    5150
     
    7170
    7271        return $this->schedules;
    73 
    7472    }
    7573
     
    8987
    9088        return isset( $schedules[ $slug ] ) ? $schedules[ $slug ] : false;
    91 
    9289    }
    9390
     
    123120
    124121        return $schedules;
    125 
    126122    }
    127123
     
    186182
    187183        return true;
    188 
    189184    }
    190185
     
    216211
    217212        return true;
    218 
    219     }
    220 
     213    }
    221214}
  • advanced-cron-manager/tags/2.6.4/inc/FormProvider.php

    r3096140 r3356826  
    8585
    8686        $this->ajax->response( $form_html );
    87 
    8887    }
    8988
     
    9695
    9796        $this->get_form( 'schedule/add', __( 'New schedule', 'advanced-cron-manager' ), __( 'Add schedule', 'advanced-cron-manager' ) );
    98 
    9997    }
    10098
     
    104102    public function edit_schedule() {
    105103
    106         // phpcs:ignore
    107         $schedule_slug = $_REQUEST['schedule'];
     104        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need schedule slug for nonce string.
     105        $schedule_slug = sanitize_key( isset( $_REQUEST['schedule'] ) ? $_REQUEST['schedule'] : '' );
     106
     107        if ( empty( $schedule_slug ) ) {
     108            $this->ajax->response( false, array(
     109                __( 'Invalid schedule slug.', 'advanced-cron-manager' ),
     110            ) );
     111        }
    108112
    109113        $this->ajax->verify_nonce( 'acm/schedule/edit/' . $schedule_slug );
     
    115119        // Translators: schedule slug.
    116120        $this->get_form( 'schedule/edit', sprintf( __( 'Edit "%s" schedule', 'advanced-cron-manager' ), $schedule->slug ), __( 'Edit schedule', 'advanced-cron-manager' ) );
    117 
    118121    }
    119122
     
    129132
    130133        $this->get_form( 'event/add', __( 'New event', 'advanced-cron-manager' ), __( 'Schedule event', 'advanced-cron-manager' ) );
    131 
    132134    }
    133 
    134135}
  • advanced-cron-manager/tags/2.6.4/inc/Misc.php

    r3096140 r3356826  
    5050        return $links;
    5151    }
    52 
    5352}
  • advanced-cron-manager/tags/2.6.4/inc/Server/Processor.php

    r3096140 r3356826  
    4949
    5050        }
    51 
    5251    }
    53 
    5452}
  • advanced-cron-manager/tags/2.6.4/inc/Server/Settings.php

    r3353338 r3356826  
    9393
    9494        return $this->settings;
    95 
    9695    }
    9796
     
    115114        $this->ajax->verify_nonce( 'acm/server/settings/save' );
    116115
     116        if ( ! current_user_can( 'manage_options' ) ) {
     117            $this->ajax->response( false, array(
     118                __( "You're not allowed to do that.", 'advanced-cron-manager' ),
     119            ) );
     120        }
     121
    117122        $errors = array();
    118123
    119         $form_options = array_map( function( $val ) {
     124        $form_options = array_map( function () {
    120125            return 0;
    121126        }, $this->default );
     
    124129        $form_data = wp_parse_args( $_REQUEST['data'], $form_options );
    125130
    126         update_option( $this->option_name, $form_data );
     131        // Validate and sanitize settings.
     132        $sanitized_data = array();
     133        foreach ( $form_data as $key => $value ) {
     134            if ( ! array_key_exists( $key, $this->default ) ) {
     135                continue; // Skip unknown settings.
     136            }
     137
     138            // All current settings are boolean (0 or 1).
     139            $sanitized_data[ $key ] = absint( $value ) === 1 ? 1 : 0;
     140        }
     141
     142        update_option( $this->option_name, $sanitized_data );
    127143
    128144        $this->ajax->response( __( 'Settings has been saved', 'advanced-cron-manager' ), $errors );
    129 
    130145    }
    131 
    132146}
  • advanced-cron-manager/tags/2.6.4/readme.txt

    r3353664 r3356826  
    55Requires PHP: 5.3
    66Tested up to: 6.8
    7 Stable tag: 2.6.3
     7Stable tag: 2.6.4
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    102102== Changelog ==
    103103
     104= 2.6.4 =
     105* [Security] Improved event hook sanitization using sanitize_text_field() to prevent XSS while allowing valid hook characters
     106* [Security] Added validation for schedule intervals to prevent invalid values
     107* [Security] Strengthened authorization checks in admin screen methods
     108* [Security] Enhanced output escaping in event row view template
     109* [Security] Standardized nonce verification in AJAX handlers with better input validation
     110* [Security] Added proper validation and sanitization for server settings
     111* [Security] Fixed unsanitized input in FormProvider.php schedule slug handling
     112* [Fixed] Fixed PHP 8.4 deprecation warning with trigger_error() by replacing with exception
     113* [Fixed] Fixed TypeError on PHP 8.3+ where count() was called on non-countable value in Event implementation
     114* [Changed] Updated WordPress Coding Standards to version 3.2 and resolved all coding standard warnings
     115* [Changed] Renamed reserved keyword parameters for better PHP compatibility ($protected to $is_protected, $new to $new_event)
     116
    104117= 2.6.3 =
    105118* [Fixed] Fixed translation loading issue that was triggered too early in AdminScreen constructor.
  • advanced-cron-manager/tags/2.6.4/uninstall.php

    r3096140 r3356826  
    1616
    1717$plugin_version = 'x';
    18 $plugin_file    = dirname( __FILE__ ) . '/advanced-cron-manager.php';
     18$plugin_file    = __DIR__ . '/advanced-cron-manager.php';
    1919
    2020/**
     
    2727 */
    2828
    29 $ajax = function() {
     29$ajax = function () {
    3030    return new underDEV\Utils\Ajax();
    3131};
     
    3333$schedules_library = new underDEV\AdvancedCronManager\Cron\SchedulesLibrary( $ajax() );
    3434
    35 $schedules = function() use ( $schedules_library ) {
     35$schedules = function () use ( $schedules_library ) {
    3636    return new underDEV\AdvancedCronManager\Cron\Schedules( $schedules_library );
    3737};
    3838
    39 $events = function() use ( $schedules ) {
     39$events = function () use ( $schedules ) {
    4040    return new underDEV\AdvancedCronManager\Cron\Events( $schedules() );
    4141};
  • advanced-cron-manager/tags/2.6.4/vendor/autoload.php

    r3353359 r3356826  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24::getLoader();
     22return ComposerAutoloaderInit7dbce783dc983385ac7421112661002f::getLoader();
  • advanced-cron-manager/tags/2.6.4/vendor/composer/autoload_real.php

    r3353359 r3356826  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24
     5class ComposerAutoloaderInit7dbce783dc983385ac7421112661002f
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit7dbce783dc983385ac7421112661002f', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit7dbce783dc983385ac7421112661002f', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit7dbce783dc983385ac7421112661002f::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • advanced-cron-manager/tags/2.6.4/vendor/composer/autoload_static.php

    r3353664 r3356826  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit8163cfec9d18b389656cb27b7a241f24
     7class ComposerStaticInit7dbce783dc983385ac7421112661002f
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    5858    {
    5959        return \Closure::bind(function () use ($loader) {
    60             $loader->prefixLengthsPsr4 = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$prefixLengthsPsr4;
    61             $loader->prefixDirsPsr4 = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$prefixDirsPsr4;
    62             $loader->classMap = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$classMap;
     60            $loader->prefixLengthsPsr4 = ComposerStaticInit7dbce783dc983385ac7421112661002f::$prefixLengthsPsr4;
     61            $loader->prefixDirsPsr4 = ComposerStaticInit7dbce783dc983385ac7421112661002f::$prefixDirsPsr4;
     62            $loader->classMap = ComposerStaticInit7dbce783dc983385ac7421112661002f::$classMap;
    6363
    6464        }, null, ClassLoader::class);
  • advanced-cron-manager/tags/2.6.4/vendor/composer/installed.php

    r3353664 r3356826  
    22    'root' => array(
    33        'name' => 'bracketspace/advanced-cron-manager',
    4         'pretty_version' => '2.6.3',
    5         'version' => '2.6.3.0',
    6         'reference' => '44774c0dbb40cee8548e9b848a4958e4e23c7feb',
     4        'pretty_version' => '2.6.4',
     5        'version' => '2.6.4.0',
     6        'reference' => '5c0943b645e4ed15acc71496bc9ace1d363250c2',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'bracketspace/advanced-cron-manager' => array(
    14             'pretty_version' => '2.6.3',
    15             'version' => '2.6.3.0',
    16             'reference' => '44774c0dbb40cee8548e9b848a4958e4e23c7feb',
     14            'pretty_version' => '2.6.4',
     15            'version' => '2.6.4.0',
     16            'reference' => '5c0943b645e4ed15acc71496bc9ace1d363250c2',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • advanced-cron-manager/tags/2.6.4/views/parts/events/row.php

    r3096140 r3356826  
    9797                <br>
    9898                <span title="<?php echo esc_attr( 'UTC: ' . date_i18n( $date_format . ' ' . $time_format, $event->next_call ) ); ?>">
    99                     <?php echo date_i18n( $date_format . ' ' . $time_format, $event->next_call + $time_offset ); // phpcs:ignore ?>
     99                    <?php echo esc_html( date_i18n( $date_format . ' ' . $time_format, $event->next_call + $time_offset ) ); ?>
    100100                </span>
    101101            <?php endif ?>
  • advanced-cron-manager/trunk/advanced-cron-manager.php

    r3353664 r3356826  
    33 * Plugin Name: Advanced Cron Manager
    44 * Description: View, pause, remove, edit and add WP Cron events.
    5  * Version: 2.6.3
     5 * Version: 2.6.4
    66 * Author: BracketSpace
    77 * Author URI: https://bracketspace.com
     
    1212 */
    1313
    14 $plugin_version = '2.6.3';
     14$plugin_version = '2.6.4';
    1515$plugin_file    = __FILE__;
    1616
     
    6060        }
    6161    }
    62 
    6362}
    6463
     
    8079$files = new underDEV\Utils\Files( $plugin_file );
    8180
    82 $view = function() use ( $files ) {
     81$view = function () use ( $files ) {
    8382    return new underDEV\Utils\View( $files );
    8483};
    8584
    86 $ajax = function() {
     85$ajax = function () {
    8786    return new underDEV\Utils\Ajax();
    8887};
    8988
    90 $server_settings = function() use ( $view, $ajax ) {
     89$server_settings = function () use ( $view, $ajax ) {
    9190    return new underDEV\AdvancedCronManager\Server\Settings( $view(), $ajax() );
    9291};
    9392
    94 $misc = function() use ( $view ) {
     93$misc = function () use ( $view ) {
    9594    return new underDEV\AdvancedCronManager\Misc( $view() );
    9695};
    9796
    98 $server_processor = function() use ( $server_settings ) {
     97$server_processor = function () use ( $server_settings ) {
    9998    return new underDEV\AdvancedCronManager\Server\Processor( $server_settings() );
    10099};
     
    102101$schedules_library = new underDEV\AdvancedCronManager\Cron\SchedulesLibrary( $ajax() );
    103102
    104 $schedules = function() use ( $schedules_library ) {
     103$schedules = function () use ( $schedules_library ) {
    105104    return new underDEV\AdvancedCronManager\Cron\Schedules( $schedules_library );
    106105};
    107106
    108 $schedules_actions = function() use ( $ajax, $schedules_library ) {
     107$schedules_actions = function () use ( $ajax, $schedules_library ) {
    109108    return new underDEV\AdvancedCronManager\Cron\SchedulesActions( $ajax(), $schedules_library );
    110109};
    111110
    112 $events = function() use ( $schedules ) {
     111$events = function () use ( $schedules ) {
    113112    return new underDEV\AdvancedCronManager\Cron\Events( $schedules() );
    114113};
    115114
    116 $events_library = function() use ( $schedules, $events ) {
     115$events_library = function () use ( $schedules, $events ) {
    117116    return new underDEV\AdvancedCronManager\Cron\EventsLibrary( $schedules(), $events() );
    118117};
    119118
    120 $events_actions = function() use ( $ajax, $events, $events_library, $schedules ) {
     119$events_actions = function () use ( $ajax, $events, $events_library, $schedules ) {
    121120    return new underDEV\AdvancedCronManager\Cron\EventsActions( $ajax(), $events(), $events_library(), $schedules() );
    122121};
     
    184183
    185184// Notification promo.
    186 add_action( 'plugins_loaded', function() use ( $misc ) {
     185add_action( 'plugins_loaded', function () use ( $misc ) {
    187186    if ( ! function_exists( 'register_trigger' ) ) {
    188187        add_action( 'advanced-cron-manager/screen/sidebar', array( $misc(), 'load_notification_promo_part' ), 1000, 1 );
  • advanced-cron-manager/trunk/inc/AdminScreen.php

    r3353664 r3356826  
    7474        $this->schedules = $schedules;
    7575        $this->events    = $events;
    76 
    7776    }
    7877
     
    126125
    127126        }
    128 
    129127    }
    130128
     
    143141     * because we want to separate scopes
    144142     *
    145      * @param  object $view instance of parent view.
    146      * @return void
    147      */
    148     public function load_searchbox_part( $view ) {
     143     * @return void
     144     */
     145    public function load_searchbox_part() {
    149146        $this->view->get_view( 'parts/searchbox' );
    150147    }
     
    155152     * because we want to separate scopes
    156153     *
    157      * @param  object $view instance of parent view.
    158      * @return void
    159      */
    160     public function load_events_table_part( $view ) {
     154     * @return void
     155     */
     156    public function load_events_table_part() {
     157
     158        if ( ! current_user_can( 'manage_options' ) ) {
     159            return;
     160        }
    161161
    162162        $this->view->set_var( 'events', $this->events->get_events() );
     
    170170
    171171        $this->view->get_view( 'parts/events/section' );
    172 
    173172    }
    174173
     
    178177     * because we want to separate scopes
    179178     *
    180      * @param  object $view instance of parent view.
    181      * @return void
    182      */
    183     public function load_schedules_table_part( $view ) {
     179     * @return void
     180     */
     181    public function load_schedules_table_part() {
     182
     183        if ( ! current_user_can( 'manage_options' ) ) {
     184            return;
     185        }
    184186
    185187        $this->view->set_var( 'schedules', $this->schedules->get_schedules(), true );
    186188
    187189        $this->view->get_view( 'parts/schedules/section' );
    188 
    189190    }
    190191
     
    194195     * because we want to separate scopes
    195196     *
    196      * @param  object $view instance of parent view.
    197      * @return void
    198      */
    199     public function load_slidebar_part( $view ) {
     197     * @return void
     198     */
     199    public function load_slidebar_part() {
    200200        $this->view->get_view( 'elements/slidebar' );
    201201    }
     
    206206     * because we want to separate scopes
    207207     *
    208      * @param  object $view instance of parent view.
    209      * @return void
    210      */
    211     public function load_preview_modal_part( $view ) {
     208     * @return void
     209     */
     210    public function load_preview_modal_part() {
    212211        $this->view->get_view( 'elements/preview-modal' );
    213212    }
     
    227226
    228227        return $tabs;
    229 
    230228    }
    231229
     
    309307            array( $this, 'load_page_wrapper' )
    310308        );
    311 
    312309    }
    313310
     
    355352        }
    356353
    357         $args_length = array_sum( array_map( function( $ar ) {
     354        $args_length = array_sum( array_map( function ( $ar ) {
    358355            return strlen( $ar['msg'] );
    359356        }, $parsed_args ) );
     
    365362        );
    366363    }
    367 
    368364}
  • advanced-cron-manager/trunk/inc/Assets.php

    r3353664 r3356826  
    4949        $this->files          = $files;
    5050        $this->screen         = $screen;
    51 
    5251    }
    5352
     
    8786
    8887        do_action( 'advanced-cron-manager/screen/enqueue', $current_page_hook );
    89 
    9088    }
    91 
    9289}
  • advanced-cron-manager/trunk/inc/Cron/Element/Event.php

    r3096140 r3356826  
    7979     * @param array   $args      Arguments.
    8080     * @param integer $next_call Next call timestamp.
    81      * @param boolean $protected If protected.
     81     * @param boolean $is_protected If protected.
    8282     * @param boolean $paused    If paused.
     83     * @throws \InvalidArgumentException When hook is empty.
    8384     */
    84     public function __construct( $hook = null, $schedule = '', $interval = 0, $args = array(), $next_call = 0, $protected = false, $paused = false ) {
     85    public function __construct( $hook = null, $schedule = '', $interval = 0, $args = array(), $next_call = 0, $is_protected = false, $paused = false ) {
    8586
    8687        if ( empty( $hook ) ) {
    87             trigger_error( 'Hook cannot be empty', E_USER_ERROR );
     88            throw new \InvalidArgumentException( 'Hook cannot be empty' );
    8889        }
    8990
     
    9394        $this->args      = $args;
    9495        $this->next_call = $next_call;
    95         $this->protected = $protected;
     96        $this->protected = $is_protected;
    9697        $this->paused    = $paused;
    9798
    9899        // phpcs:ignore
    99100        $this->hash = substr( md5( $this->hook . $this->schedule . $this->next_call . serialize( $this->args ) ), 0, 8 );
    100 
    101101    }
    102102
     
    128128        $imp = '';
    129129
    130         $imp .= 'function ' . $function_name . '(' . $arguments . ') {<br>';
    131         $imp .= '&nbsp;&nbsp;&nbsp;&nbsp;// do stuff<br>';
    132         $imp .= '}<br>';
    133         $imp .= '<br>';
    134         $imp .= "add_action( '" . $this->hook . "',  '" . $function_name . "', 10, " . count( $this->args ) . ' );';
     130        $imp       .= 'function ' . $function_name . '(' . $arguments . ') {<br>';
     131        $imp       .= '&nbsp;&nbsp;&nbsp;&nbsp;// do stuff<br>';
     132        $imp       .= '}<br>';
     133        $imp       .= '<br>';
     134        $args_count = is_array( $this->args ) ? count( $this->args ) : 0;
     135        $imp       .= "add_action( '" . $this->hook . "',  '" . $function_name . "', 10, " . $args_count . ' );';
    135136
    136137        return $imp;
    137 
    138138    }
    139139
     
    147147        return esc_attr( wp_create_nonce( 'acm/event/' . $action . '/' . $this->hash ) );
    148148    }
    149 
    150149}
  • advanced-cron-manager/trunk/inc/Cron/Element/Schedule.php

    r3096140 r3356826  
    4949     * @param integer $interval  Interval.
    5050     * @param string  $label     Label.
    51      * @param boolean $protected If protected.
     51     * @param boolean $is_protected If protected.
    5252     */
    53     public function __construct( $slug = null, $interval = 0, $label = null, $protected = false ) {
     53    public function __construct( $slug = null, $interval = 0, $label = null, $is_protected = false ) {
    5454
    5555        if ( empty( $label ) ) {
     
    6060        $this->interval  = $interval;
    6161        $this->label     = $label;
    62         $this->protected = $protected;
    63 
     62        $this->protected = $is_protected;
    6463    }
    6564
     
    103102
    104103        return $interval;
    105 
    106104    }
    107105
     
    138136
    139137        return trim( $human_time );
    140 
    141138    }
    142139
     
    150147        return esc_attr( wp_create_nonce( 'acm/schedule/' . $action . '/' . $this->slug ) );
    151148    }
    152 
    153149}
  • advanced-cron-manager/trunk/inc/Cron/Events.php

    r3096140 r3356826  
    106106
    107107        return $this->events;
    108 
    109108    }
    110109
     
    119118        $events = $this->get_events();
    120119        return isset( $events[ $hash ] ) ? $events[ $hash ] : false;
    121 
    122120    }
    123121
     
    157155
    158156        return ( $e1->next_call < $e2->next_call ) ? -1 : 1;
    159 
    160157    }
    161 
    162158}
  • advanced-cron-manager/trunk/inc/Cron/EventsActions.php

    r3096145 r3356826  
    5858        $this->library   = $library;
    5959        $this->schedules = $schedules;
    60 
    6160    }
    6261
     
    9594        }
    9695
    97         $hook = trim( wp_strip_all_tags( $data['hook'] ) );
     96        $hook = sanitize_text_field( trim( $data['hook'] ) );
     97
     98        if ( empty( $hook ) ) {
     99            $this->ajax->response( false, array(
     100                __( 'Hook name is required.', 'advanced-cron-manager' ),
     101            ) );
     102        }
    98103
    99104        $result = $this->library->insert( $hook, $execution, $data['schedule'], $args );
     
    116121
    117122        $this->ajax->response( $success, $errors );
    118 
    119123    }
    120124
     
    128132        global $acm_current_event;
    129133
    130         // phpcs:ignore
    131         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     134        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     135        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
    132136
    133137        if ( ! $event ) {
     
    157161
    158162        $this->ajax->response( $success, array() );
    159 
    160163    }
    161164
     
    167170    public function remove() {
    168171
    169         // phpcs:ignore
    170         $event  = $this->events->get_event_by_hash( $_REQUEST['event'] );
     172        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     173        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
    171174
    172175        if ( false === $event ) {
     
    175178            ) );
    176179        }
    177 
    178         $errors = array();
    179180
    180181        $this->ajax->verify_nonce( 'acm/event/remove/' . $event->hash );
     
    198199
    199200        $this->ajax->response( $success, $errors );
    200 
    201201    }
    202202
     
    208208    public function pause() {
    209209
    210         // phpcs:ignore
    211         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     210        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     211        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
     212
     213        if ( ! $event ) {
     214            $this->ajax->response( false, array(
     215                __( 'This event doesn\'t seem to exist anymore', 'advanced-cron-manager' ),
     216            ) );
     217        }
    212218
    213219        $this->ajax->verify_nonce( 'acm/event/pause/' . $event->hash );
     
    231237
    232238        $this->ajax->response( $success, $errors );
    233 
    234239    }
    235240
     
    241246    public function unpause() {
    242247
    243         // phpcs:ignore
    244         $event = $this->events->get_event_by_hash( $_REQUEST['event'] );
     248        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need event hash for nonce string.
     249        $event = $this->events->get_event_by_hash( sanitize_text_field( wp_unslash( isset( $_REQUEST['event'] ) ? $_REQUEST['event'] : '' ) ) );
     250
     251        if ( ! $event ) {
     252            $this->ajax->response( false, array(
     253                __( 'This event doesn\'t seem to exist anymore', 'advanced-cron-manager' ),
     254            ) );
     255        }
    245256
    246257        $this->ajax->verify_nonce( 'acm/event/unpause/' . $event->hash );
     
    264275
    265276        $this->ajax->response( $success, $errors );
    266 
    267     }
    268 
     277    }
    269278}
  • advanced-cron-manager/trunk/inc/Cron/EventsLibrary.php

    r3096140 r3356826  
    4949
    5050        $this->paused_option_name = 'acm_paused_events';
    51 
    5251    }
    5352
     
    6766
    6867        return $events;
    69 
    7068    }
    7169
     
    7775     * @param  string  $schedule_slug       Schedule slug.
    7876     * @param  array   $args                arguments.
    79      * @param  boolean $new                 if event is new.
     77     * @param  boolean $new_event           if event is new.
    8078     * @return mixed                        array with errors on error or true
    8179     */
    82     public function insert( $hook, $execution_timestamp, $schedule_slug, $args, $new = true ) {
     80    public function insert( $hook, $execution_timestamp, $schedule_slug, $args, $new_event = true ) {
    8381
    8482        $errors = array();
     
    105103        }
    106104
    107         if ( $new ) {
     105        if ( $new_event ) {
    108106            do_action( 'advanced-cron-manager/event/scheduled', $hook, $execution_timestamp, $schedule, $args );
    109107        }
    110108
    111109        return true;
    112 
    113110    }
    114111
     
    142139
    143140        return true;
    144 
    145141    }
    146142
     
    180176
    181177        return true;
    182 
    183178    }
    184179
     
    214209
    215210        return $result;
    216 
    217211    }
    218212
     
    235229
    236230        update_option( $this->paused_option_name, $paused_events );
    237 
    238231    }
    239232
     
    253246
    254247        }
    255 
    256     }
    257 
     248    }
    258249}
  • advanced-cron-manager/trunk/inc/Cron/Schedules.php

    r3096140 r3356826  
    4343
    4444        $this->library = $library;
    45 
    4645    }
    4746
     
    7776
    7877        return apply_filters( 'advanced-cron-manager/schedules', $this->schedules );
    79 
    8078    }
    8179
     
    10098
    10199        return isset( $schedules[ $slug ] ) ? $schedules[ $slug ] : $this->get_single_event_schedule();
    102 
    103100    }
    104101
     
    115112
    116113        return $this->single_event_schedule;
    117 
    118114    }
    119 
    120115}
  • advanced-cron-manager/trunk/inc/Cron/SchedulesActions.php

    r3096140 r3356826  
    6363        $slug = str_replace( '-', '_', $slug );
    6464
    65         $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $data['interval'] );
     65        // Validate interval - must be between 60 seconds and 1 year.
     66        $interval = absint( $data['interval'] );
     67        if ( $interval < 60 || $interval > YEAR_IN_SECONDS ) {
     68            $this->ajax->response( false, array(
     69                __( 'Interval must be between 60 seconds and 1 year.', 'advanced-cron-manager' ),
     70            ) );
     71        }
     72
     73        $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $interval );
    6674
    6775        if ( is_array( $result ) ) {
     
    7583
    7684        $this->ajax->response( $success, $errors );
    77 
    7885    }
    7986
     
    99106        $slug = str_replace( '-', '_', $slug );
    100107
    101         $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $data['interval'], true );
     108        // Validate interval - must be between 60 seconds and 1 year.
     109        $interval = absint( $data['interval'] );
     110        if ( $interval < 60 || $interval > YEAR_IN_SECONDS ) {
     111            $this->ajax->response( false, array(
     112                __( 'Interval must be between 60 seconds and 1 year.', 'advanced-cron-manager' ),
     113            ) );
     114        }
     115
     116        $result = $this->library->insert( $slug, sanitize_text_field( $data['name'] ), $interval, true );
    102117
    103118        if ( is_array( $result ) ) {
     
    111126
    112127        $this->ajax->response( $success, $errors );
    113 
    114128    }
    115129
     
    121135    public function remove() {
    122136
    123         // phpcs:ignore
    124         $schedule_slug = $_REQUEST['schedule'];
     137        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need schedule slug for nonce string.
     138        $schedule_slug = sanitize_key( isset( $_REQUEST['schedule'] ) ? $_REQUEST['schedule'] : '' );
     139
     140        if ( empty( $schedule_slug ) ) {
     141            $this->ajax->response( false, array(
     142                __( 'Invalid schedule slug.', 'advanced-cron-manager' ),
     143            ) );
     144        }
    125145
    126146        $this->ajax->verify_nonce( 'acm/schedule/remove/' . $schedule_slug );
     
    144164
    145165        $this->ajax->response( $success, $errors );
    146 
    147166    }
    148 
    149167}
  • advanced-cron-manager/trunk/inc/Cron/SchedulesLibrary.php

    r3096140 r3356826  
    4747        $this->ajax        = $ajax;
    4848        $this->option_name = 'acm_schedules';
    49 
    5049    }
    5150
     
    7170
    7271        return $this->schedules;
    73 
    7472    }
    7573
     
    8987
    9088        return isset( $schedules[ $slug ] ) ? $schedules[ $slug ] : false;
    91 
    9289    }
    9390
     
    123120
    124121        return $schedules;
    125 
    126122    }
    127123
     
    186182
    187183        return true;
    188 
    189184    }
    190185
     
    216211
    217212        return true;
    218 
    219     }
    220 
     213    }
    221214}
  • advanced-cron-manager/trunk/inc/FormProvider.php

    r3096140 r3356826  
    8585
    8686        $this->ajax->response( $form_html );
    87 
    8887    }
    8988
     
    9695
    9796        $this->get_form( 'schedule/add', __( 'New schedule', 'advanced-cron-manager' ), __( 'Add schedule', 'advanced-cron-manager' ) );
    98 
    9997    }
    10098
     
    104102    public function edit_schedule() {
    105103
    106         // phpcs:ignore
    107         $schedule_slug = $_REQUEST['schedule'];
     104        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Need schedule slug for nonce string.
     105        $schedule_slug = sanitize_key( isset( $_REQUEST['schedule'] ) ? $_REQUEST['schedule'] : '' );
     106
     107        if ( empty( $schedule_slug ) ) {
     108            $this->ajax->response( false, array(
     109                __( 'Invalid schedule slug.', 'advanced-cron-manager' ),
     110            ) );
     111        }
    108112
    109113        $this->ajax->verify_nonce( 'acm/schedule/edit/' . $schedule_slug );
     
    115119        // Translators: schedule slug.
    116120        $this->get_form( 'schedule/edit', sprintf( __( 'Edit "%s" schedule', 'advanced-cron-manager' ), $schedule->slug ), __( 'Edit schedule', 'advanced-cron-manager' ) );
    117 
    118121    }
    119122
     
    129132
    130133        $this->get_form( 'event/add', __( 'New event', 'advanced-cron-manager' ), __( 'Schedule event', 'advanced-cron-manager' ) );
    131 
    132134    }
    133 
    134135}
  • advanced-cron-manager/trunk/inc/Misc.php

    r3096140 r3356826  
    5050        return $links;
    5151    }
    52 
    5352}
  • advanced-cron-manager/trunk/inc/Server/Processor.php

    r3096140 r3356826  
    4949
    5050        }
    51 
    5251    }
    53 
    5452}
  • advanced-cron-manager/trunk/inc/Server/Settings.php

    r3353338 r3356826  
    9393
    9494        return $this->settings;
    95 
    9695    }
    9796
     
    115114        $this->ajax->verify_nonce( 'acm/server/settings/save' );
    116115
     116        if ( ! current_user_can( 'manage_options' ) ) {
     117            $this->ajax->response( false, array(
     118                __( "You're not allowed to do that.", 'advanced-cron-manager' ),
     119            ) );
     120        }
     121
    117122        $errors = array();
    118123
    119         $form_options = array_map( function( $val ) {
     124        $form_options = array_map( function () {
    120125            return 0;
    121126        }, $this->default );
     
    124129        $form_data = wp_parse_args( $_REQUEST['data'], $form_options );
    125130
    126         update_option( $this->option_name, $form_data );
     131        // Validate and sanitize settings.
     132        $sanitized_data = array();
     133        foreach ( $form_data as $key => $value ) {
     134            if ( ! array_key_exists( $key, $this->default ) ) {
     135                continue; // Skip unknown settings.
     136            }
     137
     138            // All current settings are boolean (0 or 1).
     139            $sanitized_data[ $key ] = absint( $value ) === 1 ? 1 : 0;
     140        }
     141
     142        update_option( $this->option_name, $sanitized_data );
    127143
    128144        $this->ajax->response( __( 'Settings has been saved', 'advanced-cron-manager' ), $errors );
    129 
    130145    }
    131 
    132146}
  • advanced-cron-manager/trunk/readme.txt

    r3353664 r3356826  
    55Requires PHP: 5.3
    66Tested up to: 6.8
    7 Stable tag: 2.6.3
     7Stable tag: 2.6.4
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    102102== Changelog ==
    103103
     104= 2.6.4 =
     105* [Security] Improved event hook sanitization using sanitize_text_field() to prevent XSS while allowing valid hook characters
     106* [Security] Added validation for schedule intervals to prevent invalid values
     107* [Security] Strengthened authorization checks in admin screen methods
     108* [Security] Enhanced output escaping in event row view template
     109* [Security] Standardized nonce verification in AJAX handlers with better input validation
     110* [Security] Added proper validation and sanitization for server settings
     111* [Security] Fixed unsanitized input in FormProvider.php schedule slug handling
     112* [Fixed] Fixed PHP 8.4 deprecation warning with trigger_error() by replacing with exception
     113* [Fixed] Fixed TypeError on PHP 8.3+ where count() was called on non-countable value in Event implementation
     114* [Changed] Updated WordPress Coding Standards to version 3.2 and resolved all coding standard warnings
     115* [Changed] Renamed reserved keyword parameters for better PHP compatibility ($protected to $is_protected, $new to $new_event)
     116
    104117= 2.6.3 =
    105118* [Fixed] Fixed translation loading issue that was triggered too early in AdminScreen constructor.
  • advanced-cron-manager/trunk/uninstall.php

    r3096140 r3356826  
    1616
    1717$plugin_version = 'x';
    18 $plugin_file    = dirname( __FILE__ ) . '/advanced-cron-manager.php';
     18$plugin_file    = __DIR__ . '/advanced-cron-manager.php';
    1919
    2020/**
     
    2727 */
    2828
    29 $ajax = function() {
     29$ajax = function () {
    3030    return new underDEV\Utils\Ajax();
    3131};
     
    3333$schedules_library = new underDEV\AdvancedCronManager\Cron\SchedulesLibrary( $ajax() );
    3434
    35 $schedules = function() use ( $schedules_library ) {
     35$schedules = function () use ( $schedules_library ) {
    3636    return new underDEV\AdvancedCronManager\Cron\Schedules( $schedules_library );
    3737};
    3838
    39 $events = function() use ( $schedules ) {
     39$events = function () use ( $schedules ) {
    4040    return new underDEV\AdvancedCronManager\Cron\Events( $schedules() );
    4141};
  • advanced-cron-manager/trunk/vendor/autoload.php

    r3353359 r3356826  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24::getLoader();
     22return ComposerAutoloaderInit7dbce783dc983385ac7421112661002f::getLoader();
  • advanced-cron-manager/trunk/vendor/composer/autoload_real.php

    r3353359 r3356826  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24
     5class ComposerAutoloaderInit7dbce783dc983385ac7421112661002f
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit7dbce783dc983385ac7421112661002f', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit8163cfec9d18b389656cb27b7a241f24', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit7dbce783dc983385ac7421112661002f', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit7dbce783dc983385ac7421112661002f::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • advanced-cron-manager/trunk/vendor/composer/autoload_static.php

    r3353664 r3356826  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit8163cfec9d18b389656cb27b7a241f24
     7class ComposerStaticInit7dbce783dc983385ac7421112661002f
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    5858    {
    5959        return \Closure::bind(function () use ($loader) {
    60             $loader->prefixLengthsPsr4 = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$prefixLengthsPsr4;
    61             $loader->prefixDirsPsr4 = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$prefixDirsPsr4;
    62             $loader->classMap = ComposerStaticInit8163cfec9d18b389656cb27b7a241f24::$classMap;
     60            $loader->prefixLengthsPsr4 = ComposerStaticInit7dbce783dc983385ac7421112661002f::$prefixLengthsPsr4;
     61            $loader->prefixDirsPsr4 = ComposerStaticInit7dbce783dc983385ac7421112661002f::$prefixDirsPsr4;
     62            $loader->classMap = ComposerStaticInit7dbce783dc983385ac7421112661002f::$classMap;
    6363
    6464        }, null, ClassLoader::class);
  • advanced-cron-manager/trunk/vendor/composer/installed.php

    r3353664 r3356826  
    22    'root' => array(
    33        'name' => 'bracketspace/advanced-cron-manager',
    4         'pretty_version' => '2.6.3',
    5         'version' => '2.6.3.0',
    6         'reference' => '44774c0dbb40cee8548e9b848a4958e4e23c7feb',
     4        'pretty_version' => '2.6.4',
     5        'version' => '2.6.4.0',
     6        'reference' => '5c0943b645e4ed15acc71496bc9ace1d363250c2',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'bracketspace/advanced-cron-manager' => array(
    14             'pretty_version' => '2.6.3',
    15             'version' => '2.6.3.0',
    16             'reference' => '44774c0dbb40cee8548e9b848a4958e4e23c7feb',
     14            'pretty_version' => '2.6.4',
     15            'version' => '2.6.4.0',
     16            'reference' => '5c0943b645e4ed15acc71496bc9ace1d363250c2',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • advanced-cron-manager/trunk/views/parts/events/row.php

    r3096140 r3356826  
    9797                <br>
    9898                <span title="<?php echo esc_attr( 'UTC: ' . date_i18n( $date_format . ' ' . $time_format, $event->next_call ) ); ?>">
    99                     <?php echo date_i18n( $date_format . ' ' . $time_format, $event->next_call + $time_offset ); // phpcs:ignore ?>
     99                    <?php echo esc_html( date_i18n( $date_format . ' ' . $time_format, $event->next_call + $time_offset ) ); ?>
    100100                </span>
    101101            <?php endif ?>
Note: See TracChangeset for help on using the changeset viewer.