vent. */ Drupal.behaviors.contextualToolbar = { attach: function (context) { if ($('body').once('contextualToolbar-init').length) { initContextualToolbar(context); } } }; /** * Namespace for the contextual toolbar. * * @namespace */ Drupal.contextualToolbar = { /** * The {@link Drupal.contextualToolbar.StateModel} instance. * * @type {?Drupal.contextualToolbar.StateModel} */ model: null }; })(jQuery, Drupal, Backbone); ; /** * @file * A Backbone Model for the state of Contextual module's edit toolbar tab. */ (function (Drupal, Backbone) { 'use strict'; Drupal.contextualToolbar.StateModel = Backbone.Model.extend(/** @lends Drupal.contextualToolbar.StateModel# */{ /** * @type {object} * * @prop {bool} isViewing * @prop {bool} isVisible * @prop {number} contextualCount * @prop {Drupal~TabbingContext} tabbingContext */ defaults: /** @lends Drupal.contextualToolbar.StateModel# */{ /** * Indicates whether the toggle is currently in "view" or "edit" mode. * * @type {bool} */ isViewing: true, /** * Indicates whether the toggle should be visible or hidden. Automatically * calculated, depends on contextualCount. * * @type {bool} */ isVisible: false, /** * Tracks how many contextual links exist on the page. * * @type {number} */ contextualCount: 0, /** * A TabbingContext object as returned by {@link Drupal~TabbingManager}: * the set of tabbable elements when edit mode is enabled. * * @type {?Drupal~TabbingContext} */ tabbingContext: null }, /** * Models the state of the edit mode toggle. * * @constructs * * @augments Backbone.Model * * @param {object} attrs * Attributes for the backbone model. * @param {object} options * An object with the following option: * @param {Backbone.collection} options.contextualCollection * The collection of {@link Drupal.contextual.StateModel} models that * represent the contextual links on the page. */ initialize: function (attrs, options) { // Respond to new/removed contextual links. this.listenTo(options.contextualCollection, 'reset remove add', this.countContextualLinks); this.listenTo(options.contextualCollection, 'add', this.lockNewContextualLinks); // Automatically determine visibility. this.listenTo(this, 'change:contextualCount', this.updateVisibility); // Whenever edit mode is toggled, lock all contextual links. this.listenTo(this, 'change:isViewing', function (model, isViewing) { options.contextualCollection.each(function (contextualModel) { contextualModel.set('isLocked', !isViewing); }); }); }, /** * Tracks the number of contextual link models in the collection. * * @param {Drupal.contextual.StateModel} contextualModel * The contextual links model that was added or removed. * @param {Backbone.Collection} contextualCollection * The collection of contextual link models. */ countContextualLinks: function (contextualModel, contextualCollection) { this.set('contextualCount', contextualCollection.length); }, /** * Lock newly added contextual links if edit mode is enabled. * * @param {Drupal.contextual.StateModel} contextualModel * The contextual links model that was added. * @param {Backbone.Collection} [contextualCollection] * The collection of contextual link models. */ lockNewContextualLinks: function (contextualModel, contextualCollection) { if (!this.get('isViewing')) { contextualModel.set('isLocked', true); } }, /** * Automatically updates visibility of the view/edit mode toggle. */ updateVisibility: function () { this.set('isVisible', this.get('contextualCouersion_check_query_args', $query ); $post_body = array( 'translations' => wp_json_encode( $translations ), ); if ( is_array( $extra_stats ) ) $post_body = array_merge( $post_body, $extra_stats ); $url = $http_url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' ); if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) $url = set_url_scheme( $url, 'https' ); $doing_cron = wp_doing_cron(); $options = array( 'timeout' => $doing_cron ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 'headers' => array( 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ) ), 'body' => $post_body, ); $response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( /* translators: %s: support forums URL */ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { return; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['offers'] ) ) { return; } $offers = $body['offers']; foreach ( $offers as &$offer ) { foreach ( $offer as $offer_key => $value ) { if ( 'packages' == $offer_key ) $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) ); elseif ( 'download' == $offer_key ) $offer['download'] = esc_url( $value ); else $offer[ $offer_key ] = esc_html( $value ); } $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files' ), '' ) ); } $updates = new stdClass(); $updates->updates = $offers; $updates->last_checked = time(); $updates->version_checked = $wp_version; if ( isset( $body['translations'] ) ) $updates->translations = $body['translations']; set_site_transient( 'update_core', $updates ); if ( ! empty( $body['ttl'] ) ) { $ttl = (int) $body['ttl']; if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { // Queue an event to re-run the update check in $ttl seconds. wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); } } // Trigger background updates if running non-interactively, and we weren't called from the update handler. if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) { do_action( 'wp_maybe_auto_update' ); } } /** * Check plugin versions against the latest versions hosted on WordPress.org. * * The WordPress version, PHP version, and Locale is sent along with a list of * all plugins installed. Checks against the WordPress server at * api.wordpress.org. Will only check if WordPress isn't installing. * * @since 2.3.0 * @global string $wp_version Used to notify the WordPress version. * * @param array $extra_stats Extra statistics to report to the WordPress.org API. */ function wp_update_plugins( $extra_stats = array() ) { if ( wp_installing() ) { return; } // include an unmodified $wp_version include( ABSPATH . WPINC . '/version.php' ); // If running blog-side, bail unless we've not checked in the last 12 hours if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $plugins = get_plugins(); $translations = wp_get_installed_translations( 'plugins' ); $active = get_option( 'active_plugins', array() ); $current = get_site_transient( 'update_plugins' ); if ( ! is_object($current) ) $current = new stdClass; $new_option = new stdClass; $new_option->last_checked = time(); $doing_cron = wp_doing_cron(); // Check for update on a different schedule, depending on the page. switch ( current_filter() ) { case 'upgrader_process_complete' : $timeout = 0; break; case 'load-update-core.php' : $timeout = MINUTE_IN_SECONDS; break; case 'load-plugins.php' : case 'load-update.php' : $timeout = HOUR_IN_SECONDS; break; default : if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $plugin_changed = false; foreach ( $plugins as $file => $p ) { $new_option->checked[ $file ] = $p['Version']; if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) ) $plugin_changed = true; } if ( isset ( $current->response ) && is_array( $current->response ) ) { foreach ( $current->response as $plugin_file => $update_details ) { if ( ! isset($plugins[ $plugin_file ]) ) { $plugin_changed = true; break; } } } // Bail if we've checked recently and if nothing has changed if ( ! $plugin_changed ) { return; } } // Update last_checked for current to prevent multiple blocking requests if request hangs $current->last_checked = time(); set_site_transient( 'update_plugins', $current ); $to_send = compact( 'plugins', 'active' ); $locales = array_values( get_available_languages() ); /** * Filters the locales requested for plugin translations. * * @since 3.7.0 * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales. * * @param array $locales Plugin locales. Default is all available locales of the site. */ $locales = apply_filters( 'plugins_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { // Three seconds, plus one extra second for every 10 plugins $timeout = 3 + (int) ( count( $plugins ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'plugins' => wp_json_encode( $to_send ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), 'all' => wp_json_encode( true ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/'; if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) $url = set_url_scheme( $url, 'https' ); $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( /* translators: %s: support forums URL */ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) { return; } $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); foreach ( $response['plugins'] as &$plugin ) { $plugin = (object) $plugin; if ( isset( $plugin->compatibility ) ) { $plugin->compatibility = (object) $plugin->compatibility; foreach ( $plugin->compatibility as &$data ) { $data = (object) $data; } } } unset( $plugin, $data ); foreach ( $response['no_update'] as &$plugin ) { $plugin = (object) $plugin; } unset( $plugin ); if ( is_array( $response ) ) { $new_option->response = $response['plugins']; $new_option->translations = $response['translations']; // TODO: Perhaps better to store no_update in a separate transient with an expiry? $new_option->no_update = $response['no_update']; } else { $new_option->response = array(); $new_option->translations = array(); $new_option->no_update = array(); } set_site_transient( 'update_plugins', $new_option ); } /** * Check theme versions against the latest versions hosted on WordPress.org. * * A list of all themes installed in sent to WP. Checks against the * WordPress server at api.wordpress.org. Will only check if WordPress isn't * installing. * * @since 2.7.0 * * @param array $extra_stats Extra statistics to report to the WordPress.org API. */ function wp_update_themes( $extra_stats = array() ) { if ( wp_installing() ) { return; } // include an unmodified $wp_version include( ABSPATH . WPINC . '/version.php' ); $installed_themes = wp_get_themes(); $translations = wp_get_installed_translations( 'themes' ); $last_update = get_site_transient( 'update_themes' ); if ( ! is_object($last_update) ) $last_update = new stdClass; $themes = $checked = $request = array(); // Put slug of current theme into request. $request['active'] = get_option( 'stylesheet' ); foreach ( $installed_themes as $theme ) { $checked[ $theme->get_stylesheet() ] = $theme->get('Version'); $themes[ $theme->get_stylesheet() ] = array( 'Name' => $theme->get('Name'), 'Title' => $theme->get('Name'), 'Version' => $theme->get('Version'), 'Author' => $theme->get('Author'), 'Author URI' => $theme->get('AuthorURI'), 'Template' => $theme->get_template(), 'Stylesheet' => $theme->get_stylesheet(), ); } $doing_cron = wp_doing_cron(); // Check for update on a different schedule, depending on the page. switch ( current_filter() ) { case 'upgrader_process_complete' : $timeout = 0; break; case 'load-update-core.php' : $timeout = MINUTE_IN_SECONDS; break; case 'load-themes.php' : case 'load-update.php' : $timeout = HOUR_IN_SECONDS; break; default : if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $theme_changed = false; foreach ( $checked as $slug => $v ) { if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) ) $theme_changed = true; } if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) { foreach ( $last_update->response as $slug => $update_details ) { if ( ! isset($checked[ $slug ]) ) { $theme_changed = true; break; } } } // Bail if we've checked recently and if nothing has changed if ( ! $theme_changed ) { return; } } // Update last_checked for current to prevent multiple blocking requests if request hangs $last_update->last_checked = time(); set_site_transient( 'update_themes', $last_update ); $request['themes'] = $themes; $locales = array_values( get_available_languages() ); /** * Filters the locales requested for theme translations. * * @since 3.7.0 * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales. * * @param array $locales Theme locales. Default is all available locales of the site. */ $locales = apply_filters( 'themes_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { // Three seconds, plus one extra second for every 10 themes $timeout = 3 + (int) ( count( $themes ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'themes' => wp_json_encode( $request ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/'; if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) $url = set_url_scheme( $url, 'https' ); $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( /* translators: %s: support forums URL */ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) { return; } $new_update = new stdClass; $new_update->last_checked = time(); $new_update->checked = $checked; $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); if ( is_array( $response ) ) { $new_update->response = $response['themes']; $new_update->translations = $response['translations']; } set_site_transient( 'update_themes', $new_update ); } /** * Performs WordPress automatic background updates. * * @since 3.7.0 */ function wp_maybe_auto_update() { include_once( ABSPATH . '/wp-admin/includes/admin.php' ); include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' ); $upgrader = new WP_Automatic_Updater; $upgrader->run(); } /** * Retrieves a list of all language updates available. * * @since 3.7.0 * * @return array */ function wp_get_translation_updates() { $updates = array(); $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' ); foreach ( $transients as $transient => $type ) { $transient = get_site_transient( $transient ); if ( empty( $transient->translations ) ) continue; foreach ( $transient->translations as $translation ) { $updates[] = (object) $translation; } } return $updates; } /** * Collect counts and UI strings for available updates * * @since 3.3.0 * * @return array */ function wp_get_update_data() { $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 ); if ( $plugins = current_user_can( 'update_plugins' ) ) { $update_plugins = get_site_transient( 'update_plugins' ); if ( ! empty( $update_plugins->response ) ) $counts['plugins'] = count( $update_plugins->response ); } if ( $themes = current_user_can( 'update_themes' ) ) { $update_themes = get_site_transient( 'update_themes' ); if ( ! empty( $update_themes->response ) ) $counts['themes'] = count( $update_themes->response ); } if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) { $update_wordpress = get_core_updates( array('dismissed' => false) ); if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) $counts['wordpress'] = 1; } if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) $counts['translations'] = 1; $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations']; $titles = array(); if ( $counts['wordpress'] ) { /* translators: 1: Number of updates available to WordPress */ $titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] ); } if ( $counts['plugins'] ) { /* translators: 1: Number of updates available to plugins */ $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] ); } if ( $counts['themes'] ) { /* translators: 1: Number of updates available to themes */ $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); } if ( $counts['translations'] ) { $titles['translations'] = __( 'Translation Updates' ); } $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : ''; $update_data = array( 'counts' => $counts, 'title' => $update_title ); /** * Filters the returned array of update data for plugins, themes, and WordPress core. * * @since 3.5.0 * * @param array $update_data { * Fetched update data. * * @type array $counts An array of counts for available plugin, theme, and WordPress updates. * @type string $update_title Titles of available updates. * } * @param array $titles An array of update counts and UI strings for available updates. */ return apply_filters( 'wp_get_update_data', $update_data, $titles ); } /** * Determines whether core should be updated. * * @since 2.8.0 * * @global string $wp_version */ function _maybe_update_core() { // include an unmodified $wp_version include( ABSPATH . WPINC . '/version.php' ); $current = get_site_transient( 'update_core' ); if ( isset( $current->last_checked, $current->version_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) && $current->version_checked == $wp_version ) { return; } wp_version_check(); } /** * Check the last time plugins were run before checking plugin versions. * * This might have been backported to WordPress 2.6.1 for performance reasons. * This is used for the wp-admin to check only so often instead of every page * load. * * @since 2.7.0 * @access private */ function _maybe_update_plugins() { $current = get_site_transient( 'update_plugins' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) return; wp_update_plugins(); } /** * Check themes versions only after a duration of time. * * This is for performance reasons to make sure that on the theme version * checker is not run on every page load. * * @since 2.7.0 * @access private */ function _maybe_update_themes() { $current = get_site_transient( 'update_themes' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) return; wp_update_themes(); } /** * Schedule core, theme, and plugin update checks. * * @since 3.1.0 */ function wp_schedule_update_checks() { if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() ) wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_installing() ) wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() ) wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); } /** * Clear existing update caches for plugins, themes, and core. * * @since 4.1.0 */ function wp_clean_update_cache() { if ( function_exists( 'wp_clean_plugins_cache' ) ) { wp_clean_plugins_cache(); } else { delete_site_transient( 'update_plugins' ); } wp_clean_themes_cache(); delete_site_transient( 'update_core' ); } if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) { return; } add_action( 'admin_init', '_maybe_update_core' ); add_action( 'wp_version_check', 'wp_version_check' ); add_action( 'load-plugins.php', 'wp_update_plugins' ); add_action( 'load-update.php', 'wp_update_plugins' ); add_action( 'load-update-core.php', 'wp_update_plugins' ); add_action( 'admin_init', '_maybe_update_plugins' ); add_action( 'wp_update_plugins', 'wp_update_plugins' ); add_action( 'load-themes.php', 'wp_update_themes' ); add_action( 'load-update.php', 'wp_update_themes' ); add_action( 'load-update-core.php', 'wp_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' ); add_action( 'update_option_WPLANG', 'wp_clean_update_cache' , 10, 0 ); add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' ); add_action( 'init', 'wp_schedule_update_checks' ); u-S#Ph(`fw jR[z`9'Jw/ ىFi'm R]dTnSC>_MwQYRLc|Jt 'á֯4i|ӱHӵoΣMFNFV`_.縀b.i5+D^ayݦ{bY[VAW|"JO4D'jkau*r5qʻ~'a$,*-*q$?h( h૭G`ů2@FfR?sA}EBӸgRr}K/k@I¸&6,g?L;%e-JBTB !a [R?9aX|n\3W=ܪ(bmV)^E~HG$ Q{Ѩ">|ey>do⊯NYDOo>ؽ$)7!q!YEبF5ύIoOkp6lLi - ; ]zQeܩgnRA47`{Rj3^mǏ#Fݲ]aܪega|H1|O8b r6O rG66OI !%NaCŊ&PB*/: ]7hfoRѴˆT/e3bsApd4 r  641Nay3W[9 'h{S.zŹ9{(2={|$xMށ}09br+,7)-S.Q%&TYr(Rjd/?ǪAm=0Q& +}[Xnu^D1AR#J)~ޖmB*SY \,䛍: .43JΎS'& iB.SN@O8{b&BUM9L} Ptj}-bőV;JKN__=@XcRmJxx%ttb_8_z!hg~@׃M.<_L>A,R{;2eh {# d. r^~q@#3a mv kn<g+ A\LMӋ`N&VC'݅#XHx%9$@Wm&dں8Xt7jp ͛W7k&'gXn`*H-h-_1wS]1H65p$(mSqK9G?9ř'_.3R-w#MMA'/ٟcշ}q}wmU#Qmߑk}W|zimkƦ}Mե}W/<}5eL XESuQ?]/Oa]p`)hgG]c5m3Y(uug`]&w,VI}gGy OI[ j4qioi'\{zT=siSJBs{]=O=0shYۘ"KYd$wv‡Ffa#Y%͑ŬA(Q.Tϱr7i֕cmwIe˷-LSoAkg]{BEHN,#FURu=}!Q4#_ywO,5}w5־v+{Nqe<6M LRqDj2A6/ڗVp7Ȁ _$L9"֌o)BPemD &ԌGGU_n9*u;,"ܮEÕdž{߯LN=ن *h?>_L /!\1}{| )nTB1gTL˒5GlnuӒoퟒ~j>xsa-(fIi{}x> ukbA%-q٠qKtIĮ5H4SΫw5;0T~Ҷ{zS zvg@ 't~+ osv 0?8/CP(LB OB_b" =EN5 fr?v!]צp:r\g(#eGm0TC ̣UUy{&I nqVۙ:wD2ذY6@UݼdM^I@'r0FVrb(* v9}n5Г E6N f*gxE F~xYdHԶ$@@ t&%KIʛjShcǎn.R0Y4/@l(+f;yF3vDSQƣHZbUв# y'^Ȟo ?7OpI$F@~,dY /noZ%!F+v< ";7`GȃP臣UAnKT[ eJxըŃ#!١s'[q$]bɅHtDk=]Iҍ.xS[im\@_QQaG+rߙ6<9i,S|A2.Uc [x& cF&)D^ JC f]HxE^gܽ ԛЛ#yoWHEq-wch8}MN)@a4mJ׷i0rΒOcx.6BXb2"t<Yc8 2F%D nQ>-RsM4Pj^y|Ʊ3eWdo7l#GM&-Y.yp2 T`\3%ۡ@iCeqDع[E-Sh,˨% 5#ó#)S,UVmbYuߟtbwP"KhO¾@dx÷ Qs%z')3pMVz5!+-{Y =jx+gzQjEqm%+xr㡘 X#hnWDO^4?IK)T~ *HFMK( 1 |l2w;0W{^{ \&JԬq{xx&u<˩][sn8eFpO'g)U>-)yMMz_U_F %҃*v4Co&@Ŵ|%*x0q2ml҂Z?;ARJYPS"'tal5GD 吾-cLIsڧ|fUL Mq~C[3jj 4…HKf&E~1>Z쏽G Nٶ-pwC/$ruy-o8C,HaL+EmG#-!4 +WZVTQ^vr[QA >?ysZ%Dl+;Ypn |1 RxRJKVJA=/-KhXZc<* TgCB(K$h7>rirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } // These tests give us a WP-generated permalink if ( is_404() ) { // Redirect ?page_id, ?p=, ?attachment_id= to their respective url's $id = max( get_query_var('p'), get_query_var('page_id'), get_query_var('attachment_id') ); if ( $id && $redirect_post = get_post($id) ) { $post_type_obj = get_post_type_object($redirect_post->post_type); if ( $post_type_obj->public && 'auto-draft' != $redirect_post->post_status ) { $redirect_url = get_permalink($redirect_post); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) { $year = get_query_var( 'year' ); $month = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); $date = sprintf( '%04d-%02d-%02d', $year, $month, $day ); if ( ! wp_checkdate( $month, $day, $year, $date ) ) { $redirect_url = get_month_link( $year, $month ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url ); } } elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) { $redirect_url = get_year_link( get_query_var( 'year' ) ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url ); } if ( ! $redirect_url ) { if ( $redirect_url = redirect_guess_404_permalink() ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } if ( get_query_var( 'page' ) && $wp_query->post && false !== strpos( $wp_query->post->post_content, '' ) ) { $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); $redirect_url = get_permalink( $wp_query->post->ID ); } } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) { // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101 if ( is_attachment() && ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) && ! $redirect_url ) { if ( ! empty( $_GET['attachment_id'] ) ) { $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] ); } } else { $redirect_url = get_attachment_link(); } } elseif ( is_single() && !empty($_GET['p']) && ! $redirect_url ) { if ( $redirect_url = get_permalink(get_query_var('p')) ) $redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']); } elseif ( is_single() && !empty($_GET['name']) && ! $redirect_url ) { if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) ) $redirect['query'] = remove_query_arg('name', $redirect['query']); } elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) { if ( $redirect_url = get_permalink(get_query_var('page_id')) ) $redirect['query'] = remove_query_arg('page_id', $redirect['query']); } elseif ( is_page() && !is_feed() && 'page' == get_option('show_on_front') && get_queried_object_id() == get_option('page_on_front') && ! $redirect_url ) { $redirect_url = home_url('/'); } elseif ( is_home() && !empty($_GET['page_id']) && 'page' == get_option('show_on_front') && get_query_var('page_id') == get_option('page_for_posts') && ! $redirect_url ) { if ( $redirect_url = get_permalink(get_option('page_for_posts')) ) $redirect['query'] = remove_query_arg('page_id', $redirect['query']); } elseif ( !empty($_GET['m']) && ( is_year() || is_month() || is_day() ) ) { $m = get_query_var('m'); switch ( strlen($m) ) { case 4: // Yearly $redirect_url = get_year_link($m); break; case 6: // Monthly $redirect_url = get_month_link( substr($m, 0, 4), substr($m, 4, 2) ); break; case 8: // Daily $redirect_url = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); break; } if ( $redirect_url ) $redirect['query'] = remove_query_arg('m', $redirect['query']); // now moving on to non ?m=X year/month/day links } elseif ( is_day() && get_query_var('year') && get_query_var('monthnum') && !empty($_GET['day']) ) { if ( $redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')) ) $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']); } elseif ( is_month() && get_query_var('year') && !empty($_GET['monthnum']) ) { if ( $redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum')) ) $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']); } elseif ( is_year() && !empty($_GET['year']) ) { if ( $redirect_url = get_year_link(get_query_var('year')) ) $redirect['query'] = remove_query_arg('year', $redirect['query']); } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { $author = get_userdata(get_query_var('author')); if ( ( false !== $author ) && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) { if ( $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) ) $redirect['query'] = remove_query_arg('author', $redirect['query']); } } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories) $term_count = 0; foreach ( $wp_query->tax_query->queried_terms as $tax_query ) $term_count += count( $tax_query['terms'] ); $obj = $wp_query->get_queried_object(); if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) { if ( !empty($redirect['query']) ) { // Strip taxonomy query vars off the url. $qv_remove = array( 'term', 'taxonomy'); if ( is_category() ) { $qv_remove[] = 'category_name'; $qv_remove[] = 'cat'; } elseif ( is_tag() ) { $qv_remove[] = 'tag'; $qv_remove[] = 'tag_id'; } else { // Custom taxonomies will have a custom query var, remove those too: $tax_obj = get_taxonomy( $obj->taxonomy ); if ( false !== $tax_obj->query_var ) $qv_remove[] = $tax_obj->query_var; } $rewrite_vars = array_diff( array_keys($wp_query->query), array_keys($_GET) ); if ( !array_diff($rewrite_vars, array_keys($_GET)) ) { // Check to see if all the Query vars are coming from the rewrite, none are set via $_GET $redirect['query'] = remove_query_arg($qv_remove, $redirect['query']); //Remove all of the per-tax qv's // Create the destination url for this taxonomy $tax_url = parse_url($tax_url); if ( ! empty($tax_url['query']) ) { // Taxonomy accessible via ?taxonomy=..&term=.. or any custom qv.. parse_str($tax_url['query'], $query_vars); $redirect['query'] = add_query_arg($query_vars, $redirect['query']); } else { // Taxonomy is accessible via a "pretty-URL" $redirect['path'] = $tax_url['path']; } } else { // Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite foreach ( $qv_remove as $_qv ) { if ( isset($rewrite_vars[$_qv]) ) $redirect['query'] = remove_query_arg($_qv, $redirect['query']); } } } } } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false && $cat = get_query_var( 'category_name' ) ) { $category = get_category_by_path( $cat ); if ( ( ! $category || is_wp_error( $category ) ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) { $redirect_url = get_permalink($wp_query->get_queried_object_id()); } } // Post Paging if ( is_singular() && get_query_var('page') ) { if ( !$redirect_url ) $redirect_url = get_permalink( get_queried_object_id() ); $page = get_query_var( 'page' ); if ( $page > 1 ) { if ( is_front_page() ) { $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' ); } else { $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( $page, 'single_paged' ); } } $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); } // paging and feeds if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) { // Strip off paging and feed $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings $redirect['path'] = preg_replace("#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing comment paging } $addl_path = ''; if ( is_feed() && in_array( get_query_var('feed'), $wp_rewrite->feeds ) ) { $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; if ( !is_singular() && get_query_var( 'withcomments' ) ) $addl_path .= 'comments/'; if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var('feed') ) || 'rss' == get_query_var('feed') ) $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' ); else $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' ); $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); } elseif ( is_feed() && 'old' == get_query_var('feed') ) { $old_feed_files = array( 'wp-atom.php' => 'atom', 'wp-commentsrss2.php' => 'comments_rss2', 'wp-feed.php' => get_default_feed(), 'wp-rdf.php' => 'rdf', 'wp-rss.php' => 'rss2', 'wp-rss2.php' => 'rss2', ); if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) { $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] ); wp_redirect( $redirect_url, 301 ); die(); } } if ( get_query_var('paged') > 0 ) { $paged = get_query_var('paged'); $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] ); if ( !is_feed() ) { if ( $paged > 1 && !is_single() ) { $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("$wp_rewrite->pagination_base/$paged", 'paged'); } elseif ( !is_single() ) { $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; } } elseif ( $paged > 1 ) { $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] ); } } if ( get_option( 'page_comments' ) && ( ( 'newest' == get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 0 ) || ( 'newest' != get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 1 ) ) ) { $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var('cpage'), 'commentpaged' ); $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); } $redirect['path'] = user_trailingslashit( preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/ if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/' . $wp_rewrite->index . '/') === false ) $redirect['path'] = trailingslashit($redirect['path']) . $wp_rewrite->index . '/'; if ( !empty( $addl_path ) ) $redirect['path'] = trailingslashit($redirect['path']) . $addl_path; $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; } if ( 'wp-register.php' == basename( $redirect['path'] ) ) { if ( is_multisite() ) { /** This filter is documented in wp-login.php */ $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); } else { $redirect_url = wp_registration_url(); } wp_redirect( $redirect_url, 301 ); die(); } } // tack on any additional query vars $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); if ( $redirect_url && !empty($redirect['query']) ) { parse_str( $redirect['query'], $_parsed_query ); $redirect = @parse_url($redirect_url); if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) { parse_str( $redirect['query'], $_parsed_redirect_query ); if ( empty( $_parsed_redirect_query['name'] ) ) unset( $_parsed_query['name'] ); } $_parsed_query = rawurlencode_deep( $_parsed_query ); $redirect_url = add_query_arg( $_parsed_query, $redirect_url ); } if ( $redirect_url ) $redirect = @parse_url($redirect_url); // www.example.com vs example.com $user_home = @parse_url(home_url()); if ( !empty($user_home['host']) ) $redirect['host'] = $user_home['host']; if ( empty($user_home['path']) ) $user_home['path'] = '/'; // Handle ports if ( !empty($user_home['port']) ) $redirect['port'] = $user_home['port']; else unset($redirect['port']); // trailing /index.php $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']); $punctuation_pattern = implode( '|', array_map( 'preg_quote', array( ' ', '%20', // space '!', '%21', // exclamation mark '"', '%22', // double quote "'", '%27', // single quote '(', '%28', // opening bracket ')', '%29', // closing bracket ',', '%2C', // comma '.', '%2E', // period ';', '%3B', // semicolon '{', '%7B', // opening curly bracket '}', '%7D', // closing curly bracket '%E2%80%9C', // opening curly quote '%E2%80%9D', // closing curly quote ) ) ); // Remove trailing spaces and end punctuation from the path. $redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] ); if ( !empty( $redirect['query'] ) ) { // Remove trailing spaces and end punctuation from certain terminating query string args. $redirect['query'] = preg_replace( "#((p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] ); // Clean up empty query strings $redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&'); // Redirect obsolete feeds $redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] ); // Remove redundant leading ampersands $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); } // strip /index.php/ when we're not using PATHINFO permalinks if ( !$wp_rewrite->using_index_permalinks() ) $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] ); // trailing slashes if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) { $user_ts_type = ''; if ( get_query_var('paged') > 0 ) { $user_ts_type = 'paged'; } else { foreach ( array('single', 'category', 'page', 'day', 'month', 'year', 'home') as $type ) { $func = 'is_' . $type; if ( call_user_func($func) ) { $user_ts_type = $type; break; } } } $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type); } elseif ( is_front_page() ) { $redirect['path'] = trailingslashit($redirect['path']); } // Strip multiple slashes out of the URL if ( strpos($redirect['path'], '//') > -1 ) $redirect['path'] = preg_replace('|/+|', '/', $redirect['path']); // Always trailing slash the Front Page URL if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) $redirect['path'] = trailingslashit($redirect['path']); // Ignore differences in host capitalization, as this can lead to infinite redirects // Only redirect no-www <=> yes-www if ( strtolower($original['host']) == strtolower($redirect['host']) || ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) ) $redirect['host'] = $original['host']; $compare_original = array( $original['host'], $original['path'] ); if ( !empty( $original['port'] ) ) $compare_original[] = $original['port']; if ( !empty( $original['query'] ) ) $compare_original[] = $original['query']; $compare_redirect = array( $redirect['host'], $redirect['path'] ); if ( !empty( $redirect['port'] ) ) $compare_redirect[] = $redirect['port']; if ( !empty( $redirect['query'] ) ) $compare_redirect[] = $redirect['query']; if ( $compare_original !== $compare_redirect ) { $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; if ( !empty($redirect['port']) ) $redirect_url .= ':' . $redirect['port']; $redirect_url .= $redirect['path']; if ( !empty($redirect['query']) ) $redirect_url .= '?' . $redirect['query']; } if ( ! $redirect_url || $redirect_url == $requested_url ) { return; } // Hex encoded octets are case-insensitive. if ( false !== strpos($requested_url, '%') ) { if ( !function_exists('lowercase_octets') ) { /** * Converts the first hex-encoded octet match to lowercase. * * @since 3.1.0 * @ignore * * @param array $matches Hex-encoded octet matches for the requested URL. * @return string Lowercased version of the first match. */ function lowercase_octets($matches) { return strtolower( $matches[0] ); } } $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url); } /** * Filters the canonical redirect URL. * * Returning false to this filter will cancel the redirect. * * @since 2.3.0 * * @param string $redirect_url The redirect URL. * @param string $requested_url The requested URL. */ $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url ); // yes, again -- in case the filter aborted the request if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) == strip_fragment_from_url( $requested_url ) ) { return; } if ( $do_redirect ) { // protect against chained redirects if ( !redirect_canonical($redirect_url, false) ) { wp_redirect($redirect_url, 301); exit(); } else { // Debug // die("1: $redirect_url
2: " . redirect_canonical( $redirect_url, false ) ); return; } } else { return $redirect_url; } } /** * Removes arguments from a query string if they are not present in a URL * DO NOT use this in plugin code. * * @since 3.4.0 * @access private * * @param string $query_string * @param array $args_to_check * @param string $url * @return string The altered query string */ function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $url ) { $parsed_url = @parse_url( $url ); if ( ! empty( $parsed_url['query'] ) ) { parse_str( $parsed_url['query'], $parsed_query ); foreach ( $args_to_check as $qv ) { if ( !isset( $parsed_query[$qv] ) ) $query_string = remove_query_arg( $qv, $query_string ); } } else { $query_string = remove_query_arg( $args_to_check, $query_string ); } return $query_string; } /** * Strips the #fragment from a URL, if one is present. * * @since 4.4.0 * * @param string $url The URL to strip. * @return string The altered URL. */ function strip_fragment_from_url( $url ) { $parsed_url = @parse_url( $url ); if ( ! empty( $parsed_url['host'] ) ) { // This mirrors code in redirect_canonical(). It does not handle every case. $url = $parsed_url['scheme'] . '://' . $parsed_url['host']; if ( ! empty( $parsed_url['port'] ) ) { $url .= ':' . $parsed_url['port']; } if ( ! empty( $parsed_url['path'] ) ) { $url .= $parsed_url['path']; } if ( ! empty( $parsed_url['query'] ) ) { $url .= '?' . $parsed_url['query']; } } return $url; } /** * Attempts to guess the correct URL based on query vars * * @since 2.3.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @return false|string The correct URL if one is found. False on failure. */ function redirect_guess_404_permalink() { global $wpdb; if ( get_query_var('name') ) { $where = $wpdb->prepare("post_name LIKE %s", $wpdb->esc_like( get_query_var('name') ) . '%'); // if any of post_type, year, monthnum, or day are set, use them to refine the query if ( get_query_var('post_type') ) $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type')); else $where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')"; if ( get_query_var('year') ) $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); if ( get_query_var('monthnum') ) $where .= $wpdb->prepare(" AND MONTH(post_date) = %d", get_query_var('monthnum')); if ( get_query_var('day') ) $where .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", get_query_var('day')); $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'"); if ( ! $post_id ) return false; if ( get_query_var( 'feed' ) ) return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); elseif ( get_query_var( 'page' ) && 1 < get_query_var( 'page' ) ) return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); else return get_permalink( $post_id ); } return false; } /** * Redirects a variety of shorthand URLs to the admin. * * If a user visits example.com/admin, they'll be redirected to /wp-admin. * Visiting /login redirects to /wp-login.php, and so on. * * @since 3.4.0 * * @global WP_Rewrite $wp_rewrite */ function wp_redirect_admin_locations() { global $wp_rewrite; if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) ) return; $admins = array( home_url( 'wp-admin', 'relative' ), home_url( 'dashboard', 'relative' ), home_url( 'admin', 'relative' ), site_url( 'dashboard', 'relative' ), site_url( 'admin', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) { wp_redirect( admin_url() ); exit; } $logins = array( home_url( 'wp-login.php', 'relative' ), home_url( 'login', 'relative' ), site_url( 'login', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) { wp_redirect( wp_login_url() ); exit; } } May | 2011 | Luvs 2 Eat

Monthly Archives: May 2011

Crock Pot Recipe: Pork Carnitas Tacos and Watermelon Salsa

By | Crock Pot, Dinner, Taco | No Comments

I recently started reading Tom Colicchio’s book Think Like a Chef. One of the things Chef Colicchio writes about, that I’ve really tried to apply, is using the market to inspire my own dishes. This past weekend, Diana and I took a trip to Central Market with that thought in mind. We arrived with no grocery list. We browsed through the produce taking time to smell and taste, and examined the meat and fish counters for cuts we would not normally use. What I ended up with was delicious crock pot pork carnitas tacos and a watermelon salsa.

Crock Pot Pork Carnitas

Ingredients:

  • 2 lbs. Pork Shoulder (Also known as Boston butt)
  • 4 Cloves Garlic Diced
  • Kosher Salt (About 2 pinches for each side)
  • 1/4 Cup Chopped Cilantro
  • Juice from 1 Lime
  • Dry Oregano (About 1 tsp. per side)
  • 1 Bay Leaf
  • 1/2 Onion Diced (I used a sweet Vidalia onion. Yum!)
  • 1 12 oz. bottle of Corona (You could use chicken stock instead)
  • Black Pepper (I season 3 turns on the pepper mill for each side. You can season more or less based on your taste)

 

Directions:

1.) First, start by seasoning each side pork shoulder with salt, black pepper and oregano. Be sure to rub the seasonings into the meat to help infuse the flavor.

