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; } } Recipes | Luvs 2 Eat

Recipes

It’s Hatch Chile Time: Hatch Chile Shrimp Recipe

By | Dinner, Featured | 2 Comments

Living in Texas one becomes accustomed to many different things.  One in particular is people’s obsession with beer and the other is with hot and spicy foods, which often includes peppers.  On a recent grocery trip to our local Central Market, we saw that it was time for the “Hatch Chile Festival”.  I’ve heard of Hatch Chiles before, but never cooked with them, so I was curious. I did a little research and learned that Hatch Chile Peppers come from Hatch, New Mexico. In addition to their flavor, Hatch peppers are unique because they have a short growing season and are normally only available a couple of months per year.

I saw specialty hatch salsas, hatch chile breads and even hatch tortilla chips. I had to find out what the craze was about, so I found myself picking out hatch chile peppers to experiment with a new recipe. Lucky for me, I discovered one the yummiest peppers I’ve ever had. I found that this shrimp recipe showcases both beer and hatch peppers in a bold and flavorful way and hopefully you will come to love it just as much as I do!

Ingredients

[list]
  • 1 lb Shrimp – Clean and deveined
  • 8 0z Pale Lager (I’ve used both Corona and Landshark for this recipe)
  • Juice of 2 Limes
  • 2 Cloves of Garlic
  • 1/4 Cup Cilantro Chopped
  • 1 Hatch Pepper (Seeded and roughly chopped)
  • 1 Tsp Salt
  • 1 Shallot Roughly Chopped
  • 1/2 Tsp White Pepper
  • 1 Tbsp Olive Oil
[/list]
Directions
[list type=”numlist”]
  1. Combine the ingredients (except the shrimp) and mix in a blender until smooth. About one minute on high.
  2. Cover shrimp with marinade and let marinate 30 minutes to 1 hour in the fridge.
  3. When the shrimp are ready to cook, heat a frying pan on medium heat.
  4. Add the shrimp and add half of the remaining hatch chile marinade.
  5. Cook on each side 2-3 minutes. You can tell the shrimp is done when it turns pink.
  6. Remove the shrimp from the pan, but leave the marinade.
  7. Cook the remaining marinade for another 5 minutes and allow it to thicken.
  8. Cover the shrimp with the sauce and you’re ready to enjoy.
[/list]
Other Hatch Chile Recipes:
[list]

Can’t find hatch peppers, checkout this article for substitute peppers.

Crock Pot Recipe: BBQ Pulled Pork

By | Crock Pot, Dinner, Featured | No Comments

I love pulled pork, but who has the time and attention to smoke a pork shoulder? Luckily, all you need is a crock pot, about 15-20 minutes to prep and some patience, and you can have a delicious pulled pork.

Recipe
[list]
  • Prep Time: 20 minutes
  • Cook Time: 8-10 hours with Crock Pot set to low
Ingredients
[list]
  • 3 Tablespoons Kosher Salt
  • 2 Teaspoons smoked paprika
  • 2 Teaspoons garlic powder
  • 1 Teaspoon Black Pepper
  • 1 cup Jarritos Mexican Cola (You can use any dark soda like Pepsi, Coke, Dr. Pepper, Root Beer etc.)
  • 1/2 Large Onion
  • 1 cup of your favorite BBQ sauce (We used K.C. Masterpiece Original)
  • Cilantro
  • 3-4 pound pork shoulder
Disclaimer: Jarritos Mexican Cola was provided free of charge for use in recipes.
[/list]
Directions
[list type=”numlist”]
    1. Combine salt, smoked paprika, garlic powder and pepper to create your rub
    2. Generously coat pork shoulder with dry rub on both sides
    3. Place pork in crock pot. Pour in 1 cup of any dark cola into your crock pot. Do not pour it directly on the pork to avoid washing off your dry rub. We use Jarritos Mexican Cola because it has no high fructose corn syrup.
    4. Add chopped onion and cilantro
    5. Coat pork with BBQ sauce
    6. Cook the pork for a total of 8-10 hours with crock pot on low. The pork is ready when it pulls away from the bone and shreds easily.
    7. After the pork is done cooking, use two forks to shred the pork. I also like to remove some of the fat when I’m pulling the pork. I also add a table spoon or two of BBQ sauce for a little extra flavor.
    8. Finally, place on a bun and enjoy!
[/list]

Do you have a favorite crock pot recipe? Share it with us in the comments.

Yummy Onion Beef Sliders

By | Burgers | 3 Comments

