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

Monthly Archives: April 2011

Quick and Easy Broccoli Slaw

By | Sides | No Comments

When grilling for friends and family, I’m always looking for new side dishes that everyone will enjoy. Sometimes that’s a challenge, especially with broccoli, but everybody seems to love this slaw. Not only is it delicious, it takes about 10 minutes to make.

Ingredients:
[list]
  • 1/4 cup Balsamic Vinegar (you could use red wine vinegar, but we prefer balsamic for the extra flavor)
  • 2 Tablespoons sugar
  • 1 Tablespoon vegetable oil (we use a mix of oil and canola oil)
  • 1 sack of shredded broccoli mix (roughly 16 ounces)
  • 1 teaspoon salt
[/list]
Directions:
[list type=”numlist”]
  1. In a large mixing bowl, mix vinegar with salt and sugar. I’d highly suggest Pyrex mixing bowls with lids for easy prep and storage.
  2. Add your oil and mix again.
  3. Add cabbage to dressing and toss.
  4. Let stand at least 30 minutes. We let ours sit overnight so the broccoli is well marinated.
  5. Mix again before serving.

 

Tia Spring’s Lady Finger Cake

By | Desserts | 4 Comments

Being Portuguese, food is at the center of every family gathering, especially holiday gatherings.  One of my aunt’s signature desserts is always a hit and it’s so simple to make!  She shared her recipe with me and I in turn will share it with you.  You will need:

-4 packages lady fingers (these may be hard to find, I had to go to HEB Plus and ask in the bakery before I could find them!)

-2 packages of cream cheese softened

-16 oz package of heavy whipping cream

-3/4 cup sugar

-1 can crushed pineapple drained

-1 can cherry pie filling or strawberry or fresh strawberries with sugar sprinkled on top (this is your topping)

First, you’ll beat the cream cheese with the sugar until it’s blended.  Add the heavy cream and beat until smooth.

Add the drained crushed pineapple and fold it in gently until it’s well combined.  Set aside.

Next, take a large spring foam pan and line it with lady fingers.

Pour a layer of the cream cheese mixture on top, and then top it with a layer of lady fingers.  Continue to do this until all the cream cheese is used and you have the cream cheese on top.

Cover and refrigerate this overnight to set.  When ready to serve, put the cherries or strawberries on top.

Then remove the side of the spring form pan and serve!

Cindy’s Cinnamon Bread

By | Breakfast, Desserts | 2 Comments

When I got married, I was lucky to receive a homemade cookbook filled with recipes from all of the lovely ladies that came to my bridal shower.  In that cookbook, I have found some of the best recipes ever!  Since this is Easter weekend, and I’m in charge of Easter Brunch at my house right after church, I decided to make this yummy cinnamon bread that the recipe was given to me from my mother in law, Cindy (hence the name!)  I hope you enjoy!

Ingredients for the topping:

-1/2 cup sugar

-1 tbsp cinnamon

Combine and set aside.

Next, you will combine the other dry ingredients which are:

-2 cups of flour

-1/2 tsp salt

-1 tsp baking soda

In another larger bowl, mix together:

-1 egg

-1 cup sugar

-1 tsp. vanilla extract

-1/4 cup canola oil

Next you will need 1 cup of buttermilk (I used low fat buttermilk to try and help make this a LITTLE healthier ;).  You are going to alternate adding and combining to the egg mixture the flour mix and the buttermilk.  When it’s all combined, it’ll look like this:

Now you are ready to pour half of the batter into a 9 X 5 loaf pan and then top with the cinnamon sugar topping.

 

Repeat process until you end up with a nice topping of cinnamon sugar on the very top.  Then, take a knife and swirl it around in the batter.  Bake in a 350 degree preheated oven for 1 hour.

 

Diana’s Top Chef Rice Salad

By | Salads | No Comments

If you don’t know it yet, I’m a HUGE Top Chef fan.  Hence me having all of their cookbooks!  However, there is always something in the recipe that I don’t quite agree with (probably because I’m SO picky) so I tweak it a little bit so I will eat it, and this is inspired from the Top Chef: The Quickfire Cookbook – Antonia’s Rice Salad with Seared Skirt Steak.

To prepare the salad I filled a large salad bowl with my favorites: baby spinach leaves, cherry tomatoes, & thinly sliced onion (you can have as much or as little of this stuff as you want; it’s your base).  Then to it, I usually add any leftover meat we have such as grilled chicken, steak, or shrimp and I cut it into strips.  Next, pick your favorite Uncle Ben’s Ready Rice packet (I LOVE the Garden Vegetable or Rice Pilaf, but John prefers the Uncle Ben’s Ready Rice, Long Grain & Wild Rice, 8.8-Ounce Pouches (Pack of 12); all of them work well!)  and cook in the microwave for 90 seconds and then pour into the salad bowl.  The last part is the BEST.  The magic is in the homemade dressing that you pour on top of all the yummy goodness in the salad bowl.  You will need:

 