2.) After seasoning the pork, place the pork shoulder in the slow cooker.

3.) Next add the beer, but avoid pouring directly on the pork. This could wash away some of the seasoning you’ve just added.

4.) After you’ve poured the beer add diced garlic, chopped cilantro, lime juice, bay leaf, and diced onion.

5.) Now that all the ingredients have been added, cook the pork in the slow cooker on low for 10 hours turning once about half-way through. It’s done when you can poke at the pork with a fork and it easily falls apart.

6.) Remove the pork and use two forks to pull into shreds.

7.) Finally, season with salt and pepper. You can also squeeze on extra lime juice for additional flavor.

Watermelon Salsa:

Prep Time: 15 minutes

Ingredients:
  • 1 Cup Watermelon Diced
  • 1/4 Cup White Onion Diced
  • 1 Tbsp. Chopped Cilantro
  • 1 Tbsp. Seeded and Chopped Jalapeño
  • Juice from 1/2 a lime
  • Salt
  • Pepper
Directions

1.) In a bowl, combine diced watermelon, onion, cilantro and Jalapeño.

2.) Next, add juice of 1/2 of a lime and mix well.

3.) Finally, season with salt and pepper to taste.

4.) Let the salsa marinate for at least 30 minutes before serving.

 

Tender Oven Baked Pork Ribs

