Exemplo n.º 1
0
 public static function process_general_form_submission()
 {
     if (!empty($_POST['tribe-import-general-settings']) && wp_verify_nonce($_POST['tribe-import-general-settings'], 'tribe-import-general-settings')) {
         $options = self::$options;
         if (has_filter('tribe-import-available-options')) {
             /**
              * Remove this Filter on 4.3
              * @deprecated
              */
             _doing_it_wrong('tribe-import-available-options', sprintf(esc_html__('This Filter has been deprecated, to comply with WordPress Standards we are now using Underscores (_) instead of Dashes (-). From: "%s" To: "%s"', 'the-events-calendar'), 'tribe-import-available-options', 'tribe_import_available_options'), '4.0');
             $options = apply_filters('tribe-import-available-options', $options);
         }
         $options = apply_filters('tribe_import_available_options', $options);
         foreach ($options as $_option) {
             $value = isset($_POST[$_option]) ? $_POST[$_option] : null;
             Tribe__Settings_Manager::set_option($_option, $value);
         }
         /**
          * Fires once import options have been saved/updated.
          *
          * @var array $options
          */
         do_action('tribe_import_options_updated', $options);
         add_action('tribe_import_under_heading', array(__CLASS__, 'settings_saved_message'));
     }
 }
Exemplo n.º 2
0
 /**
  * Conditionally set some default values for event related custom fields translation.
  *
  * @return bool `false` if defaults were already set, `true` otherwise.
  */
 public function set_defaults()
 {
     // make this check again has the action is triggered many times in a request lifecycle
     if ($this->has_set_defaults()) {
         return false;
     }
     $fields = $this->get_default_copy_fields();
     foreach ($fields as $field) {
         $this->sitepress->core_tm()->settings['custom_fields_translation'][$field] = WPML_COPY_CUSTOM_FIELD;
     }
     // remove the method to avoid infinite loops
     remove_action('icl_save_settings', array($this, 'set_defaults'));
     // the Translation Management plugin might not be active on this
     // installation, save this option only if Translation Management is active.
     $translation_management = $this->sitepress->core_tm();
     $tm_is_active = !empty($translation_management) && is_a($translation_management, 'TranslationManagement');
     if ($tm_is_active) {
         $translation_management->save_settings();
         Tribe__Settings_Manager::set_option($this->defaults_option_name, true);
         return true;
     }
     return false;
 }
 /**
  * Records the fact that we displayed the update message in relation to a specific
  * version of the plugin (so we don't show it again until/unless they update to
  * a higher version).
  */
 protected function log_display_of_message_page()
 {
     Tribe__Settings_Manager::set_option('last-update-message-' . $this->args['slug'], $this->args['version']);
 }
Exemplo n.º 4
0
 /**
  * Set an option
  *
  * @param string $name
  * @param mixed  $value
  *
  */
 public function setOption($name, $value)
 {
     _deprecated_function(__METHOD__, '4.0', 'Tribe__Settings_Manager::set_option');
     Tribe__Settings_Manager::set_option($name, $value);
 }
Exemplo n.º 5
0
 /**
  * Update Option
  *
  * Set specific key from options array, optionally provide a default return value
  *
  * @category Events
  * @param string $optionName Name of the option to retrieve.
  * @param string $value      Value to save
  *
  * @return void
  */
 function tribe_update_option($optionName, $value)
 {
     Tribe__Settings_Manager::set_option($optionName, $value);
 }
Exemplo n.º 6
0
 /**
  * Set the Event Tickets version in the options table if it's not already set.
  */
 public function maybe_set_et_version()
 {
     if (version_compare(Tribe__Settings_Manager::get_option('latest_event_tickets_version'), self::VERSION, '<')) {
         $previous_versions = Tribe__Settings_Manager::get_option('previous_event_tickets_versions') ? Tribe__Settings_Manager::get_option('previous_event_tickets_versions') : array();
         $previous_versions[] = Tribe__Settings_Manager::get_option('latest_event_tickets_version') ? Tribe__Settings_Manager::get_option('latest_event_tickets_version') : '0';
         Tribe__Settings_Manager::set_option('previous_event_tickets_versions', $previous_versions);
         Tribe__Settings_Manager::set_option('latest_event_tickets_version', self::VERSION);
     }
 }
 protected function log_display_of_message_page()
 {
     Tribe__Settings_Manager::set_option('last-update-message', Tribe__Events__Main::VERSION);
 }
Exemplo n.º 8
0
 public function update_version_option($new_version)
 {
     Tribe__Settings_Manager::set_option($this->version_option, $new_version);
 }