protected function _set_hooks_properties()
 {
     $this->_name = 'pricing';
     //capability check
     if (!EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
         return;
     }
     EE_Registry::instance()->load_helper('DTT_Helper');
     //if we were going to add our own metaboxes we'd use the below.
     $this->_metaboxes = array(0 => array('page_route' => array('edit', 'create_new'), 'func' => 'pricing_metabox', 'label' => __('Event Tickets & Datetimes', 'event_espresso'), 'priority' => 'high', 'context' => 'normal'));
     /**/
     $this->_remove_metaboxes = array(0 => array('page_route' => array('edit', 'create_new'), 'id' => 'espresso_event_editor_tickets', 'context' => 'normal'));
     /**
      * Format strings for date and time.  Defaults are existing behaviour from 4.1.
      * Note, that if you return null as the value for 'date', and 'time' in the array, then
      * EE will automatically use the set wp_options, 'date_format', and 'time_format'.
      *
      * @since 4.6.7
      *
      * @var array  Expected an array returned with 'date' and 'time' keys.
      */
     $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array('date' => 'Y-m-d', 'time' => 'h:i a'));
     //validate
     $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
     $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
     //validate format strings
     $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
     if (is_array($format_validation)) {
         $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>';
         foreach ($format_validation as $error) {
             $msg .= '<li>' . $error . '</li>';
         }
         $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>';
         EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
         $this->_date_format_strings = array('date' => 'Y-m-d', 'time' => 'h:i a');
     }
     $this->_scripts_styles = array('registers' => array('ee-tickets-datetimes-css' => array('url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', 'type' => 'css'), 'ee-dtt-ticket-metabox' => array('url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore'))), 'deregisters' => array('event-editor-css' => array('type' => 'css'), 'event-datetime-metabox' => array('type' => 'js')), 'enqueues' => array('ee-tickets-datetimes-css' => array('edit', 'create_new'), 'ee-dtt-ticket-metabox' => array('edit', 'create_new')), 'localize' => array('ee-dtt-ticket-metabox' => array('DTT_TRASH_BLOCK' => array('main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'), 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'), 'DTT_ERROR_MSG' => array('no_ticket_name' => __('General Admission', 'event_espresso'), 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'), 'DTT_OVERSELL_WARNING' => array('datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')), 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')))));
     add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
     add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
 }
 /**
  *    check_for_invalid_datetime_formats
  *
  *    if an admin changes their date or time format settings on the WP General Settings admin page, verify that their selected format can be parsed by PHP
  *
  * @access    public
  * @param    $value
  * @param    $option
  * @throws EE_Error
  * @return    string
  */
 public function check_for_invalid_datetime_formats($value, $option)
 {
     EE_Registry::instance()->load_helper('DTT_Helper');
     // check for date_format or time_format
     switch ($option) {
         case 'date_format':
             $date_time_format = $value . ' ' . get_option('time_format');
             break;
         case 'time_format':
             $date_time_format = get_option('date_format') . ' ' . $value;
             break;
         default:
             $date_time_format = FALSE;
     }
     // do we have a date_time format to check ?
     if ($date_time_format) {
         $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
         if (is_array($error_msg)) {
             $msg = '<p>' . sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format) . '</p><p><ul>';
             foreach ($error_msg as $error) {
                 $msg .= '<li>' . $error . '</li>';
             }
             $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>';
             // trigger WP settings error
             add_settings_error('date_format', 'date_format', $msg);
             // set format to something valid
             switch ($option) {
                 case 'date_format':
                     $value = 'F j, Y';
                     break;
                 case 'time_format':
                     $value = 'g:i a';
                     break;
             }
         }
     }
     return $value;
 }