By | Dinner, Featured | No Comments

A couple of weekends ago, I took my mom out to the 1st Annual Fulbrook Cork and Culinary Festival for Mother’s Day. We had a great time eating a ton of great food (see our Facebook album here), but also saw several cooking demos while we were there. Top Chef Season 2 Winner Ilan Hall demonstrated how to cook lamb ribs. I’m a sucker for good ribs, so this was the first thing I had to cook when I got home.

For this recipe, I’ve applied the techniques Ilan taught in his demo, but chose to make pork instead of lamb ribs. The whole process takes anywhere from 10-12 hours.

 


  • Pork Ribs
  • Garlic Powder
  • Kosher Salt
  • Pepper
  • Basil
  • Smoked Paprika (Yes, I use this on just about everything)
  • Extra Virgin Olive Oil
  • Plastic Wrap
  • Aluminum Foil

 


1.) Season both sides of the ribs to your liking. I used a pinch of salt, garlic powder, basil, ground pepper and smoked paprika.

Seasoned Pork Ribs

2.) Heat oil in a frying pan. If I had to guess I used about 2 tablespoons total (added a little bit more after this picture).

Oil in Frying Pan

3.) Brown both sides of the ribs in oil. This took about 10 minutes.

Ribs in the Frying Pan

4.) Let the ribs cool.