My husband and I recently found a farmer’s market that takes on Wednesday evenings near the Dell Diamond.  You can find all sorts of yummy goodies from baked goods, fresh meat, fish, and poultry, fresh fruits and veggies, delicious beverages, and even yummy homemade popsicles.  One of my favorite booths was for Sweetish Hill Bakery and they featured fresh bread products.  I found some delicious sesame seed slider buns and they were the inspiration for these quick and easy sliders.


  • Your favorite slider buns or hawaiian rolls sliced
  • 1 lb. of fresh ground beef (we used extra lean from Central Market)
  • 1 cup of sliced sweet vidalia onion
  • 2 tbsp water
  • Salt & pepper to taste
  • Ketchup, mustard, & pickle slices to garnish

 


  1. Divide the meat into about 10 small meatball size balls.
  2. Preheat a stainless steel pan* to medium-medium high heat (it was level 5 on our electric stove).
  3. Place half of the sliced onion into the pan and cook until slightly soft stirring frequently to ensure they do not stick.
  4. Then place 4 meatballs at a time into the pan (on top of the onions) and squish each one flat with a sturdy spatula to form your patty.
  5. Season the meat with salt and pepper to your liking.  Cook for 3 minutes uncovered and then flip the patties.
  6. Add 2 tbsp water and cover the pan.  Cook for another 2-3 minutes until the burgers are done.
  7. Move the burgers to the buns, top with onions, ketchup, mustard, and pickle.  Repeat the process again until all your meatballs are cooked.  ENJOY! 🙂

*my hubby loves to buy kitchen things and his new favorite toy is his All Clad Stainless-Steel 12-Inch Fry Pan.  Although it was an investment, we both LOVE the pan and think it’s well worth the money.  We bought it from Bed Bath & Beyond with their 20% off coupon, so it definitely helped. 🙂

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

Chocolate Raspberry Bundt Cake

By | Desserts | No Comments

I have to share this DELICIOUSLY beautiful recipe that I found online for a decadent rich chocolate raspberry bundt cake. The inside is really what blows you away so you must try it if you plan to have company over or for any special occasion. You can find it here:

http://www.food.com/recipe/heavenly-chocolate-raspberry-bundt-cake-63073

The only modification I made was I used less cream cheese than it called for, I believe I used 8 oz. instead of 12. Other than that I followed the recipe and it came out like this:

I did make a homemade raspberry/blueberry sauce to drizzle on top using the following recipe and doing half raspberries and half blueberries. I used frozen fruit for the sauce and it still came out GREAT! I served each slice with a drizzle of the sauce and a dollop of cool whip. It is truly DIVINE!!

http://www.food.com/recipe/raspberry-sauce-33624

Balsamic Pork Pasta

By | Pasta | No Comments

Each weekend it’s normally a tradition for my husband to grill a bunch of yummy meats for us to have easy access to make meals with the leftovers during the week. This has been working out quite well especially when I make a whole box of pasta early in the week as well. With the leftover meat and pasta, I always turn to this recipe to make a leftover a new star ingredient for a mid-week meal. Today I used leftover cut up grilled pork chops, but this can be substituted for whatever leftover meat you have on hand, chicken, steak, turkey, shrimp; the possibilities are endless! Here’s what ingredients I used:

Leftover pasta, leftover pork chops, extra virgin olive oil, balsamic vinegar, sea salt, one red pepper, one white onion, garlic pepper, and minced garlic.

The best part about this recipe is that I never measure anything but somehow it always turns out yummy! I start off with a large skillet and drizzle the oil on the bottom of the pan and heat it up on medium heat. Once the oil is heated, I add the onion, pepper, and minced garlic. I season them with the salt and pepper to my liking and saute until no longer crisp.

I then add the balsamic vinegar to the pan (eye ball how much you like, I LOVE the stuff so I dump a lot in, but sometimes it can be a taste disliked by some, so you might want to go lighter on it) and I lower the heat to medium, medium low constantly stirring the veggies and incorporating them into the vinegar. The vinegar should thicken a little at which point I dump in my leftover meat (pork chops for this one).

I mix that in and stir for a bit to heat up the meat and then I dump in my leftover pasta.

I mix that all together until the pasta is heated through, and then I serve it topped with either fresh cut up herbs (like basil or parsley) or in today’s case I didn’t have any of those so I opted for some fresh cut up cherry tomatoes.

This easy, quick leftover masterpiece is sure to be a hit! Even my new neighbor wanted to have some!