コード例 #1
0
 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     WC_Admin_Settings::save_fields($settings);
     if (isset($_POST['qsot_frontend_css_form_bg'])) {
         // Save settings
         $colors = array();
         foreach (array('form_bg', 'form_border', 'form_action_bg', 'form_helper') as $k) {
             $colors[$k] = !empty($_POST['qsot_frontend_css_' . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $k]) : '';
         }
         foreach (array('good_msg', 'bad_msg', 'remove') as $K) {
             foreach (array('_bg', '_border', '_text') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         foreach (array('past_calendar_item', 'calendar_item') as $K) {
             foreach (array('_bg', '_border', '_text', '_text_hover') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         // Check the colors.
         $valid_colors = true;
         foreach ($colors as $color) {
             if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
                 $valid_colors = false;
                 WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'opentickets-community-edition'), $color));
                 break;
             }
         }
         if ($valid_colors) {
             $old_colors = get_option('woocommerce_frontend_css_colors');
             $options = qsot_options::instance();
             $options->{'qsot-event-frontend-colors'} = $colors;
             if ($old_colors != $colors) {
                 QSOT::compile_frontend_styles();
             }
         }
     }
 }
コード例 #2
0
 protected static function lg()
 {
     if (!self::$debug) {
         return;
     }
     if (!is_resource(self::$log_file)) {
         self::$log_file = fopen(QSOT::plugin_dir() . uniqid('zoner') . '.log', 'a');
     }
     if (is_resource(self::$log_file)) {
         foreach (func_get_args() as $arg) {
             if (is_scalar($arg)) {
                 if ($arg == '*__f__*') {
                     $bt = self::bt(true);
                     $out = 'BACKTRACE: ' . implode("\n", $bt);
                 } else {
                     $out = 'MSG: ' . $arg;
                 }
             } else {
                 $out = 'DUMP: ' . var_export($arg, true);
             }
             $out .= "\n";
             fwrite(self::$log_file, $out, strlen($out));
         }
     }
 }
コード例 #3
0
 public static function enforce_non_guest_orders($post_id, $post)
 {
     // must be shop order
     if ($post->post_type != 'shop_order') {
         return;
     }
     // if guest checkout is active, this does not apply
     if (get_option('woocommerce_enable_guest_checkout', 'no') == 'yes') {
         return;
     }
     // restrict for everyone except those who can manage woocommerce settings (ie: administrators)
     if (current_user_can('manage_woocommerce')) {
         return;
     }
     // if the guest checkout is disabled and the admin is attempting to use a guest user, then flag the order, which is later used to limit payment and pop an error
     if (isset($_POST['customer_user'])) {
         $current = get_post_meta($post_id, '_customer_user', true);
         if (empty($current)) {
             update_post_meta($post_id, '_use_guest_attempted', 1);
             self::_remove_recursive_filters();
             self::_disable_emails();
             do_action('qsot-before-guest-check-update-order-status', $post);
             if (QSOT::is_wc_latest()) {
                 $order = wc_get_order($post_id);
                 $ostatus = $order->get_status();
             } else {
                 $order = new WC_Order($post_id);
                 $stati = wp_get_object_terms(array($post_id), array('shop_order_status'), 'slugs');
                 $ostatus = substr($ostatus = current($stati), 0, 3) == 'wc-' ? substr($ostatus, 3) : $ostatus;
             }
             if ($ostatus != 'pending') {
                 $order->update_status('pending', __('You cannot use "Guest" as the owner of the order, due to current Woocommerce settings.', 'opentickets-community-edition'));
             } else {
                 $order->add_order_note(__('You cannot use "Guest" as the owner of the order, due to current Woocommerce settings.', 'opentickets-community-edition'));
             }
             self::_enable_emails();
         } else {
             update_post_meta($post_id, '_use_guest_attempted', 0);
         }
     }
 }