5.) Pre-heat oven to 170 degrees.

6.) Wrap tightly in plastic wrap (3-4 times). This is very important. It holds in the juices to help make the ribs tender.

Ribs in Plastic Wrap

7.) Wrap tightly in foil. You’ll need to use 3-4 layers here as well.

Ribs in Foil


8.) Place ribs in a baking pan (I used a Pyrex dish) and add enough water to cover the ribs about half way.

9.) Bake in oven for 10-11 hours. The longer you cook them the more tender the ribs will be. I cooked mine for 10 hours.

Ribs in the Oven


10.) Place on the grill to add a nice crisp to the outsides of the ribs. I cooked mine with the burners at medium high heat for about 10 minutes on each side.

Pork Ribs

11.) Enjoy!

Oven Baked Pork Ribs

 

Me with Top Chef Ilan Hall

Top Chef Season 2 Winner Ilan Hall

 

 

Apple Pancakes & Bacon

By | Breakfast | 2 Comments

We have been on a cook book purchasing kick and recently downloaded Fabio Viviani’s breakfast cookbook “Did I really Make Breakfast??? (Well Grandma did help a lot)” found on the Amazon Kindle.  It’s a great collection of easy recipes that will make your mouth water.  This morning I decided to use his Apple Maple Pancake & Salty Spicy Bacon recipe as inspiration for the following dish.