-3 tbsp rice vinegar (red wine vinegar works nicely too)

-1/4 tsp salt

-1/2 tsp sugar

-1/3 cup canola oil

-1 bunch of chopped cilantro

You’ll whisk the 1st four ingredients to combine and then stir in the cilantro.  Once that is made, pour it and mix everything together in the salad bowl.  This is such a FAST and easy recipe, this is in my rotation usually once a week too!!  Here’s the outcome using steak:

50% Brownie + 50% Cheesecake = 100% Delicious

By | Desserts | No Comments

My all time favorite cheesecake recipe has to be this Brownie Chocolate Chip cheesecake recipe I found while I was looking for something to make for my brother in law’s birthday. It was such a hit with the family and my co-workers that I decided to share it with you (thank you allrecipes.com; you rock!):

http://allrecipes.com//Recipe/brownie-chocolate-chip-cheesecake/Detail.aspx

Here’s the finished result:

Turkey Taco Cups

By | Taco | 2 Comments

In an effort to eat healthier, I’ve opted to try and substitute ground turkey where I’d normally eat ground beef. Also, I’ve swapped out baby spinach for lettuce to get in some extra vitamins. Those 2 swaps make this healthy dinner/snack a family favorite at my house each week. You’ll need:

-baked tostito scoops
-1 package lean ground turkey
-shredded spinach
-salsa
-diced tomatoes

To make the turkey taco mixture you’ll need to combine the following spices in a small bowl:

-2 tbsp dried onion
-1 tsp chili powder
-1 tsp paprika
-1/4 tsp cumin
-1/2 tsp dried oregano
-1/2 tsp salt
-1/4 tsp garlic powder
-1/8 tsp black pepper

Preheat a large non-stick skillet on medium high heat. Add ground turkey and spices mixture. Cook until well combined and no longer pink. Drain off any excess fat. Place 14 scoops on a plate. Use a tbsp of the turkey mixture to fill each scoop. Top with 1 tsp of your favorite salsa, shredded spinach, and diced tomatoes. Enjoy!!

Turkey Tacos

Sloppy John’s

By | Burgers | No Comments

Sloppy Joes are always a quick go to meal during a busy week. However, this recipe was inspired by my husband John due to his love of BBQ sauce, mustard, and relish, hence the updated name. Here’s a version tailored to his tastes (and probably the best version I’ve ever had!)

You’ll need:

-one package of lean ground turkey (we use the Jennie O 93/7 kind, I found the extra lean gets tough real quick and is not as good)
-one yellow bell pepper diced (or any color really)
-1/2 medium white onion diced
-1 1/4 cup BBQ sauce (the trick we used is to get 2 different sauces, a sweet and a tangy and combine them- in this recipe we used Stubb’s Original and KC Masterpiece Original)
-yellow mustard
-your favorite dill relish
-your favorite hamburger buns (toasted if you like)

To start off, heat a large non stick skillet over medium high heat and then add the turkey and cook until no longer pink. Drain off the excess fat and throw in the onion and pepper and cook until tender.

Then add the BBQ sauces and squirt the mustard in to your liking and combine all the ingredients together.

Lower the heat to medium low and heat through until the sauce stars to simmer. Remove from heat and spoon mixture on top of buns. Add relish and dig in! It’s so easy and yet SOOO YUMMY!!

Easy Egg Bakes

By | Breakfast | One Comment

On the weekends, I love to make a homemade breakfast for my husband and I. However, if you’re like us, we have totally different tastes when it comes to food. I found that this is an easy recipe that can satisfy everyone since you can personalize it the way you’d like. Today we agreed on the filling, but since I don’t like cheese I opted out for mine to be topped with it.

To make 2 servings, you will need:

-3 eggs whisked
-dash of heavy whipping cream or milk to stir into whisked eggs
-2 pieces canadian bacon cut in small cubes (you can use real bacon if you want to or sausage, chicken, turkey etc)
-2 onion slices finely chopped
-6 cherry tomatoes finely chopped
-6 spinach leaves finely shredded
-salt & pepper to taste

The fun thing about cooking is that you can personalize any dish to your liking. The possibilities are endless with this recipe, you can substitute or add pretty much any veggie that you love like mushrooms, peppers, green onions, etc.

Before you add anything into the ramekins be sure you spray with a non stick cooking spray like Pam. It will make clean-up so much easier. Once you have all the ingredients chopped, combine them all in a small mixing bowl and pour into individual ramekins. If you like cheese, sprinkle or place a slice of your favorite cheese on top. For my husband, I used a piece of low fat pepper jack cheese to spice it up a bit. For easy clean up, I put my ramekins in an 8×8 baking dish and placed it in a 350 degree preheated oven and baked for 30-35 minutes. (Or until you place a knife in it, and it comes out clean)

Once it is done, here’s the end result. It goes wonderfully with some hash browns!

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!