コード例 #4
0
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (QSOT::is_wc_at_least('2.3')) {
    // in 2.3 we have enough hooks in the template ot not need an override here anymore
    return;
} else {
    if (QSOT::is_wc_at_least('2.2')) {
        qsot_underload_core_class('/includes/admin/meta-boxes/class-wc-meta-box-order-data.php');
    } else {
        _deprecated_file(__FILE__, 'OTv1.9', '', 'We no longer need to overtake the WC_Meta_Box_Order_Data class, as of OTCE v1.9.');
        die;
    }
}
if (!QSOT::is_wc_at_least('2.3')) {
    /**
     * WC_Meta_Box_Order_Data
     */
    class WC_Meta_Box_Order_Data extends _WooCommerce_Core_WC_Meta_Box_Order_Data
    {
        protected static $billing_fields = array();
        protected static $shipping_fields = array();
        /**
         * Init billing and shipping fields we display + save
         */
        public static function init_address_fields()
        {
            self::$billing_fields = apply_filters('woocommerce_admin_billing_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false, 'type' => 'select', 'options' => array('' => __('Select a country…', 'woocommerce')) + WC()->countries->get_allowed_countries()), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false), 'email' => array('label' => __('Email', 'woocommerce')), 'phone' => array('label' => __('Phone', 'woocommerce'))));
            self::$shipping_fields = apply_filters('woocommerce_admin_shipping_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false, 'type' => 'select', 'options' => array('' => __('Select a country…', 'woocommerce')) + WC()->countries->get_shipping_countries()), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false)));
        }
コード例 #5
0
										<td valign="bottom"><?php 
        echo force_balance_tags($brand_imgs[$i]);
        ?>
</td>
									<?php 
    }
    ?>
									<td valign="bottom"><a href="<?php 
    echo esc_attr(QSOT::product_url());
    ?>
" title="<?php 
    _e('Who is OpenTickets?', 'opentickets-community-edition');
    ?>
">
										<img src="<?php 
    echo esc_attr(QSOT::plugin_url() . 'assets/imgs/opentickets-tiny.jpg');
    ?>
" class="ot-tiny-logo branding-img" />
									</a></td>
								</tr>
							</tbody>

							<div class="clear"></div>
						</table>
					</div>
				</div>
			<?php 
}
?>

			<?php 
コード例 #6
0
 protected static function _order_item_order_status($item_id)
 {
     global $wpdb;
     $q = $wpdb->prepare('select order_id from ' . $wpdb->prefix . 'woocommerce_order_items where order_item_id = %d', $item_id);
     $order_id = (int) $wpdb->get_var($q);
     if ($order_id <= 0) {
         return 'does-not-exist';
     }
     if (QSOT::is_wc_latest()) {
         $status = preg_replace('#^wc-#', '', get_post_status($order_id));
     } else {
         $status = wp_get_object_terms(array($order_id), array('shop_order_status'), 'slugs');
         $status = is_array($status) ? in_array('completed', $status) ? 'completed' : current($status) : 'does-no-exist';
     }
     return $status;
 }
コード例 #7
0
 public static function wc_activation()
 {
     require_once 'opentickets.php';
     QSOT::activation();
 }
コード例 #8
0
<?php

if (QSOT::is_wc_latest()) {
    _deprecated_file(__FILE__, 'OTv1.5', dirname(dirname(dirname(dirname(__FILE__)))) . '/meta-boxes/views/html-order-item.php', __('OpenTickets WC template override has moved location.', 'opentickets-community-edition'));
}
include dirname(dirname(dirname(dirname(__FILE__)))) . '/meta-boxes/views/html-order-item.php';
コード例 #9
0
 public static function aaj_ts_update_order_items($resp, $data)
 {
     $resp['s'] = false;
     $resp['e'] = array();
     $oid = $data['order_id'];
     if ($oid > 0) {
         $order = new WC_Order($oid);
         $resp['i'] = array();
         $resp['s'] = true;
         foreach ($order->get_items(array('line_item', 'fee')) as $item_id => $item) {
             $out = '';
             ob_start();
             $class = apply_filters('woocommerce_admin_order_items_class', 'new_row', $item, $order);
             switch ($item['type']) {
                 case 'line_item':
                     $_product = $order->get_product_from_item($item);
                     $template = QSOT::is_wc_latest() ? 'meta-boxes/views/html-order-item.php' : 'post-types/meta-boxes/views/html-order-item.php';
                     include apply_filters('qsot-woo-template', $template, 'admin');
                     break;
                 case 'fee':
                     $template = QSOT::is_wc_latest() ? 'meta-boxes/views/html-order-fee.php' : 'post-types/meta-boxes/views/html-order-fee.php';
                     include apply_filters('qsot-woo-template', $template, 'admin');
                     break;
                 case 'shipping':
                     $template = QSOT::is_wc_latest() ? 'meta-boxes/views/html-order-shipping.php' : 'post-types/meta-boxes/views/html-order-shipping.php';
                     include apply_filters('qsot-woo-template', $template, 'admin');
                     break;
             }
             do_action('woocommerce_order_item_' . $item['type'] . '_html');
             $out = trim(ob_get_contents());
             ob_end_clean();
             $resp['i'][] = $out;
         }
     } else {
         $resp['e'][] = __('Invalid order number.', 'opentickets-community-edition');
     }
     return $resp;
 }
コード例 #10
0
        public static function on_activate()
        {
            // determine the cache dir name
            $u = wp_upload_dir();
            $base_dir_name = 'qsot-dompdf-fonts-' . substr(sha1(site_url()), 21, 5);
            $final_path = $u['basedir'] . DIRECTORY_SEPARATOR . $base_dir_name . DIRECTORY_SEPARATOR;
            try {
                $font_path = QSOT_cache_helper::create_find_path($final_path, 'fonts');
                if (!is_writable($font_path)) {
                    throw new Exception(sprintf(__('The %s path is not writable. Please update the permissions to allow write access.', 'opentickets-community-edition'), 'fonts'));
                }
            } catch (Exception $e) {
                // just fail. we can go without the custom config
                return;
            }
            // make sure that the libs dir is also writable
            $libs_dir = QSOT::plugin_dir() . 'libs/';
            if (!@file_exists($libs_dir) || !is_dir($libs_dir) || !is_writable($libs_dir)) {
                return;
            }
            // find all the fonts that come with the lib we packaged with the plugin, and move them to the new fonts dir, if they are not already there
            $remove_files = $updated_files = array();
            $core_fonts_dir = $libs_dir . 'dompdf/lib/fonts/';
            // open the core included fonts dir
            if (@file_exists($core_fonts_dir) && is_writable($core_fonts_dir) && ($dir = opendir($core_fonts_dir))) {
                // find all the files in the dir
                while ($file_basename = readdir($dir)) {
                    $filename = $core_fonts_dir . $file_basename;
                    $new_filename = $font_path . $file_basename;
                    // if the current file is a dir or link, skip it
                    if (is_dir($filename) || is_link($filename)) {
                        continue;
                    }
                    // overwrite any existing copy of the file, with the new version from the updated plugin
                    if (copy($filename, $new_filename)) {
                        $remove_files[] = $filename;
                        $updated_files[] = basename($filename);
                    }
                }
                file_put_contents($font_path . 'updated', 'updated on ' . date('Y-m-d H:i:s') . ":\n" . implode("\n", $remove_files));
                // attempt to create the new custom config file
                if ($config_file = fopen($libs_dir . 'wp.dompdf.config.php', 'w+')) {
                    // create variable names to use in the heredoc
                    $variable_names = array('$_SERVER["SCRIPT_FILENAME"]');
                    // generate the contents of the config file
                    $contents = <<<CONTENTS
<?php ( __FILE__ == {$variable_names[0]} ) ? die( header( 'Location: /' ) ) : null;
if ( ! defined( 'DOMPDF_FONT_DIR' ) )
\tdefine( 'DOMPDF_FONT_DIR', '{$font_path}' );
if ( ! defined( 'DOMPDF_FONT_CACHE' ) )
\tdefine( 'DOMPDF_FONT_CACHE', '{$font_path}' );
CONTENTS;
                    // write the config file, and close it
                    fwrite($config_file, $contents, strlen($contents));
                    fclose($config_file);
                    // remove any files that are marked to be removed, now that we have successfully written them to the new location, and pointed DOMPDF at them
                    /* skip this for now */
                    /*
                    if ( is_array( $remove_files ) && count( $remove_files ) )
                    	foreach ( $remove_files as $remove_file )
                    		if ( is_writable( $remove_file ) && ! is_dir( $remove_file ) && ! is_link( $remove_file ) )
                    			@unlink( $remove_file );
                    */
                }
            }
        }
コード例 #11
0
 public static function compile_frontend_styles()
 {
     $colors = self::current_colors();
     $pdir = QSOT::plugin_dir();
     $base_file = $pdir . 'assets/css/frontend/event-base.less';
     $files = array(array($pdir . 'assets/css/frontend/event.less', $pdir . 'assets/css/frontend/event.css'), array($pdir . 'assets/css/features/calendar/calendar.less', $pdir . 'assets/css/features/calendar/calendar.css'));
     // Write less file
     if (is_writable($base_file)) {
         try {
             // first check if lessc is available
             $file = self::$plugin_dir . 'libs/css/lessc.php';
             if (self::_check_one_lib($file, 'LESSC')) {
                 include $file;
             }
             // then check if cssmin is available
             $file = self::$plugin_dir . 'libs/css/cssmin.php';
             if (self::_check_one_lib($file, 'CSSMIN')) {
                 include $file;
             }
         } catch (Exception $e) {
             // upon failure to find a library, just fail, with no message, until we can figure out a good way to transport the message
             return;
         }
         try {
             // create the base file
             $css = array();
             foreach ($colors as $tag => $color) {
                 $css[] = '@' . $tag . ':' . $color . ';';
             }
             file_put_contents($base_file, implode("\n", $css));
             foreach ($files as $file_group) {
                 list($less_file, $css_file) = $file_group;
                 if (is_writable(dirname($css_file))) {
                     try {
                         // create the core css file
                         $less = new lessc();
                         $compiled_css = $less->compileFile($less_file);
                         $compiled_css = CssMin::minify($compiled_css);
                         if ($compiled_css) {
                             file_put_contents($css_file, $compiled_css);
                         }
                     } catch (Exception $ex) {
                         wp_die(sprintf(__('Could not compile stylesheet %s. [%s]', 'opentickets-community-edition'), $less_file, $ex->getMessage()));
                     }
                 } else {
                     wp_die(sprintf(__('Could not write to stylesheet file %s.', 'opentickets-community-edition'), $css_file));
                 }
             }
         } catch (Exception $ex) {
             wp_die(sprintf(__('Could not write colors to file %s. [%s]', 'opentickets-community-edition'), $base_file, $ex->getMessage()));
         }
     }
 }
コード例 #12
0
 protected function _get_report()
 {
     global $wpdb;
     $groups = array();
     // environment group
     $group = $this->_new_group(__('Environment', 'opentickets-community-edition'));
     $items = array();
     $items['Home URL'] = $this->_new_item(home_url());
     $items['Site URL'] = $this->_new_item(site_url());
     $items['WC Version'] = $this->_new_item(WC()->version);
     $items['WP Version'] = $this->_new_item($GLOBALS['wp_version']);
     $items['WP Multisite Enabled'] = $this->_new_item(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE);
     $items['Wev Server Info'] = $this->_new_item($_SERVER['SERVER_SOFTWARE'] . ' ++ ' . $_SERVER['SERVER_PROTOCOL']);
     $items['PHP Version'] = $this->_new_item(PHP_VERSION);
     if ($wpdb->is_mysql) {
         $items['MySQL Version'] = $this->_new_item($wpdb->db_version());
     }
     $items['WP Acitve Plugins'] = $this->_new_item(count(get_option('active_plugins')));
     $mem = ini_get('memory_limit');
     $mem_b = QSOT::xb2b($mem);
     $msg = '';
     $type = 'good';
     $extra = '';
     if ($mem_b < 50331648) {
         $msg = sprintf(__('You have less than the required amount of memory allocated. The minimum required amount is 48MB. You currently have %s.', 'opentickets-community-edition'), $mem);
         $type = 'bad';
         $extra = sprintf(__('Please <a href="%s">increase your memory allocation</a> to at least 48MB.', 'opentickets-community-edition'), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP');
     } else {
         if ($mem_b < 67108864) {
             $msg = sprintf(__('You have more than the minimum required memory, but we still recommend you use allocate at least 64MB. You currently have %s.', 'opentickets-community-edition'), $mem);
             $type = 'bad';
             $extra = sprintf(__('We strongly recommend that you <a href="%s">increase your memory allocation</a> to at least 48MB.', 'opentickets-community-edition'), esc_attr('http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP'));
         } else {
             $msg = sprintf(__('You have more than the required minimum memory of 64MB. Your current total is %s.', 'opentickets-community-edition'), $mem);
         }
     }
     $items['WP Memory Limit'] = $this->_new_item($msg, $type, $extra);
     $items['WP Debug Mode'] = $this->_new_item(defined('WP_DEBUG') && WP_DEBUG);
     $items['WP Language'] = $this->_new_item(get_locale());
     $items['WP Max Upload Size'] = $this->_new_item(ini_get('uplaod_max_filesize'));
     $items['WP Max Post Size'] = $this->_new_item(ini_get('post_max_size'));
     $items['PHP Max Execution Time'] = $this->_new_item(ini_get('max_execution_time'));
     $items['PHP Max Input Vars'] = $this->_new_item(ini_get('max_input_vars'));
     $u = wp_upload_dir();
     $msg = 'Uploads directory IS writable';
     $type = 'good';
     $extra = ' (' . $u['basedir'] . ')';
     if (!is_writable($u['basedir'])) {
         $msg = 'Uploads directory IS NOT writable';
         $type = 'bad';
         $extra = sprintf(' (' . $u['basedir'] . ')' . __('Having your uploads directory writable not only allows you to upload your media files, but also allows OpenTickets (and other plugins) to store their file caches. Please <a href="%s">make your uploads directory writable</a> for these reasons.', 'opentickets-community-edition'), esc_attr('http://codex.wordpress.org/Changing_File_Permissions'));
     }
     $items['WP Uploads Writable'] = $this->_new_item($msg, $type, $extra);
     $items['Default Timezone'] = $this->_new_item(date_default_timezone_get());
     $group['.items'] = $items;
     $groups[] = $group;
     $group = $this->_new_group(__('Software', 'opentickets-community-edition'));
     $items = array();
     list($html, $text) = self::_get_plugin_list();
     $items['Active Plugins'] = $this->_new_item(implode(', <br/>', $html), 'neutral', '', "\n   + " . implode(",\n   + ", $text));
     list($html, $text) = self::_get_theme_list();
     $items['Acitve Theme'] = $this->_new_item(implode(', <br/>', $html), 'neutral', '', "\n   + " . implode(",\n   + ", $text));
     $group['.items'] = $items;
     $groups[] = $group;
     $group = $this->_new_group(__('Data', 'opentickets-community-edition'));
     $items = array();
     $list = self::_get_event_areas();
     $items['Event Areas'] = $this->_new_item(implode(', ', $list), 'neutral', '', "\n   + " . implode(",\n   + ", $list));
     $list = self::_get_ticket_products();
     $items['Ticket Products'] = $this->_new_item(implode(', ', $list), 'neutral', '', "\n   + " . implode(",\n   + ", $list));
     $group['.items'] = $items;
     $groups[] = $group;
     return apply_filters('qsot-system-status-stats', $groups);
 }
コード例 #13
0
 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     $filtered_settings = $image_id_fields = array();
     // filter out the image ids types, because WC barfs on itself over them
     foreach ($settings as $field) {
         if ('qsot-image-ids' == $field['type']) {
             $image_id_fields[] = $field;
         } else {
             $filtered_settings[] = $field;
         }
     }
     // only allow wc to save the 'safe' ones
     WC_Admin_Settings::save_fields($filtered_settings);
     // handle any image id fields
     foreach ($image_id_fields as $field) {
         // if the field did not have any values passed, then skip it
         if (!isset($_POST[$field['id']])) {
             continue;
         }
         $raw_values = $_POST[$field['id']];
         // next sanitize the individual values for the field
         $values = array_filter(array_map('absint', $raw_values));
         // allow modification of the data
         $values = apply_filters('woocommerce_admin_settings_sanitize_option', $values, $field, $raw_values);
         $values = apply_filters('woocommerce_admin_settings_sanitize_option_' . $field['id'], $values, $field, $raw_values);
         // update the value
         update_option($field['id'], $values);
     }
     if (isset($_POST['qsot_frontend_css_form_bg'])) {
         // Save settings
         $colors = array();
         foreach (array('form_bg', 'form_border', 'form_action_bg', 'form_helper') as $k) {
             $colors[$k] = !empty($_POST['qsot_frontend_css_' . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $k]) : '';
         }
         foreach (array('good_msg', 'bad_msg', 'remove') as $K) {
             foreach (array('_bg', '_border', '_text') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         foreach (array('past_calendar_item', 'calendar_item') as $K) {
             foreach (array('_bg', '_border', '_text', '_text_hover') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         // Check the colors.
         $valid_colors = true;
         foreach ($colors as $color) {
             if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
                 $valid_colors = false;
                 WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'opentickets-community-edition'), $color));
                 break;
             }
         }
         if ($valid_colors) {
             $old_colors = get_option('woocommerce_frontend_css_colors');
             $options = qsot_options::instance();
             $options->{'qsot-event-frontend-colors'} = $colors;
             if ($old_colors != $colors) {
                 QSOT::compile_frontend_styles();
             }
         }
     }
 }
コード例 #14
0
 protected static function _memory_check($flush_percent_range = 80)
 {
     global $wpdb;
     static $max = false;
     $dec = $flush_percent_range / 100;
     if ($max === false) {
         $max = QSOT::memory_limit(true);
     }
     $usage = memory_get_usage();
     if ($usage > $max * $dec) {
         wp_cache_flush();
         $wpdb->queries = array();
     }
 }