For the bacon:

  • 6 slices centercut bacon
  • 1/4 tsp kosher salt
  • 1/4 tsp organic cane sugar
  • lemon zest to your liking (I’m not a huge lemon fan, so I used very little, but you can add as much or as little as you like)
  • cracked black pepper

For the pancakes:

  • 3/4 cup fat free milk
  • 1/4 cup heavy whipping cream
  • 2 eggs
  • 3/4 tbsp brown sugar
  • 1 tbsp canola oil
  • 1 cup all purpose flour
  • 1/4 cup maple syrup
  • 2 tbsp baking powder
  • 1/4 tbsp ground cinnamon
  • 1 small peeled apple chopped


  1. Preheat your oven to 400 degrees.
  2. Place 6 slices of bacon on an aluminum foil lined baking sheet.  Crack fresh black pepper on top of your bacon slices to your liking.
  3. Then in a small bowl combine salt, sugar, and lemon zest and sprinkle on the bacon slices.
  4. Bake for 12-15 minutes or until the bacon is cooked how you like it.

While the bacon is in the oven, gather the ingredients for the pancakes.

  1. Throw everything except the apple in a blender and combine on low until smooth.  The mixture will be runny but that is o.k.
  2. Then throw in the apple (leave some for garnish if you like; it adds a nice fresh crunch to the finished product if you leave some on top of the finished pancakes) and mix together with a spoon.
  3. In a preheated griddle or pan on the stove that’s over medium low heat, pour your desired pancake size and flip over once edges get firm and the top gets bubbly.
  4. Cook for about 2 minutes or until its cooked all the way and no liquid is visible.  I made my pancakes quite large and I got about 6 pancakes from my batch.

