Exemplo n.º 1
0
 /**
  * Invalidates $mla_galleries and $galleries arrays and cached values after post, page or attachment updates
  *
  * @since 1.00
  *
  * @param	integer ID of post/page/attachment; not used at this time
  *
  * @return	void
  */
 public static function mla_save_post_action($post_id)
 {
     MLAQuery::mla_flush_mla_galleries(MLACore::MLA_GALLERY_IN_TUNING);
     MLAQuery::mla_flush_mla_galleries(MLACore::MLA_MLA_GALLERY_IN_TUNING);
 }
Exemplo n.º 2
0
 /**
  * Save General settings to the options table
  *
  * @since 0.1
  *
  * @uses $_REQUEST
  *
  * @return	array	Message(s) reflecting the results of the operation
  */
 private static function _save_general_settings()
 {
     $message_list = '';
     foreach (MLACore::$mla_option_definitions as $key => $value) {
         if ('general' == $value['tab']) {
             switch ($key) {
                 case MLACore::MLA_FEATURED_IN_TUNING:
                     MLACore::$process_featured_in = 'disabled' != $_REQUEST[MLA_OPTION_PREFIX . $key];
                     break;
                 case MLACore::MLA_INSERTED_IN_TUNING:
                     MLACore::$process_inserted_in = 'disabled' != $_REQUEST[MLA_OPTION_PREFIX . $key];
                     break;
                 case MLACore::MLA_GALLERY_IN_TUNING:
                     MLACore::$process_gallery_in = 'disabled' != $_REQUEST[MLA_OPTION_PREFIX . $key];
                     if ('refresh' == $_REQUEST[MLA_OPTION_PREFIX . $key]) {
                         MLAQuery::mla_flush_mla_galleries(MLACore::MLA_GALLERY_IN_TUNING);
                         /* translators: 1: reference type, e.g., Gallery in */
                         $message_list .= "<br>" . sprintf(_x('%1$s - references updated.', 'message_list', 'media-library-assistant'), __('Gallery in', 'media-library-assistant')) . "\r\n";
                         $_REQUEST[MLA_OPTION_PREFIX . $key] = 'cached';
                     }
                     break;
                 case MLACore::MLA_MLA_GALLERY_IN_TUNING:
                     MLACore::$process_mla_gallery_in = 'disabled' != $_REQUEST[MLA_OPTION_PREFIX . $key];
                     if ('refresh' == $_REQUEST[MLA_OPTION_PREFIX . $key]) {
                         MLAQuery::mla_flush_mla_galleries(MLACore::MLA_MLA_GALLERY_IN_TUNING);
                         /* translators: 1: reference type, e.g., Gallery in */
                         $message_list .= "<br>" . sprintf(_x('%1$s - references updated.', 'message_list', 'media-library-assistant'), __('MLA Gallery in', 'media-library-assistant')) . "\r\n";
                         $_REQUEST[MLA_OPTION_PREFIX . $key] = 'cached';
                     }
                     break;
                 case MLACore::MLA_TAXONOMY_SUPPORT:
                     /*
                      * Replace missing "checkbox" arguments with empty arrays,
                      * denoting that all of the boxes are unchecked.
                      */
                     if (!isset($_REQUEST['tax_support'])) {
                         $_REQUEST['tax_support'] = array();
                     }
                     if (!isset($_REQUEST['tax_quick_edit'])) {
                         $_REQUEST['tax_quick_edit'] = array();
                     }
                     if (!isset($_REQUEST['tax_term_search'])) {
                         $_REQUEST['tax_term_search'] = array();
                     }
                     if (!isset($_REQUEST['tax_flat_checklist'])) {
                         $_REQUEST['tax_flat_checklist'] = array();
                     }
                     if (!isset($_REQUEST['tax_checked_on_top'])) {
                         $_REQUEST['tax_checked_on_top'] = array();
                     }
                     break;
                 case MLACore::MLA_SEARCH_MEDIA_FILTER_DEFAULTS:
                     /*
                      * Replace missing "checkbox" arguments with empty arrays,
                      * denoting that all of the boxes are unchecked.
                      */
                     if (!isset($_REQUEST['search_fields'])) {
                         $_REQUEST['search_fields'] = array();
                     }
                     break;
                 default:
                     //	ignore everything else
             }
             // switch
             $message_list .= self::mla_update_option_row($key, $value);
         }
         // general option
     }
     // foreach mla_options
     $page_content = array('message' => __('General settings saved.', 'media-library-assistant') . "\r\n", 'body' => '');
     /*
      * Uncomment this for debugging.
      */
     // $page_content['message'] .= $message_list;
     return $page_content;
 }