Пример #1
0
 public static function set_storage_key($storage_key)
 {
     if (!empty($storage_key)) {
         self::$storage_key = $storage_key;
     } else {
         // restore to default if empty
         self::$storage_key = self::STORAGE_KEY;
     }
 }
Пример #2
0
 function reset_all_from_db()
 {
     if (!Upfront_Permissions::current(Upfront_Permissions::SAVE)) {
         $this->_reject();
     }
     $data = !empty($_POST) ? stripslashes_deep($_POST) : false;
     $stylesheet = $data['stylesheet'] ? $data['stylesheet'] : get_stylesheet();
     global $wpdb;
     $theme_key = $wpdb->esc_like(Upfront_Model::get_storage_key()) . '%';
     $stylesheet_key = $wpdb->esc_like($stylesheet) . '%';
     $global_theme_key = 'upfront_' . $wpdb->esc_like($stylesheet) . '%';
     $sql = $wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s", $stylesheet_key, $global_theme_key, $theme_key);
     $wpdb->query($sql);
     $this->_reset_cache();
     // When resetting all, also do cache.
     $this->_out(new Upfront_JsonResponse_Success("All is well"));
 }
Пример #3
0
 public function get_entity_ids_value()
 {
     $entities = array();
     $entities = Upfront_Layout::get_parsed_cascade();
     if (empty($entities)) {
         $entities = Upfront_EntityResolver::get_entity_ids();
     }
     $entities['storage_key'] = Upfront_Model::get_storage_key();
     return base64_encode(json_encode($entities));
 }