Place the bacon on top of the pancakes and serve with syrup and if you’d like chopped apple on top.  You’d be surprised how yummy the lemon zest is on bacon, I would have never guessed!!!  Great trick Fabio, I love it! It’s sooo easy and SOOOOOO YUMMY!!! 🙂

Lemon Shrimp Orzo Salad

By | Pasta | No Comments

I’m always looking for new ideas and ingredients to cook with and I recently purchased orzo after I had a yummy dish at McCormick & Schmick’s that spurred my culinary imagination.  This dish I created on a whim, so please use as much or as little of each ingredient as  you like.  I’m used to cooking for 2, so if you want more, please double the recipe and I absolutely won’t be offended.  To make the orzo I used:

-1/2 cup whole wheat orzo

-1 qt water

Basically you will follow the package directions and boil the water and add the orzo and cook for 8-10 minutes.  Then drain it and set aside.

For the rest of the dish I used:

-olive oil (about 1-2 tbsp to coat the pan)

-1 green bell pepper chopped

-1/2 red onion chopped

-2 cloves minced garlic

-1-2 tbsp red wine vinegar (depending on how vinegary you like it feel free to add more or less)

-1 cup raw shrimp (peeled and deveined)

-2 tbsp chopped black olives

-1/2 cup chopped tomato

-1 handful of chopped fresh parsley

-juice of one lemon

-salt & pepper to taste

Use a skillet that is coated in olive oil over medium high heat to saute the bell pepper, onion, and garlic.

Lightly season with salt and pepper.  Cook about 3-4 minutes then add the red wine vinegar. Constantly stir all ingredients together using a spatula and cook for about 2 more minutes.  Add the shrimp and cook for another 2 minutes and then add the olives.  Cook until the shrimp is cooked through and then remove from heat.  Stir in the orzo, tomato, parsley, and lemon juice and top it off with salt and pepper to taste.  Enjoy!

Grilled Honey Mustard Salmon

By | Dinner | No Comments

This salmon is quick, easy to make and delicious. I normally would make my own marinade, but the Bolthouse Farms Honey Mustard Dressing makes a great grilling sauce when pressed for time (it’s also great on pork and chicken). Because it is a yogurt based dressing, you won’t find it on the salad dressing aisle. Look for it in the cooler near the pre-made smoothies in the fruit section.

Ingredients:

  • Salmon
  • Olive Oil
  • Salt
  • Pepper
  • Bolt House Farms Honey Mustard Dressing (Use enough to coat one side of your salmon fillets)

1.) Pre-heat your grill to around 400 degrees. You’ll also want to use some kind of grill spray to keep your salmon from sticking.
2.) Prep the salmon by brushing or spraying the salmon filet with oil. We use the Misto Olive Oil Sprayer.
2.) Lightly season the salmon with salt and pepper.
3.) Grill for 10-15 minutes total depending on your how rare you like your salmon. I cook for it 12 minutes for medium flipping around 7 or 8 minutes.
4.) Brush with dressing when you flip the salmon.
5.) Enjoy!

Pictured with Oven-Roasted Fingerling Fries

Oven-Roasted Fingerling Potato Fries

By | Featured, Sides | 4 Comments

Oven-Roasted Fingerling Fries (Beware, these are addicting)

After attending last weekend’s culinary fair, I’ve been motivated to create some new recipes in the kitchen. Unfortunately, it’s challenging to find time and energy to cook during the week, but tonight I threw together these fingerling fries that are big on flavor and only take about 45 minutes to make.

Ingredients:

  • Fingerling Potatoes
  • Extra Virgin Olive Oil
  • Garlic Powder
  • Basil
  • Sea Salt
  • Pepper
  • Smoked Paprika
  • Chili Powder

1.) Thoroughly clean and scrub the potatoes.


2.) Cut the potatoes in half. This will allow the fingerlings to cook faster and also gives them a nice crisp.


3.) Toss in olive oil. I used about 2 tablespoons, but this will vary by how many potatoes you use. Just use enough oil to give the potatoes a nice coat.

4.) Put on a baking sheet (I line mine with tin foil to cut down on clean-up).

5.) Season with dry ingredients, or a combination of seasonings you like.

6.) Cook in the oven for 25-35 minutes at 450 degrees. The potatoes should be tender in the middle when done.

Whole Foods Cake Decorating Class

By | Desserts | No Comments

Having never attended a formal cooking class, I found myself a bit nervous when I arrived at the Whole Foods Culinary Center in downtown Austin, TX.  However, from the moment I walked in, it was quite inviting and smelled delicious!  Cookbooks lined the entry way and a well stocked modern test kitchen was behind a large glass wall for onlookers to see what was the day’s project.  Our friendly teacher Summer Pruett-Gosnay, Pastry Chef owner of Stardust Pastry, made the experience so much fun that I know this definitely won’t be my only class that I’ll take.

The class title was “Icing on the Cake” and the class description promised to teach you techniques to make a beautiful cake. ( Not to mention that I got to take home a piping set and the finished cake just in time for Mother’s Day!)  We started off reviewing a handout with basic recipes for white cake and buttercream icing.

Some interesting things I learned probably had nothing to do with icing a cake but rather random tidbits of knowledge that I want to share with you:

  • Did you know that American recipes call for oil as their main fat versus French recipes that call for butter?  (I guess that would explain why all the cakes in a box ALWAYS call for oil and NEVER call for butter!)
  • If you are making a basic recipe that calls for just flour and you want to make it in a chocolate version you simply do half flour and half cocoa powder. For example of the recipe calls for 2 cups of flour, use 1 cup flour and 1 cup cocoa powder.  It’s THAT easy!  I think that will be very helpful when I’m in search of something to satisfy my chocolate cravings!  Now I can adapt that to make chocolate pancakes, waffles, you name it!!  I’m so excited to learn that trick.
  • When making layered cakes, a trick Summer uses is brushing simple syrup on top of each layer to retain moisture and keep the cake fresher longer.  Who would of thought?!
  • Be aware of the cooking sprays you use.  Be sure to check the ingredients and make sure that there is no silicone in it.  Apparently after it reaches a certain temperature it can turn poisonous!

So if you are wondering, just how do you make a layered cake here’s a quick run down:

1) Bake your desired type of cake and let cool.  It is easier to ice a COLD cake so it’s not a bad idea to plan ahead and bake the cake the day before you plan to decorate it.

2) Take a long serrated knife and shape the top of your cake into a nice flat round surface.  Continue to use the knife to slice your cake into 2 equal halves for your 2 layers.

3) To keep cake moist, brush simple syrup (which is a combination of equal parts water and sugar that’s been boiled and cooled) on top of first layer and then top with frosting.

4) Place 2nd layer on top and repeat process with syrup and frosting.

5) Next, frost the sides of the cake generously.  This is your first coat, so don’t be too concerned with crumbs being visible.  Scrape the edges to get nice clean lines with a Multi-Purpose Pastry Scraper.

6) Then you will add a second coat of frosting that you will spread evenly to make sure it’s presentable.

7) Finally, decorate it as you wish with colored frostings or other cake decor elements.

Here’s my finished product for my first attempt:

Check out pictures of all the cakes on our Facebook page!

Restaurants We Luv: Torchy’s Tacos – Austin, TX

By | Restaurants We Luv | 2 Comments

Starting from humble beginnings, you have to luv the story of Torchy’s Tacos, but we luv their tacos even more. Starting out as a food trailer down on South First, Torchy’s has grown into a must visit Austin establishment.

The menu includes a wide-selection of tacos featuring slow-roasted pork, fried avocado, chicken, steak, tuna and much more. The tacos are moderately priced range from $3.00 to $4.50 (plan on eating at least two). Torchy’s also features award winning salsas that we highly recommend. We haven’t tried every taco on the menu (yet), but we haven’t ever been disappointed with any of our selections.

Just a heads up, if you’re going during a peak eating time be prepared to stand in line. We aren’t the only people in Austin who luv Torchy’s tacos. I think you’ll find they’re well worth the wait.

You can view the full menu online at http://torchystacos.com/food/tacos/.

Green Chile Pork Taco: Baja Shrimp and Fried Avocado Tacos

Best Apple Pie EVER!

By | Desserts | No Comments

So after much persuasion by my fellow peers, I’ve decided to start this blog in an effort to let everyone know about the food in my life. With so much pressure, I thought I’d start with sharing the absolute BEST apple pie recipe I know of,

and its a collection of ideas that was adapted from Food Network, Martha Stewart, and random cook books. Here it goes:

Crust Ingredients
[list]
  • 2 cups all purpose flour
  • 1 tsp. salt
  • 3/4 cup shortening (Crisco works best but you can use butter if you prefer, it’ll be a little heavier)
  • Ice water in a small bowl
[/list] [list type=”numlist”]
  1. Preheat the oven to 375.
  2. In a medium bowl place the flour and salt into it and cut the shortening into the flour using a pastry blender until its the texture of cornmeal. (It doesn’t take very long to get this consistency)
  3. Add one tbsp of ice water and mix into the dough to get it wet.
  4. Keep adding water and mixing one tbsp at a time until the dough is just moist (but not gluey-if you’ve reached this state, you’ve over mixed and added too much water!)
  5. Roll into a big ball and place in the fridge to get cold.
[/list]

While the dough is chilling, start on the filling. You will need:

-3/4 cup all purpose flour

-variety of apples- I like to use 3 large Gold Delicious and 2 large Granny Smith but you can use whatever combo. just make sure to mix up the varieties so you can get sweet and tart flavors combined

-1 cup white sugar

-1 cup brown sugar

-1 tsp cinnamon

-lemon juice

For the filling, I wash, peel, and slice my apples with my Zyliss Easy Slice Mandolin, White (I got it at Ross for real cheap but any kind of food mandolin will work) using the thinnest setting possible. I like to have the apples look like thin potato chips. If you prefer chunks, go for it but I’ve never done it this way. (Too much work!) As I slice the apples, I drizzle lemon juice on top of them so they don’t turn brown quite as quickly. You usually want to have about 6 cups of apples when they are all sliced up. I have invested in a LARGE measuring cup/bowl that I place the apples in and then add the 2 sugars. I mix the apples and sugar with my hands and add the flour & cinnamon and mix until it’s all combined and smells SOO YUMMY! Once you have that done, time for the hard part….

Get the dough from the fridge and divide it into 2 balls. I like to have them be about the same size, but make one a little bigger to be for your top crust. I like to put my dough on a well floured silicon mat on the counter so it’ll be easier to transfer into the pie plate. You will use a well floured rolling pin and roll the dough into a cirle to fit your pie plate (I believe I use a 9 inch plate). This task is very challenging because it’s virtually impossible to roll dough into a perfect cirle, but do not worry, it will be ok. Do your best!! Once you have it rolled as thin as you can go and it’s still in one piece, transfer the dough to the plate (this may be a 2 person process if this is your first time). If you don’t have a silicon mat to just flip over onto the plate, you can try the “roll the dough around the rolling pin and tranfer is to the pie plate” method, but I find this to be very stressful. Be sure to have total coverage for the bottom layer. If one of your edges is lop sided, tear some excess dough from one side of the plate and fill in the empty space. Next, dump your filling into the pie pan. Make sure it is laying flat and not overflowing in the pan because we still need to cover it! Then you will roll the 2nd dough ball into about a 12 inch circle and you will place this on top of the filling. Make sure you trim off the edges or I like to roll mine up and use a fork to make pretty indentions around the edges. (I don’t like to waste the yummy dough) You will then take a knife and cut 4 slits into the top and you will brush the top with a little bit of heavy whipping cream. I then use cinnamon and sugar (the sugar in the raw is my favorite for the top) and sprinkle it on top of the pie.

Cover the pie with aluminum foil and place the pie on a cookie sheet that has edges. (The filling may overflow and spill and its easier to clean the sheet than it is your oven!) Bake the pie for 25 minutes. Remove the foil and then bake for another 35 minutes or until you see it golden brown to your liking. You can serve it warm with ice cream (vanilla pecan is my favorite or cinnamon ice cream is delicious too!). Enjoy!