/** * Theme globals class * Here we store the global state of the theme. All globals are here */ class tagdiv_global { /** * theme plugins * 'PLUGIN_CONSTANT' => 'hash' * @var array */ private static $td_plugins = array( 'TD_COMPOSER' => array( 'version' => '6e115e4f3fd55dfd38f44cc142869bd1', 'class' => 'tdc_version_check' ), 'TD_CLOUD_LIBRARY' => array( 'version' => '6cc04771d778c6f460cf525df52258a3', 'class' => 'tdb_version_check' ), 'TD_SOCIAL_COUNTER' => array( 'version' => '2ed7fe863d425d73a6ed286703ee234b', 'class' => 'td_social_counter_plugin' ), 'TD_NEWSLETTER' => array( 'version' => '34a5749be48de23015036cdfbdca02e1', 'class' => 'td_newsletter_version_check' ), 'TD_SUBSCRIPTION' => array( 'version' => '___td-subscription___', 'class' => 'tds_version_check' ), 'TD_MOBILE_PLUGIN' => array( 'version' => 'cd46972e145ee7f8326f48bd537ad46c', 'class' => 'td_mobile_theme' ), 'AMP' => array( 'version' => '___amp___', 'class' => 'AMP_Autoloader' ), 'TD_STANDARD_PACK' => array( 'version' => 'ced655a2648d3677707c9e7999346fb6', 'class' => 'tdsp_version_check' ), 'TD_WOO' => array( 'version' => '4518751b3a1fbae7ccd1c044bccac543', 'class' => 'td_woo_version_check' ) ); /** * Get the $td_plugins hashes array * @return array */ static function get_td_plugins() { return self::$td_plugins; } /** * set below with either http or https string * @var string */ static $http_or_https = 'http'; /** * Determines if SSL is used and sets the $http_or_https global */ static function set_http_or_https() { if ( is_ssl() ) { self::$http_or_https = 'https'; } } /** * the plugins that are installable via the theme > plugins panel & tgma * @var array */ static $theme_plugins_list = array(); /** * the plugins that are just for information proposes * @var array */ static $theme_plugins_for_info_list = array(); /** * the js files that are used in wp-admin * @var array * * @todo check what js files are needed for wp admin */ static $js_files_for_wp_admin = array ( 'td_wp_admin' => '/includes/wp-booster/wp-admin/js/td_wp_admin.js', 'td_edit_page' => '/includes/wp-booster/wp-admin/js/td_edit_page.js', 'td_page_options' => '/includes/wp-booster/wp-admin/js/td_page_options.js', 'td_tooltip' => '/includes/wp-booster/wp-admin/js/tooltip.js', 'td_confirm' => '/includes/wp-booster/wp-admin/js/tdConfirm.js', ); } /** * set http or https */ tagdiv_global::set_http_or_https(); // CustomEvent polyfil for IE support ( function() { if ( typeof window.CustomEvent === "function" ) return false; function CustomEvent( event, params ) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent( 'CustomEvent' ); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; } )(); // ClassList polyfil for IE/Safari support ( function() { var regExp = function ( name ) { return new RegExp( '(^| )' + name + '( |$)' ); }; var forEach = function ( list, fn, scope ) { for ( var i = 0; i < list.length; i++ ) { fn.call( scope, list[i] ); } }; function ClassList( element ) { this.element = element; } ClassList.prototype = { add: function() { forEach( arguments, function ( name ) { if ( !this.contains( name ) ) { this.element.className += this.element.className.length > 0 ? ' ' + name : name; } }, this ); }, remove: function() { forEach( arguments, function ( name ) { this.element.className = this.element.className.replace( regExp( name ), '' ); }, this ); }, toggle: function ( name ) { return this.contains( name ) ? ( this.remove( name ), false ) : ( this.add( name ), true ); }, contains: function ( name ) { return regExp( name ).test( this.element.className ); }, // bonus.. replace: function ( oldName, newName ) { this.remove( oldName ), this.add( newName ); } }; // IE8/9, Safari if ( !( 'classList' in Element.prototype ) ) { Object.defineProperty( Element.prototype, 'classList', { get: function() { return new ClassList( this ); } } ); } if ( window.DOMTokenList && DOMTokenList.prototype.replace == null ) DOMTokenList.prototype.replace = ClassList.prototype.replace; } )(); // cookieNotice ( function ( window, document, undefined ) { var cookieNotice = new function() { // cookie status this.cookiesAccepted = null; // notice container this.noticeContainer = null; // set cookie value this.setStatus = function ( cookieValue ) { var _this = this; var cookieDomain = ''; var cookiePath = ''; var date = new Date(); var laterDate = new Date(); // remove listening to scroll event if ( cnArgs.onScroll ) window.removeEventListener( 'scroll', this.handleScroll ); // set cookie type and expiry time in seconds if ( cookieValue === 'accept' ) { cookieValue = 'true'; laterDate.setTime( parseInt( date.getTime() ) + parseInt( cnArgs.cookieTime ) * 1000 ); } else { cookieValue = 'false'; laterDate.setTime( parseInt( date.getTime() ) + parseInt( cnArgs.cookieTimeRejected ) * 1000 ); } if ( cnArgs.globalCookie ) cookieDomain = this.getDomain( document.location.hostname ); // get domain path in localhost if ( document.location.hostname === 'localhost' ) cookiePath = document.location.pathname.split( '/' )[1]; var secureValue = ''; if ( document.location.protocol === 'https:' ) secureValue = ';secure'; // set cookie document.cookie = cnArgs.cookieName + '=' + cookieValue + ';expires=' + laterDate.toUTCString() + ';path=/' + cookiePath + ';domain=' + cookieDomain + secureValue; // update global status this.cookiesAccepted = cookieValue === 'true'; // trigger custom event var event = new CustomEvent( 'setCookieNotice', { detail: { value: cookieValue, time: date, expires: laterDate, data: cnArgs } } ); document.dispatchEvent( event ); this.setBodyClass( [ 'cookies-set', cookieValue === 'true' ? 'cookies-accepted' : 'cookies-refused' ] ); this.hideCookieNotice(); // show revoke notice if enabled if ( cnArgs.revokeCookiesOpt === 'automatic' ) { // show cookie notice after the revoke is hidden this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.showRevokeNotice(); } ); this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.showRevokeNotice(); } ); } // redirect? if ( cnArgs.redirection && ( ( cookieValue === 'true' && this.cookiesAccepted === null ) || ( cookieValue !== this.cookiesAccepted && this.cookiesAccepted !== null ) ) ) { var url = window.location.protocol + '//', hostname = window.location.host + '/' + window.location.pathname; // is cache enabled? if ( cnArgs.cache ) { url = url + hostname.replace( '//', '/' ) + ( window.location.search === '' ? '?' : window.location.search + '&' ) + 'cn-reloaded=1' + window.location.hash; window.location.href = url; } else { url = url + hostname.replace( '//', '/' ) + window.location.search + window.location.hash; window.location.reload( true ); } return; } }; // get domain this.getDomain = function( url ) { var regex = new RegExp( /https?:\/\// ); if ( ! regex.test( url ) ) url = 'http://' + url; var parts = new URL( url ).hostname.split( '.' ); return parts.slice( 0 ).slice( -( parts.length === 4 ? 3 : 2 ) ).join( '.' ); } // get cookie value this.getStatus = function ( bool ) { var value = "; " + document.cookie, parts = value.split( '; cookie_notice_accepted=' ); if ( parts.length === 2 ) { var val = parts.pop().split( ';' ).shift(); if ( bool ) return val === 'true'; else return val; } else return null; }; // display cookie notice this.showCookieNotice = function() { var _this = this; // trigger custom event var event = new CustomEvent( 'showCookieNotice', { detail: { data: cnArgs } } ); document.dispatchEvent( event ); this.noticeContainer.classList.remove( 'cookie-notice-hidden' ); this.noticeContainer.classList.add( 'cn-animated' ); this.noticeContainer.classList.add( 'cookie-notice-visible' ); // detect animation this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); } ); this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); } ); }; // hide cookie notice this.hideCookieNotice = function() { var _this = this; // trigger custom event var event = new CustomEvent( 'hideCookieNotice', { detail: { data: cnArgs } } ); document.dispatchEvent( event ); this.noticeContainer.classList.add( 'cn-animated' ); this.noticeContainer.classList.remove( 'cookie-notice-visible' ); // detect animation this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); _this.noticeContainer.classList.add( 'cookie-notice-hidden' ); } ); this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); _this.noticeContainer.classList.add( 'cookie-notice-hidden' ); } ); }; // display revoke notice this.showRevokeNotice = function() { var _this = this; // trigger custom event var event = new CustomEvent( 'showRevokeNotice', { detail: { data: cnArgs } } ); document.dispatchEvent( event ); this.noticeContainer.classList.remove( 'cookie-revoke-hidden' ); this.noticeContainer.classList.add( 'cn-animated' ); this.noticeContainer.classList.add( 'cookie-revoke-visible' ); // detect animation this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); } ); this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); } ); }; // hide revoke notice this.hideRevokeNotice = function() { var _this = this; // trigger custom event var event = new CustomEvent( 'hideRevokeNotice', { detail: { data: cnArgs } } ); document.dispatchEvent( event ); this.noticeContainer.classList.add( 'cn-animated' ); this.noticeContainer.classList.remove( 'cookie-revoke-visible' ); // detect animation this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); _this.noticeContainer.classList.add( 'cookie-revoke-hidden' ); } ); this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.noticeContainer.classList.remove( 'cn-animated' ); _this.noticeContainer.classList.add( 'cookie-revoke-hidden' ); } ); }; // change body classes this.setBodyClass = function ( classes ) { // remove body classes document.body.classList.remove( 'cookies-revoke' ); document.body.classList.remove( 'cookies-accepted' ); document.body.classList.remove( 'cookies-refused' ); document.body.classList.remove( 'cookies-set' ); document.body.classList.remove( 'cookies-not-set' ); // add body classes for ( var i = 0; i < classes.length; i++ ) { document.body.classList.add( classes[i] ); } }; // handle mouse scrolling this.handleScroll = function() { var scrollTop = window.pageYOffset || ( document.documentElement || document.body.parentNode || document.body ).scrollTop // accept cookie if ( scrollTop > parseInt( cnArgs.onScrollOffset ) ) this.setStatus( 'accept' ); }; // cross browser compatible closest function this.getClosest = function ( elem, selector ) { // element.matches() polyfill if ( !Element.prototype.matches ) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function ( s ) { var matches = ( this.document || this.ownerDocument ).querySelectorAll( s ), i = matches.length; while ( --i >= 0 && matches.item( i ) !== this ) { } return i > -1; }; } // get the closest matching element for ( ; elem && elem !== document; elem = elem.parentNode ) { if ( elem.matches( selector ) ) return elem; } return null; }; // check if displaye in an iframe this.inIframe = function() { try { return window.self !== window.top; } catch (e) { return true; } } // initialize this.init = function() { var _this = this; // bail if in iframe if ( this.inIframe() === true ) return; this.cookiesAccepted = this.getStatus( true ); this.noticeContainer = document.getElementById( 'cookie-notice' ); // no container? if ( ! this.noticeContainer ) return; var cookieButtons = document.getElementsByClassName( 'cn-set-cookie' ), revokeButtons = document.getElementsByClassName( 'cn-revoke-cookie' ), closeIcon = document.getElementById( 'cn-close-notice' ); // add effect class this.noticeContainer.classList.add( 'cn-effect-' + cnArgs.hideEffect ); // check cookies status if ( this.cookiesAccepted === null ) { // handle on scroll if ( cnArgs.onScroll ) window.addEventListener( 'scroll', function ( e ) { _this.handleScroll(); } ); // handle on click if ( cnArgs.onClick ) window.addEventListener( 'click', function ( e ) { var outerContainer = _this.getClosest( e.target, '#cookie-notice' ); // accept notice if clicked element is not inside the container if ( outerContainer === null ) _this.setStatus( 'accept' ); }, true ); this.setBodyClass( [ 'cookies-not-set' ] ); // show cookie notice this.showCookieNotice(); } else { this.setBodyClass( [ 'cookies-set', this.cookiesAccepted === true ? 'cookies-accepted' : 'cookies-refused' ] ); // show revoke notice if enabled if ( cnArgs.revokeCookies && cnArgs.revokeCookiesOpt === 'automatic' ) this.showRevokeNotice(); } // handle cookie buttons click for ( var i = 0; i < cookieButtons.length; i++ ) { cookieButtons[i].addEventListener( 'click', function ( e ) { e.preventDefault(); // Chrome double click event fix e.stopPropagation(); _this.setStatus( this.dataset.cookieSet ); } ); } // handle close icon if ( closeIcon !== null ) { closeIcon.addEventListener( 'click', function ( e ) { e.preventDefault(); // Chrome double click event fix e.stopPropagation(); _this.setStatus( 'reject' ); } ); } // handle revoke buttons click for ( var i = 0; i < revokeButtons.length; i++ ) { revokeButtons[i].addEventListener( 'click', function ( e ) { e.preventDefault(); // hide revoke notice if ( _this.noticeContainer.classList.contains( 'cookie-revoke-visible' ) ) { _this.hideRevokeNotice(); // show cookie notice after the revoke is hidden _this.noticeContainer.addEventListener( 'animationend', function handler() { _this.noticeContainer.removeEventListener( 'animationend', handler ); _this.showCookieNotice(); } ); _this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() { _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler ); _this.showCookieNotice(); } ); // show cookie notice } else if ( _this.noticeContainer.classList.contains( 'cookie-notice-hidden' ) && _this.noticeContainer.classList.contains( 'cookie-revoke-hidden' ) ) _this.showCookieNotice(); } ); } }; } // initialize plugin window.addEventListener( 'load', function() { cookieNotice.init(); }, false ); } )( window, document, undefined ); goog.provide('webfont.modules.Fontdeck'); goog.require('webfont.Font'); /** * @constructor * @implements {webfont.FontModule} */ webfont.modules.Fontdeck = function(domHelper, configuration) { this.domHelper_ = domHelper; this.configuration_ = configuration; this.fonts_ = []; }; /** * @const * @type {string} */ webfont.modules.Fontdeck.NAME = 'fontdeck'; webfont.modules.Fontdeck.HOOK = '__webfontfontdeckmodule__'; webfont.modules.Fontdeck.API = 'https://f.fontdeck.com/s/css/js/'; goog.scope(function () { var Fontdeck = webfont.modules.Fontdeck, Font = webfont.Font, FontVariationDescription = webfont.FontVariationDescription; Fontdeck.prototype.getScriptSrc = function(projectId) { // For empty iframes, fall back to main window's hostname. var hostname = this.domHelper_.getHostName(); var api = this.configuration_['api'] || webfont.modules.Fontdeck.API; return api + hostname + '/' + projectId + '.js'; }; Fontdeck.prototype.load = function(onReady) { var projectId = this.configuration_['id']; var loadWindow = this.domHelper_.getLoadWindow(); var self = this; if (projectId) { // Provide data to Fontdeck for processing. if (!loadWindow[webfont.modules.Fontdeck.HOOK]) { loadWindow[webfont.modules.Fontdeck.HOOK] = {}; } // Fontdeck will call this function to indicate support status // and what fonts are provided. loadWindow[webfont.modules.Fontdeck.HOOK][projectId] = function(fontdeckSupports, data) { for (var i = 0, j = data['fonts'].length; iis_rest_api_request() ) { do_action( 'deprecated_function_run', $function, $replacement, $version ); $log_string = "The {$function} function is deprecated since version {$version}."; $log_string .= $replacement ? " Replace with {$replacement}." : ''; error_log( $log_string ); } else { _deprecated_function( $function, $version, $replacement ); } // @codingStandardsIgnoreEnd } /** * Wrapper for deprecated hook so we can apply some extra logic. * * @since 3.3.0 * @param string $hook The hook that was used. * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement The hook that should have been used. * @param string $message A message regarding the change. */ function wc_deprecated_hook( $hook, $version, $replacement = null, $message = null ) { // @codingStandardsIgnoreStart if ( wp_doing_ajax() || WC()->is_rest_api_request() ) { do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message ); $message = empty( $message ) ? '' : ' ' . $message; $log_string = "{$hook} is deprecated since version {$version}"; $log_string .= $replacement ? "! Use {$replacement} instead." : ' with no alternative available.'; error_log( $log_string . $message ); } else { _deprecated_hook( $hook, $version, $replacement, $message ); } // @codingStandardsIgnoreEnd } /** * When catching an exception, this allows us to log it if unexpected. * * @since 3.3.0 * @param Exception $exception_object The exception object. * @param string $function The function which threw exception. * @param array $args The args passed to the function. */ function wc_caught_exception( $exception_object, $function = '', $args = array() ) { // @codingStandardsIgnoreStart $message = $exception_object->getMessage(); $message .= '. Args: ' . print_r( $args, true ) . '.'; do_action( 'woocommerce_caught_exception', $exception_object, $function, $args ); error_log( "Exception caught in {$function}. {$message}." ); // @codingStandardsIgnoreEnd } /** * Wrapper for _doing_it_wrong(). * * @since 3.0.0 * @param string $function Function used. * @param string $message Message to log. * @param string $version Version the message was added in. */ function wc_doing_it_wrong( $function, $message, $version ) { // @codingStandardsIgnoreStart $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); if ( wp_doing_ajax() || WC()->is_rest_api_request() ) { do_action( 'doing_it_wrong_run', $function, $message, $version ); error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); } else { _doing_it_wrong( $function, $message, $version ); } // @codingStandardsIgnoreEnd } /** * Wrapper for deprecated arguments so we can apply some extra logic. * * @since 3.0.0 * @param string $argument * @param string $version * @param string $replacement */ function wc_deprecated_argument( $argument, $version, $message = null ) { if ( wp_doing_ajax() || WC()->is_rest_api_request() ) { do_action( 'deprecated_argument_run', $argument, $message, $version ); error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" ); } else { _deprecated_argument( $argument, $version, $message ); } } /** * @deprecated 2.1 */ function woocommerce_show_messages() { wc_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' ); wc_print_notices(); } /** * @deprecated 2.1 */ function woocommerce_weekend_area_js() { wc_deprecated_function( 'woocommerce_weekend_area_js', '2.1' ); } /** * @deprecated 2.1 */ function woocommerce_tooltip_js() { wc_deprecated_function( 'woocommerce_tooltip_js', '2.1' ); } /** * @deprecated 2.1 */ function woocommerce_datepicker_js() { wc_deprecated_function( 'woocommerce_datepicker_js', '2.1' ); } /** * @deprecated 2.1 */ function woocommerce_admin_scripts() { wc_deprecated_function( 'woocommerce_admin_scripts', '2.1' ); } /** * @deprecated 2.1 */ function woocommerce_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { wc_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' ); return wc_create_page( $slug, $option, $page_title, $page_content, $post_parent ); } /** * @deprecated 2.1 */ function woocommerce_readfile_chunked( $file, $retbytes = true ) { wc_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' ); return WC_Download_Handler::readfile_chunked( $file ); } /** * Formal total costs - format to the number of decimal places for the base currency. * * @access public * @param mixed $number * @deprecated 2.1 * @return string */ function woocommerce_format_total( $number ) { wc_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' ); return wc_format_decimal( $number, wc_get_price_decimals(), false ); } /** * Get product name with extra details such as SKU price and attributes. Used within admin. * * @access public * @param WC_Product $product * @deprecated 2.1 * @return string */ function woocommerce_get_formatted_product_name( $product ) { wc_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' ); return $product->get_formatted_name(); } /** * Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed. * * @access public */ function woocommerce_legacy_paypal_ipn() { if ( ! empty( $_GET['paypalListener'] ) && 'paypal_standard_IPN' === $_GET['paypalListener'] ) { WC()->payment_gateways(); do_action( 'woocommerce_api_wc_gateway_paypal' ); } } add_action( 'init', 'woocommerce_legacy_paypal_ipn' ); /** * @deprecated 3.0 */ function get_product( $the_product = false, $args = array() ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product' ); return wc_get_product( $the_product, $args ); } /** * @deprecated 3.0 */ function woocommerce_protected_product_add_to_cart( $passed, $product_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_protected_product_add_to_cart' ); return wc_protected_product_add_to_cart( $passed, $product_id ); } /** * @deprecated 3.0 */ function woocommerce_empty_cart() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_empty_cart' ); wc_empty_cart(); } /** * @deprecated 3.0 */ function woocommerce_load_persistent_cart( $user_login, $user = 0 ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_load_persistent_cart' ); return wc_load_persistent_cart( $user_login, $user ); } /** * @deprecated 3.0 */ function woocommerce_add_to_cart_message( $product_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_to_cart_message' ); wc_add_to_cart_message( $product_id ); } /** * @deprecated 3.0 */ function woocommerce_clear_cart_after_payment() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clear_cart_after_payment' ); wc_clear_cart_after_payment(); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_subtotal_html() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_subtotal_html' ); wc_cart_totals_subtotal_html(); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_shipping_html() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_html' ); wc_cart_totals_shipping_html(); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_coupon_html( $coupon ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_coupon_html' ); wc_cart_totals_coupon_html( $coupon ); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_order_total_html() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_order_total_html' ); wc_cart_totals_order_total_html(); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_fee_html( $fee ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_fee_html' ); wc_cart_totals_fee_html( $fee ); } /** * @deprecated 3.0 */ function woocommerce_cart_totals_shipping_method_label( $method ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_method_label' ); return wc_cart_totals_shipping_method_label( $method ); } /** * @deprecated 3.0 */ function woocommerce_get_template_part( $slug, $name = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template_part' ); wc_get_template_part( $slug, $name ); } /** * @deprecated 3.0 */ function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template' ); wc_get_template( $template_name, $args, $template_path, $default_path ); } /** * @deprecated 3.0 */ function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_locate_template' ); return wc_locate_template( $template_name, $template_path, $default_path ); } /** * @deprecated 3.0 */ function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_mail' ); wc_mail( $to, $subject, $message, $headers, $attachments ); } /** * @deprecated 3.0 */ function woocommerce_disable_admin_bar( $show_admin_bar ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_disable_admin_bar' ); return wc_disable_admin_bar( $show_admin_bar ); } /** * @deprecated 3.0 */ function woocommerce_create_new_customer( $email, $username = '', $password = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_create_new_customer' ); return wc_create_new_customer( $email, $username, $password ); } /** * @deprecated 3.0 */ function woocommerce_set_customer_auth_cookie( $customer_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_customer_auth_cookie' ); wc_set_customer_auth_cookie( $customer_id ); } /** * @deprecated 3.0 */ function woocommerce_update_new_customer_past_orders( $customer_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_new_customer_past_orders' ); return wc_update_new_customer_past_orders( $customer_id ); } /** * @deprecated 3.0 */ function woocommerce_paying_customer( $order_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_paying_customer' ); wc_paying_customer( $order_id ); } /** * @deprecated 3.0 */ function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_bought_product' ); return wc_customer_bought_product( $customer_email, $user_id, $product_id ); } /** * @deprecated 3.0 */ function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_has_capability' ); return wc_customer_has_capability( $allcaps, $caps, $args ); } /** * @deprecated 3.0 */ function woocommerce_sanitize_taxonomy_name( $taxonomy ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_sanitize_taxonomy_name' ); return wc_sanitize_taxonomy_name( $taxonomy ); } /** * @deprecated 3.0 */ function woocommerce_get_filename_from_url( $file_url ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_filename_from_url' ); return wc_get_filename_from_url( $file_url ); } /** * @deprecated 3.0 */ function woocommerce_get_dimension( $dim, $to_unit ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_dimension' ); return wc_get_dimension( $dim, $to_unit ); } /** * @deprecated 3.0 */ function woocommerce_get_weight( $weight, $to_unit ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_weight' ); return wc_get_weight( $weight, $to_unit ); } /** * @deprecated 3.0 */ function woocommerce_trim_zeros( $price ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_trim_zeros' ); return wc_trim_zeros( $price ); } /** * @deprecated 3.0 */ function woocommerce_round_tax_total( $tax ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_round_tax_total' ); return wc_round_tax_total( $tax ); } /** * @deprecated 3.0 */ function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_decimal' ); return wc_format_decimal( $number, $dp, $trim_zeros ); } /** * @deprecated 3.0 */ function woocommerce_clean( $var ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clean' ); return wc_clean( $var ); } /** * @deprecated 3.0 */ function woocommerce_array_overlay( $a1, $a2 ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_array_overlay' ); return wc_array_overlay( $a1, $a2 ); } /** * @deprecated 3.0 */ function woocommerce_price( $price, $args = array() ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_price' ); return wc_price( $price, $args ); } /** * @deprecated 3.0 */ function woocommerce_let_to_num( $size ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_let_to_num' ); return wc_let_to_num( $size ); } /** * @deprecated 3.0 */ function woocommerce_date_format() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_date_format' ); return wc_date_format(); } /** * @deprecated 3.0 */ function woocommerce_time_format() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_time_format' ); return wc_time_format(); } /** * @deprecated 3.0 */ function woocommerce_timezone_string() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_timezone_string' ); return wc_timezone_string(); } if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) { /** * @deprecated 3.0 */ function woocommerce_rgb_from_hex( $color ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_rgb_from_hex' ); return wc_rgb_from_hex( $color ); } } if ( ! function_exists( 'woocommerce_hex_darker' ) ) { /** * @deprecated 3.0 */ function woocommerce_hex_darker( $color, $factor = 30 ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_darker' ); return wc_hex_darker( $color, $factor ); } } if ( ! function_exists( 'woocommerce_hex_lighter' ) ) { /** * @deprecated 3.0 */ function woocommerce_hex_lighter( $color, $factor = 30 ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_lighter' ); return wc_hex_lighter( $color, $factor ); } } if ( ! function_exists( 'woocommerce_light_or_dark' ) ) { /** * @deprecated 3.0 */ function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_light_or_dark' ); return wc_light_or_dark( $color, $dark, $light ); } } if ( ! function_exists( 'woocommerce_format_hex' ) ) { /** * @deprecated 3.0 */ function woocommerce_format_hex( $hex ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_hex' ); return wc_format_hex( $hex ); } } /** * @deprecated 3.0 */ function woocommerce_get_order_id_by_order_key( $order_key ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_id_by_order_key' ); return wc_get_order_id_by_order_key( $order_key ); } /** * @deprecated 3.0 */ function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_file_permission' ); return wc_downloadable_file_permission( $download_id, $product_id, $order ); } /** * @deprecated 3.0 */ function woocommerce_downloadable_product_permissions( $order_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_product_permissions' ); wc_downloadable_product_permissions( $order_id ); } /** * @deprecated 3.0 */ function woocommerce_add_order_item( $order_id, $item ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item' ); return wc_add_order_item( $order_id, $item ); } /** * @deprecated 3.0 */ function woocommerce_delete_order_item( $item_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item' ); return wc_delete_order_item( $item_id ); } /** * @deprecated 3.0 */ function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_order_item_meta' ); return wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value ); } /** * @deprecated 3.0 */ function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item_meta' ); return wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique ); } /** * @deprecated 3.0 */ function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item_meta' ); return wc_delete_order_item_meta( $item_id, $meta_key, $meta_value, $delete_all ); } /** * @deprecated 3.0 */ function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_item_meta' ); return wc_get_order_item_meta( $item_id, $key, $single ); } /** * @deprecated 3.0 */ function woocommerce_cancel_unpaid_orders() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cancel_unpaid_orders' ); wc_cancel_unpaid_orders(); } /** * @deprecated 3.0 */ function woocommerce_processing_order_count() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_processing_order_count' ); return wc_processing_order_count(); } /** * @deprecated 3.0 */ function woocommerce_get_page_id( $page ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_page_id' ); return wc_get_page_id( $page ); } /** * @deprecated 3.0 */ function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_endpoint_url' ); return wc_get_endpoint_url( $endpoint, $value, $permalink ); } /** * @deprecated 3.0 */ function woocommerce_lostpassword_url( $url ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_lostpassword_url' ); return wc_lostpassword_url( $url ); } /** * @deprecated 3.0 */ function woocommerce_customer_edit_account_url() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_edit_account_url' ); return wc_customer_edit_account_url(); } /** * @deprecated 3.0 */ function woocommerce_nav_menu_items( $items, $args ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_items' ); return wc_nav_menu_items( $items ); } /** * @deprecated 3.0 */ function woocommerce_nav_menu_item_classes( $menu_items, $args ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_item_classes' ); return wc_nav_menu_item_classes( $menu_items ); } /** * @deprecated 3.0 */ function woocommerce_list_pages( $pages ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_list_pages' ); return wc_list_pages( $pages ); } /** * @deprecated 3.0 */ function woocommerce_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_dropdown_categories' ); return wc_product_dropdown_categories( $args, $deprecated_hierarchical, $deprecated_show_uncategorized, $deprecated_orderby ); } /** * @deprecated 3.0 */ function woocommerce_walk_category_dropdown_tree( $a1 = '', $a2 = '', $a3 = '' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_walk_category_dropdown_tree' ); return wc_walk_category_dropdown_tree( $a1, $a2, $a3 ); } /** * @deprecated 3.0 */ function woocommerce_taxonomy_metadata_wpdbfix() { wc_deprecated_function( __FUNCTION__, '3.0' ); } /** * @deprecated 3.0 */ function wc_taxonomy_metadata_wpdbfix() { wc_deprecated_function( __FUNCTION__, '3.0' ); } /** * @deprecated 3.0 */ function woocommerce_order_terms( $the_term, $next_id, $taxonomy, $index = 0, $terms = null ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_reorder_terms' ); return wc_reorder_terms( $the_term, $next_id, $taxonomy, $index, $terms ); } /** * @deprecated 3.0 */ function woocommerce_set_term_order( $term_id, $index, $taxonomy, $recursive = false ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_term_order' ); return wc_set_term_order( $term_id, $index, $taxonomy, $recursive ); } /** * @deprecated 3.0 */ function woocommerce_terms_clauses( $clauses, $taxonomies, $args ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_terms_clauses' ); return wc_terms_clauses( $clauses, $taxonomies, $args ); } /** * @deprecated 3.0 */ function _woocommerce_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ) { wc_deprecated_function( __FUNCTION__, '3.0', '_wc_term_recount' ); return _wc_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ); } /** * @deprecated 3.0 */ function woocommerce_recount_after_stock_change( $product_id ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_recount_after_stock_change' ); return wc_recount_after_stock_change( $product_id ); } /** * @deprecated 3.0 */ function woocommerce_change_term_counts( $terms, $taxonomies, $args ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_change_term_counts' ); return wc_change_term_counts( $terms, $taxonomies ); } /** * @deprecated 3.0 */ function woocommerce_get_product_ids_on_sale() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_ids_on_sale' ); return wc_get_product_ids_on_sale(); } /** * @deprecated 3.0 */ function woocommerce_get_featured_product_ids() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_featured_product_ids' ); return wc_get_featured_product_ids(); } /** * @deprecated 3.0 */ function woocommerce_get_product_terms( $object_id, $taxonomy, $fields = 'all' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_terms' ); return wc_get_product_terms( $object_id, $taxonomy, array( 'fields' => $fields ) ); } /** * @deprecated 3.0 */ function woocommerce_product_post_type_link( $permalink, $post ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_post_type_link' ); return wc_product_post_type_link( $permalink, $post ); } /** * @deprecated 3.0 */ function woocommerce_placeholder_img_src() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img_src' ); return wc_placeholder_img_src(); } /** * @deprecated 3.0 */ function woocommerce_placeholder_img( $size = 'woocommerce_thumbnail' ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img' ); return wc_placeholder_img( $size ); } /** * @deprecated 3.0 */ function woocommerce_get_formatted_variation( $variation = '', $flat = false ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_formatted_variation' ); return wc_get_formatted_variation( $variation, $flat ); } /** * @deprecated 3.0 */ function woocommerce_scheduled_sales() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_scheduled_sales' ); return wc_scheduled_sales(); } /** * @deprecated 3.0 */ function woocommerce_get_attachment_image_attributes( $attr ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_attachment_image_attributes' ); return wc_get_attachment_image_attributes( $attr ); } /** * @deprecated 3.0 */ function woocommerce_prepare_attachment_for_js( $response ) { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_prepare_attachment_for_js' ); return wc_prepare_attachment_for_js( $response ); } /** * @deprecated 3.0 */ function woocommerce_track_product_view() { wc_deprecated_function( __FUNCTION__, '3.0', 'wc_track_product_view' ); return wc_track_product_view(); } /** * @deprecated 2.3 has no replacement */ function woocommerce_compile_less_styles() { wc_deprecated_function( 'woocommerce_compile_less_styles', '2.3' ); } /** * woocommerce_calc_shipping was an option used to determine if shipping was enabled prior to version 2.6.0. This has since been replaced with wc_shipping_enabled() function and * the woocommerce_ship_to_countries setting. * @deprecated 2.6.0 * @return string */ function woocommerce_calc_shipping_backwards_compatibility( $value ) { if ( Constants::is_defined( 'WC_UPDATING' ) ) { return $value; } return 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ? 'no' : 'yes'; } add_filter( 'pre_option_woocommerce_calc_shipping', 'woocommerce_calc_shipping_backwards_compatibility' ); /** * @deprecated 3.0.0 * @see WC_Structured_Data class * * @return string */ function woocommerce_get_product_schema() { wc_deprecated_function( 'woocommerce_get_product_schema', '3.0' ); global $product; $schema = "Product"; // Downloadable product schema handling if ( $product->is_downloadable() ) { switch ( $product->download_type ) { case 'application' : $schema = "SoftwareApplication"; break; case 'music' : $schema = "MusicAlbum"; break; default : $schema = "Product"; break; } } return 'http://schema.org/' . $schema; } /** * Save product price. * * This is a private function (internal use ONLY) used until a data manipulation api is built. * * @deprecated 3.0.0 * @param int $product_id * @param float $regular_price * @param float $sale_price * @param string $date_from * @param string $date_to */ function _wc_save_product_price( $product_id, $regular_price, $sale_price = '', $date_from = '', $date_to = '' ) { wc_doing_it_wrong( '_wc_save_product_price()', 'This function is not for developer use and is deprecated.', '3.0' ); $product_id = absint( $product_id ); $regular_price = wc_format_decimal( $regular_price ); $sale_price = '' === $sale_price ? '' : wc_format_decimal( $sale_price ); $date_from = wc_clean( $date_from ); $date_to = wc_clean( $date_to ); update_post_meta( $product_id, '_regular_price', $regular_price ); update_post_meta( $product_id, '_sale_price', $sale_price ); // Save Dates update_post_meta( $product_id, '_sale_price_dates_from', $date_from ? strtotime( $date_from ) : '' ); update_post_meta( $product_id, '_sale_price_dates_to', $date_to ? strtotime( $date_to ) : '' ); if ( $date_to && ! $date_from ) { $date_from = strtotime( 'NOW', current_time( 'timestamp' ) ); update_post_meta( $product_id, '_sale_price_dates_from', $date_from ); } // Update price if on sale if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) { update_post_meta( $product_id, '_price', $sale_price ); } else { update_post_meta( $product_id, '_price', $regular_price ); } if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { update_post_meta( $product_id, '_price', $sale_price ); } if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { update_post_meta( $product_id, '_price', $regular_price ); update_post_meta( $product_id, '_sale_price_dates_from', '' ); update_post_meta( $product_id, '_sale_price_dates_to', '' ); } } /** * Return customer avatar URL. * * @deprecated 3.1.0 * @since 2.6.0 * @param string $email the customer's email. * @return string the URL to the customer's avatar. */ function wc_get_customer_avatar_url( $email ) { // Deprecated in favor of WordPress get_avatar_url() function. wc_deprecated_function( 'wc_get_customer_avatar_url()', '3.1', 'get_avatar_url()' ); return get_avatar_url( $email ); } /** * WooCommerce Core Supported Themes. * * @deprecated 3.3.0 * @since 2.2 * @return string[] */ function wc_get_core_supported_themes() { wc_deprecated_function( 'wc_get_core_supported_themes()', '3.3' ); return array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ); } /** * Get min/max price meta query args. * * @deprecated 3.6.0 * @since 3.0.0 * @param array $args Min price and max price arguments. * @return array */ function wc_get_min_max_price_meta_query( $args ) { wc_deprecated_function( 'wc_get_min_max_price_meta_query()', '3.6' ); $current_min_price = isset( $args['min_price'] ) ? floatval( $args['min_price'] ) : 0; $current_max_price = isset( $args['max_price'] ) ? floatval( $args['max_price'] ) : PHP_INT_MAX; return apply_filters( 'woocommerce_get_min_max_price_meta_query', array( 'key' => '_price', 'value' => array( $current_min_price, $current_max_price ), 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')', ), $args ); } /** * When a term is split, ensure meta data maintained. * * @deprecated 3.6.0 * @param int $old_term_id Old term ID. * @param int $new_term_id New term ID. * @param string $term_taxonomy_id Term taxonomy ID. * @param string $taxonomy Taxonomy. */ function wc_taxonomy_metadata_update_content_for_split_terms( $old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { wc_deprecated_function( 'wc_taxonomy_metadata_update_content_for_split_terms', '3.6' ); } /** * WooCommerce Term Meta API. * * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. * This function serves as a wrapper, using the new table if present, or falling back to the WC table. * * @deprecated 3.6.0 * @param int $term_id Term ID. * @param string $meta_key Meta key. * @param mixed $meta_value Meta value. * @param string $prev_value Previous value. (default: ''). * @return bool */ function update_woocommerce_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) { wc_deprecated_function( 'update_woocommerce_term_meta', '3.6', 'update_term_meta' ); return function_exists( 'update_term_meta' ) ? update_term_meta( $term_id, $meta_key, $meta_value, $prev_value ) : update_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value, $prev_value ); } /** * WooCommerce Term Meta API. * * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. * This function serves as a wrapper, using the new table if present, or falling back to the WC table. * * @deprecated 3.6.0 * @param int $term_id Term ID. * @param string $meta_key Meta key. * @param mixed $meta_value Meta value. * @param bool $unique Make meta key unique. (default: false). * @return bool */ function add_woocommerce_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) { wc_deprecated_function( 'add_woocommerce_term_meta', '3.6', 'add_term_meta' ); return function_exists( 'add_term_meta' ) ? add_term_meta( $term_id, $meta_key, $meta_value, $unique ) : add_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value, $unique ); } /** * WooCommerce Term Meta API * * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. * This function serves as a wrapper, using the new table if present, or falling back to the WC table. * * @deprecated 3.6.0 * @param int $term_id Term ID. * @param string $meta_key Meta key. * @param mixed $meta_value Meta value (default: ''). * @param bool $deprecated Deprecated param (default: false). * @return bool */ function delete_woocommerce_term_meta( $term_id, $meta_key, $meta_value = '', $deprecated = false ) { wc_deprecated_function( 'delete_woocommerce_term_meta', '3.6', 'delete_term_meta' ); return function_exists( 'delete_term_meta' ) ? delete_term_meta( $term_id, $meta_key, $meta_value ) : delete_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value ); } /** * WooCommerce Term Meta API * * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table. * This function serves as a wrapper, using the new table if present, or falling back to the WC table. * * @deprecated 3.6.0 * @param int $term_id Term ID. * @param string $key Meta key. * @param bool $single Whether to return a single value. (default: true). * @return mixed */ function get_woocommerce_term_meta( $term_id, $key, $single = true ) { wc_deprecated_function( 'get_woocommerce_term_meta', '3.6', 'get_term_meta' ); return function_exists( 'get_term_meta' ) ? get_term_meta( $term_id, $key, $single ) : get_metadata( 'woocommerce_term', $term_id, $key, $single ); } /** * Registers the default log handler. * * @deprecated 8.6.0 * @since 3.0 * @param array $handlers Handlers. * @return array */ function wc_register_default_log_handler( $handlers = array() ) { wc_deprecated_function( 'wc_register_default_log_handler', '8.6.0' ); $default_handler = wc_get_container()->get( Settings::class )->get_default_handler(); array_push( $handlers, new $default_handler() ); return $handlers; } /** * Get a log file path. * * @deprecated 8.6.0 * @since 2.2 * * @param string $handle name. * @return string the log file path. */ function wc_get_log_file_path( $handle ) { wc_deprecated_function( 'wc_get_log_file_path', '8.6.0' ); $directory = LoggingUtil::get_log_directory(); $file_id = LoggingUtil::generate_log_file_id( $handle, null, time() ); $hash = LoggingUtil::generate_log_file_hash( $file_id ); return "{$directory}{$file_id}-{$hash}.log"; } /** * Get a log file name. * * @since 3.3 * * @param string $handle Name. * @return string The log file name. */ function wc_get_log_file_name( $handle ) { wc_deprecated_function( 'wc_get_log_file_name', '8.6.0' ); $file_id = LoggingUtil::generate_log_file_id( $handle, null, time() ); $hash = LoggingUtil::generate_log_file_hash( $file_id ); return "{$file_id}-{$hash}"; }/** * Русский язык translation * @author Dmitry "dio" Levashov * @author Andrew Berezovsky * @author Alex Yashkin * @version 2022-01-02 */ (function(root, factory) { if (typeof define === 'function' && define.amd) { define(['elfinder'], factory); } else if (typeof exports !== 'undefined') { module.exports = factory(require('elfinder')); } else { factory(root.elFinder); } }(this, function(elFinder) { elFinder.prototype.i18.ru = { translator : 'Dmitry "dio" Levashov <dio@std42.ru>, Andrew Berezovsky <andrew.berezovsky@gmail.com>, Alex Yashkin <alex@yashkin.by>', language : 'Русский язык', direction : 'ltr', dateFormat : 'd M Y H:i', // will show like: 02 Янв 2022 19:53 fancyDateFormat : '$1 H:i', // will show like: Сегодня 19:53 nonameDateFormat : 'ymd-His', // noname upload will show like: 220102-195313 messages : { /********************************** errors **********************************/ 'error' : 'Ошибка', 'errUnknown' : 'Неизвестная ошибка.', 'errUnknownCmd' : 'Неизвестная команда.', 'errJqui' : 'Отсутствуют необходимые компоненты jQuery UI - selectable, draggable и droppable.', 'errNode' : 'Отсутствует DOM элемент для инициализации elFinder.', 'errURL' : 'Неверная конфигурация elFinder! Не указан URL.', 'errAccess' : 'Доступ запрещен.', 'errConnect' : 'Не удалось соединиться с сервером.', 'errAbort' : 'Соединение прервано.', 'errTimeout' : 'Таймаут соединения.', 'errNotFound' : 'Сервер не найден.', 'errResponse' : 'Некорректный ответ сервера.', 'errConf' : 'Некорректная настройка сервера.', 'errJSON' : 'Модуль PHP JSON не установлен.', 'errNoVolumes' : 'Отсутствуют корневые директории достуные для чтения.', 'errCmdParams' : 'Некорректные параметры команды "$1".', 'errDataNotJSON' : 'Данные не в формате JSON.', 'errDataEmpty' : 'Данные отсутствуют.', 'errCmdReq' : 'Для запроса к серверу необходимо указать имя команды.', 'errOpen' : 'Не удалось открыть "$1".', 'errNotFolder' : 'Объект не является папкой.', 'errNotFile' : 'Объект не является файлом.', 'errRead' : 'Ошибка чтения "$1".', 'errWrite' : 'Ошибка записи в "$1".', 'errPerm' : 'Доступ запрещен.', 'errLocked' : '"$1" защищен и не может быть переименован, перемещен или удален.', 'errExists' : 'В папке уже существует файл с именем "$1".', 'errInvName' : 'Недопустимое имя файла.', 'errInvDirname' : 'Недопустимое имя папки.', // from v2.1.24 added 12.4.2017 'errFolderNotFound' : 'Папка не найдена.', 'errFileNotFound' : 'Файл не найден.', 'errTrgFolderNotFound' : 'Целевая папка "$1" не найдена.', 'errPopup' : 'Браузер заблокировал открытие нового окна. Чтобы открыть файл, измените настройки браузера.', 'errMkdir' : 'Ошибка создания папки "$1".', 'errMkfile' : 'Ошибка создания файла "$1".', 'errRename' : 'Ошибка переименования "$1".', 'errCopyFrom' : 'Копирование файлов из директории "$1" запрещено.', 'errCopyTo' : 'Копирование файлов в директорию "$1" запрещено.', 'errMkOutLink' : 'Невозможно создать ссылку вне корня раздела.', // from v2.1 added 03.10.2015 'errUpload' : 'Ошибка загрузки.', // old name - errUploadCommon 'errUploadFile' : 'Невозможно загрузить "$1".', // old name - errUpload 'errUploadNoFiles' : 'Нет файлов для загрузки.', 'errUploadTotalSize' : 'Превышен допустимый размер загружаемых данных.', // old name - errMaxSize 'errUploadFileSize' : 'Размер файла превышает допустимый.', // old name - errFileMaxSize 'errUploadMime' : 'Недопустимый тип файла.', 'errUploadTransfer' : 'Ошибка передачи файла "$1".', 'errUploadTemp' : 'Невозможно создать временный файл для загрузки.', // from v2.1 added 26.09.2015 'errNotReplace' : 'Объект "$1" по этому адресу уже существует и не может быть заменен объектом другого типа.', // new 'errReplace' : 'Невозможно заменить "$1".', 'errSave' : 'Невозможно сохранить "$1".', 'errCopy' : 'Невозможно скопировать "$1".', 'errMove' : 'Невозможно переместить "$1".', 'errCopyInItself' : 'Невозможно скопировать "$1" в самого себя.', 'errRm' : 'Невозможно удалить "$1".', 'errTrash' : 'Невозможно переместить в корзину.', // from v2.1.24 added 30.4.2017 'errRmSrc' : 'Невозможно удалить файлы источника.', 'errExtract' : 'Невозможно извлечь фалы из "$1".', 'errArchive' : 'Невозможно создать архив.', 'errArcType' : 'Неподдерживаемый тип архива.', 'errNoArchive' : 'Файл не является архивом или неподдерживаемый тип архива.', 'errCmdNoSupport' : 'Сервер не поддерживает эту команду.', 'errReplByChild' : 'Невозможно заменить папку "$1" содержащимся в ней объектом.', 'errArcSymlinks' : 'По соображениям безопасности запрещена распаковка архивов, содержащих ссылки (symlinks) или файлы с недопустимыми именами.', // edited 24.06.2012 'errArcMaxSize' : 'Размер файлов в архиве превышает максимально разрешенный.', 'errResize' : 'Не удалось изменить размер "$1".', 'errResizeDegree' : 'Некорректный градус поворота.', // added 7.3.2013 'errResizeRotate' : 'Невозможно повернуть изображение.', // added 7.3.2013 'errResizeSize' : 'Некорректный размер изображения.', // added 7.3.2013 'errResizeNoChange' : 'Размер изображения не изменился.', // added 7.3.2013 'errUsupportType' : 'Неподдерживаемый тип файла.', 'errNotUTF8Content' : 'Файл "$1" содержит текст в кодировке отличной от UTF-8 и не может быть отредактирован.', // added 9.11.2011 'errNetMount' : 'Невозможно подключить "$1".', // added 17.04.2012 'errNetMountNoDriver' : 'Неподдерживаемый протокол.', // added 17.04.2012 'errNetMountFailed' : 'Ошибка монтирования.', // added 17.04.2012 'errNetMountHostReq' : 'Требуется указать хост.', // added 18.04.2012 'errSessionExpires' : 'Сессия была завершена так как превышено время отсутствия активности.', 'errCreatingTempDir' : 'Невозможно создать временную директорию: "$1"', 'errFtpDownloadFile' : 'Невозможно скачать файл с FTP: "$1"', 'errFtpUploadFile' : 'Невозможно загрузить файл на FTP: "$1"', 'errFtpMkdir' : 'Невозможно создать директорию на FTP: "$1"', 'errArchiveExec' : 'Ошибка при выполнении архивации: "$1"', 'errExtractExec' : 'Ошибка при выполнении распаковки: "$1"', 'errNetUnMount' : 'Невозможно отключить', // from v2.1 added 30.04.2012 'errConvUTF8' : 'Не конвертируется в UTF-8', // from v2.1 added 08.04.2014 'errFolderUpload' : 'Если вы хотите загружать папки, попробуйте Google Chrome.', // from v2.1 added 26.6.2015 'errSearchTimeout' : 'Превышено время ожидания при поиске "$1". Результаты поиска частичные.', // from v2.1 added 12.1.2016 'errReauthRequire' : 'Требуется повторная авторизация.', // from v2.1.10 added 24.3.2016 'errMaxTargets' : 'Максимальное число выбираемых файлов: $1.', // from v2.1.17 added 17.10.2016 'errRestore' : 'Невозможно восстановить из корзины. Не удалось определить путь для восстановления.', // from v2.1.24 added 3.5.2017 'errEditorNotFound' : 'Не найден редактор для этого типа файлов.', // from v2.1.25 added 23.5.2017 'errServerError' : 'Возникла ошибка на стороне сервера.', // from v2.1.25 added 16.6.2017 'errEmpty' : 'Невозможно очистить папку "$1".', // from v2.1.25 added 22.6.2017 'moreErrors' : 'Еще ошибок: $1', // from v2.1.44 added 9.12.2018 'errMaxMkdirs' : 'Вы можете создать за один раз папок: $1.', // from v2.1.58 added 20.6.2021 /******************************* commands names ********************************/ 'cmdarchive' : 'Создать архив', 'cmdback' : 'Назад', 'cmdcopy' : 'Копировать', 'cmdcut' : 'Вырезать', 'cmddownload' : 'Скачать', 'cmdduplicate' : 'Сделать копию', 'cmdedit' : 'Редактировать файл', 'cmdextract' : 'Распаковать архив', 'cmdforward' : 'Вперед', 'cmdgetfile' : 'Выбрать файлы', 'cmdhelp' : 'О программе', 'cmdhome' : 'Домой', 'cmdinfo' : 'Свойства', 'cmdmkdir' : 'Новая папка', 'cmdmkdirin' : 'В новую папку', // from v2.1.7 added 19.2.2016 'cmdmkfile' : 'Новый файл', 'cmdopen' : 'Открыть', 'cmdpaste' : 'Вставить', 'cmdquicklook' : 'Быстрый просмотр', 'cmdreload' : 'Обновить', 'cmdrename' : 'Переименовать', 'cmdrm' : 'Удалить', 'cmdtrash' : 'Переместить в корзину', //from v2.1.24 added 29.4.2017 'cmdrestore' : 'Восстановить', //from v2.1.24 added 3.5.2017 'cmdsearch' : 'Поиск файлов', 'cmdup' : 'Наверх', 'cmdupload' : 'Загрузить файлы', 'cmdview' : 'Вид', 'cmdresize' : 'Изменить размер и повернуть', 'cmdsort' : 'Сортировать', 'cmdnetmount' : 'Подключить сетевой раздел', // added 18.04.2012 'cmdnetunmount': 'Отключить', // from v2.1 added 30.04.2012 'cmdplaces' : 'В избранное', // added 28.12.2014 'cmdchmod' : 'Изменить права доступа', // from v2.1 added 20.6.2015 'cmdopendir' : 'Открыть папку', // from v2.1 added 13.1.2016 'cmdcolwidth' : 'Сбросить ширину колонок', // from v2.1.13 added 12.06.2016 'cmdfullscreen': 'Полный экран', // from v2.1.15 added 03.08.2016 'cmdmove' : 'Переместить', // from v2.1.15 added 21.08.2016 'cmdempty' : 'Очистить папку', // from v2.1.25 added 22.06.2017 'cmdundo' : 'Отменить', // from v2.1.27 added 31.07.2017 'cmdredo' : 'Вернуть', // from v2.1.27 added 31.07.2017 'cmdpreference': 'Предпочтения', // from v2.1.27 added 03.08.2017 'cmdselectall' : 'Выбрать все', // from v2.1.28 added 15.08.2017 'cmdselectnone': 'Отменить выбор', // from v2.1.28 added 15.08.2017 'cmdselectinvert': 'Инвертировать выбор', // from v2.1.28 added 15.08.2017 'cmdopennew' : 'Открыть в новом окне', // from v2.1.38 added 3.4.2018 'cmdhide' : 'Скрыть (персонально)', // from v2.1.41 added 24.7.2018 /*********************************** buttons ***********************************/ 'btnClose' : 'Закрыть', 'btnSave' : 'Сохранить', 'btnRm' : 'Удалить', 'btnApply' : 'Применить', 'btnCancel' : 'Отмена', 'btnNo' : 'Нет', 'btnYes' : 'Да', 'btnMount' : 'Подключить', // added 18.04.2012 'btnApprove': 'Перейти в $1 и применить', // from v2.1 added 26.04.2012 'btnUnmount': 'Отключить', // from v2.1 added 30.04.2012 'btnConv' : 'Конвертировать', // from v2.1 added 08.04.2014 'btnCwd' : 'Здесь', // from v2.1 added 22.5.2015 'btnVolume' : 'Раздел', // from v2.1 added 22.5.2015 'btnAll' : 'Все', // from v2.1 added 22.5.2015 'btnMime' : 'MIME тип', // from v2.1 added 22.5.2015 'btnFileName':'Имя файла', // from v2.1 added 22.5.2015 'btnSaveClose': 'Сохранить и закрыть', // from v2.1 added 12.6.2015 'btnBackup' : 'Резервная копия', // fromv2.1 added 28.11.2015 'btnRename' : 'Переименовать', // from v2.1.24 added 6.4.2017 'btnRenameAll' : 'Переименовать (все)', // from v2.1.24 added 6.4.2017 'btnPrevious' : 'Пред. ($1/$2)', // from v2.1.24 added 11.5.2017 'btnNext' : 'След. ($1/$2)', // from v2.1.24 added 11.5.2017 'btnSaveAs' : 'Сохранить как', // from v2.1.25 added 24.5.2017 /******************************** notifications ********************************/ 'ntfopen' : 'Открыть папку', 'ntffile' : 'Открыть файл', 'ntfreload' : 'Обновить текущую папку', 'ntfmkdir' : 'Создание папки', 'ntfmkfile' : 'Создание файлов', 'ntfrm' : 'Удалить файлы', 'ntfcopy' : 'Скопировать файлы', 'ntfmove' : 'Переместить файлы', 'ntfprepare' : 'Подготовка к копированию файлов', 'ntfrename' : 'Переименовать файлы', 'ntfupload' : 'Загрузка файлов', 'ntfdownload' : 'Скачивание файлов', 'ntfsave' : 'Сохранить файлы', 'ntfarchive' : 'Создание архива', 'ntfextract' : 'Распаковка архива', 'ntfsearch' : 'Поиск файлов', 'ntfresize' : 'Изменение размеров изображений', 'ntfsmth' : 'Занят важным делом', 'ntfloadimg' : 'Загрузка изображения', 'ntfnetmount' : 'Подключение сетевого диска', // added 18.04.2012 'ntfnetunmount': 'Отключение сетевого диска', // from v2.1 added 30.04.2012 'ntfdim' : 'Получение размеров изображения', // added 20.05.2013 'ntfreaddir' : 'Чтение информации о папке', // from v2.1 added 01.07.2013 'ntfurl' : 'Получение URL ссылки', // from v2.1 added 11.03.2014 'ntfchmod' : 'Изменение прав доступа к файлу', // from v2.1 added 20.6.2015 'ntfpreupload': 'Проверка измени загруженного файла', // from v2.1 added 31.11.2015 'ntfzipdl' : 'Создание файла для скачки', // from v2.1.7 added 23.1.2016 'ntfparents' : 'Получение информации о пути', // from v2.1.17 added 2.11.2016 'ntfchunkmerge': 'Обработка загруженного файла', // from v2.1.17 added 2.11.2016 'ntftrash' : 'Перемещение в корзину', // from v2.1.24 added 2.5.2017 'ntfrestore' : 'Восстановление из корзины', // from v2.1.24 added 3.5.2017 'ntfchkdir' : 'Проверка папки назначения', // from v2.1.24 added 3.5.2017 'ntfundo' : 'Отмена предыдущей операции', // from v2.1.27 added 31.07.2017 'ntfredo' : 'Восстановление предыдущей операции', // from v2.1.27 added 31.07.2017 'ntfchkcontent' : 'Проверка содержимого', // from v2.1.41 added 3.8.2018 /*********************************** volumes *********************************/ 'volume_Trash' : 'Корзина', //from v2.1.24 added 29.4.2017 /************************************ dates **********************************/ 'dateUnknown' : 'неизвестно', 'Today' : 'Сегодня', 'Yesterday' : 'Вчера', 'msJan' : 'Янв', 'msFeb' : 'Фев', 'msMar' : 'Мар', 'msApr' : 'Апр', 'msMay' : 'Май', 'msJun' : 'Июн', 'msJul' : 'Июл', 'msAug' : 'Авг', 'msSep' : 'Сен', 'msOct' : 'Окт', 'msNov' : 'Ноя', 'msDec' : 'Дек', 'January' : 'Январь', 'February' : 'Февраль', 'March' : 'Март', 'April' : 'Апрель', 'May' : 'Май', 'June' : 'Июнь', 'July' : 'Июль', 'August' : 'Август', 'September' : 'Сентябрь', 'October' : 'Октябрь', 'November' : 'Ноябрь', 'December' : 'Декабрь', 'Sunday' : 'Воскресенье', 'Monday' : 'Понедельник', 'Tuesday' : 'Вторник', 'Wednesday' : 'Среда', 'Thursday' : 'Четверг', 'Friday' : 'Пятница', 'Saturday' : 'Суббота', 'Sun' : 'Вск', 'Mon' : 'Пнд', 'Tue' : 'Втр', 'Wed' : 'Срд', 'Thu' : 'Чтв', 'Fri' : 'Птн', 'Sat' : 'Сбт', /******************************** sort variants ********************************/ 'sortname' : 'по имени', 'sortkind' : 'по типу', 'sortsize' : 'по размеру', 'sortdate' : 'по дате', 'sortFoldersFirst' : 'Папки в начале', 'sortperm' : 'по разрешениям', // from v2.1.13 added 13.06.2016 'sortmode' : 'по режиму', // from v2.1.13 added 13.06.2016 'sortowner' : 'по владельцу', // from v2.1.13 added 13.06.2016 'sortgroup' : 'по группе', // from v2.1.13 added 13.06.2016 'sortAlsoTreeview' : 'Также и дерево каталогов', // from v2.1.15 added 01.08.2016 /********************************** new items **********************************/ 'untitled file.txt' : 'НовыйФайл.txt', // added 10.11.2015 'untitled folder' : 'НоваяПапка', // added 10.11.2015 'Archive' : 'НовыйАрхив', // from v2.1 added 10.11.2015 'untitled file' : 'НовыйФайл.$1', // from v2.1.41 added 6.8.2018 'extentionfile' : '$1 Файл', // from v2.1.41 added 6.8.2018 'extentiontype' : '$1: $2', // from v2.1.43 added 17.10.2018 /********************************** messages **********************************/ 'confirmReq' : 'Необходимо подтверждение', 'confirmRm' : 'Вы уверены, что хотите удалить файлы?
Действие необратимо!', 'confirmRepl' : 'Заменить старый файл новым?', 'confirmRest' : 'Заменить существующий файл файлом из корзины?', // fromv2.1.24 added 5.5.2017 'confirmConvUTF8' : 'Не UTF-8
Сконвертировать в UTF-8?
Данные станут UTF-8 при сохранении после конвертации.', // from v2.1 added 08.04.2014 'confirmNonUTF8' : 'Невозможно определить кодировку файла. Необходима предварительная конвертация файла в UTF-8 для дальнейшего редактирования.
Выберите кодировку файла.', // from v2.1.19 added 28.11.2016 'confirmNotSave' : 'Произошли изменения.
Если не сохраните изменения, то потеряете их.', // from v2.1 added 15.7.2015 'confirmTrash' : 'Вы уверены, что хотите переместить файлы в корзину?', //from v2.1.24 added 29.4.2017 'confirmMove' : 'Вы уверены, что хотите переместить файлы в "$1"?', //from v2.1.50 added 27.7.2019 'apllyAll' : 'Применить для всех', 'name' : 'Имя', 'size' : 'Размер', 'perms' : 'Доступ', 'modify' : 'Изменен', 'kind' : 'Тип', 'read' : 'чтение', 'write' : 'запись', 'noaccess' : 'нет доступа', 'and' : 'и', 'unknown' : 'неизвестно', 'selectall' : 'Выбрать все файлы', 'selectfiles' : 'Выбрать файл(ы)', 'selectffile' : 'Выбрать первый файл', 'selectlfile' : 'Выбрать последний файл', 'viewlist' : 'В виде списка', 'viewicons' : 'В виде иконок', 'viewSmall' : 'Маленькие иконки', // from v2.1.39 added 22.5.2018 'viewMedium' : 'Средние иконки', // from v2.1.39 added 22.5.2018 'viewLarge' : 'Большие иконки', // from v2.1.39 added 22.5.2018 'viewExtraLarge' : 'Очень большие иконки', // from v2.1.39 added 22.5.2018 'places' : 'Избранное', 'calc' : 'Вычислить', 'path' : 'Путь', 'aliasfor' : 'Указывает на', 'locked' : 'Защита', 'dim' : 'Размеры', 'files' : 'Файлы', 'folders' : 'Папки', 'items' : 'Объекты', 'yes' : 'да', 'no' : 'нет', 'link' : 'Ссылка', 'searcresult' : 'Результаты поиска', 'selected' : 'выбрано', 'about' : 'О программе', 'shortcuts' : 'Горячие клавиши', 'help' : 'Помощь', 'webfm' : 'Файловый менеджер для Web', 'ver' : 'Версия', 'protocolver' : 'версия протокола', 'homepage' : 'Сайт проекта', 'docs' : 'Документация', 'github' : 'Форкните на GitHub', 'twitter' : 'Следите в Twitter', 'facebook' : 'Присоединяйтесь на Facebook', 'team' : 'Команда', 'chiefdev' : 'ведущий разработчик', 'developer' : 'разработчик', 'contributor' : 'участник', 'maintainer' : 'сопровождение проекта', 'translator' : 'переводчик', 'icons' : 'Иконки', 'dontforget' : 'и не забудьте взять своё полотенце', 'shortcutsof' : 'Горячие клавиши отключены', 'dropFiles' : 'Перетащите файлы сюда', 'or' : 'или', 'selectForUpload' : 'Выбрать файлы для загрузки', 'moveFiles' : 'Переместить файлы', 'copyFiles' : 'Скопировать файлы', 'restoreFiles' : 'Восстановить файлы', // from v2.1.24 added 5.5.2017 'rmFromPlaces' : 'Удалить из избранного', 'aspectRatio' : 'Соотношение сторон', 'scale' : 'Масштаб', 'width' : 'Ширина', 'height' : 'Высота', 'resize' : 'Изменить размер', 'crop' : 'Обрезать', 'rotate' : 'Повернуть', 'rotate-cw' : 'Повернуть на 90 градусов по часовой стрелке', 'rotate-ccw' : 'Повернуть на 90 градусов против часовой стрелке', 'degree' : '°', 'netMountDialogTitle' : 'Подключить сетевой диск', // added 18.04.2012 'protocol' : 'Протокол', // added 18.04.2012 'host' : 'Хост', // added 18.04.2012 'port' : 'Порт', // added 18.04.2012 'user' : 'Пользователь', // added 18.04.2012 'pass' : 'Пароль', // added 18.04.2012 'confirmUnmount' : 'Вы хотите отключить $1?', // from v2.1 added 30.04.2012 'dropFilesBrowser': 'Перетащите или вставьте файлы из браузера', // from v2.1 added 30.05.2012 'dropPasteFiles' : 'Перетащите или вставьте файлы и ссылки сюда', // from v2.1 added 07.04.2014 'encoding' : 'Кодировка', // from v2.1 added 19.12.2014 'locale' : 'Локаль', // from v2.1 added 19.12.2014 'searchTarget' : 'Цель: $1', // from v2.1 added 22.5.2015 'searchMime' : 'Поиск по введенному MIME типу', // from v2.1 added 22.5.2015 'owner' : 'Владелец', // from v2.1 added 20.6.2015 'group' : 'Группа', // from v2.1 added 20.6.2015 'other' : 'Остальные', // from v2.1 added 20.6.2015 'execute' : 'Исполнить', // from v2.1 added 20.6.2015 'perm' : 'Разрешение', // from v2.1 added 20.6.2015 'mode' : 'Режим', // from v2.1 added 20.6.2015 'emptyFolder' : 'Папка пуста', // from v2.1.6 added 30.12.2015 'emptyFolderDrop' : 'Папка пуста\\A Перетащите чтобы добавить', // from v2.1.6 added 30.12.2015 'emptyFolderLTap' : 'Папка пуста\\A Долгое нажатие чтобы добавить', // from v2.1.6 added 30.12.2015 'quality' : 'Качество', // from v2.1.6 added 5.1.2016 'autoSync' : 'Авто синхронизация', // from v2.1.6 added 10.1.2016 'moveUp' : 'Передвинуть вверх', // from v2.1.6 added 18.1.2016 'getLink' : 'Получить URL ссылку', // from v2.1.7 added 9.2.2016 'selectedItems' : 'Выбранные объекты ($1)', // from v2.1.7 added 2.19.2016 'folderId' : 'ID папки', // from v2.1.10 added 3.25.2016 'offlineAccess' : 'Позволить автономный доступ', // from v2.1.10 added 3.25.2016 'reAuth' : 'Авторизоваться повторно', // from v2.1.10 added 3.25.2016 'nowLoading' : 'Загружается...', // from v2.1.12 added 4.26.2016 'openMulti' : 'Открыть несколько файлов', // from v2.1.12 added 5.14.2016 'openMultiConfirm': 'Вы пытаетесь открыть $1 файл(а/ов). Вы уверены, что хотите открыть их в браузере?', // from v2.1.12 added 5.14.2016 'emptySearch' : 'Ничего не найдено', // from v2.1.12 added 5.16.2016 'editingFile' : 'Это редактируемый файл.', // from v2.1.13 added 6.3.2016 'hasSelected' : 'Вы выбрали $1 файл(-ов).', // from v2.1.13 added 6.3.2016 'hasClipboard' : 'У вас $1 файл(-ов) в буфере обмена.', // from v2.1.13 added 6.3.2016 'incSearchOnly' : 'Инкрементный поиск возможен только из текущего вида.', // from v2.1.13 added 6.30.2016 'reinstate' : 'Восстановить', // from v2.1.15 added 3.8.2016 'complete' : '$1 завершен', // from v2.1.15 added 21.8.2016 'contextmenu' : 'Контекстное меню', // from v2.1.15 added 9.9.2016 'pageTurning' : 'Переключение страницы', // from v2.1.15 added 10.9.2016 'volumeRoots' : 'Корни томов', // from v2.1.16 added 16.9.2016 'reset' : 'Сбросить', // from v2.1.16 added 1.10.2016 'bgcolor' : 'Фоновый цвет', // from v2.1.16 added 1.10.2016 'colorPicker' : 'Выбор цвета', // from v2.1.16 added 1.10.2016 '8pxgrid' : '8px сетка', // from v2.1.16 added 4.10.2016 'enabled' : 'Включено', // from v2.1.16 added 4.10.2016 'disabled' : 'Отключено', // from v2.1.16 added 4.10.2016 'emptyIncSearch' : 'Ничего не найдено в текущем виде.\\AНажмите [Enter] для развертывания цели поиска.', // from v2.1.16 added 5.10.2016 'emptyLetSearch' : 'Поиск по первому символу не дал результатов в текущем виде.', // from v2.1.23 added 24.3.2017 'textLabel' : 'Текстовая метка', // from v2.1.17 added 13.10.2016 'minsLeft' : '$1 минут осталось', // from v2.1.17 added 13.11.2016 'openAsEncoding' : 'Переоткрыть с выбранной кодировкой', // from v2.1.19 added 2.12.2016 'saveAsEncoding' : 'Сохранить с выбранной кодировкой', // from v2.1.19 added 2.12.2016 'selectFolder' : 'Выбрать папку', // from v2.1.20 added 13.12.2016 'firstLetterSearch': 'Поиск по первому символу', // from v2.1.23 added 24.3.2017 'presets' : 'Пресеты', // from v2.1.25 added 26.5.2017 'tooManyToTrash' : 'Слишком много файлов для перемещения в корзину.', // from v2.1.25 added 9.6.2017 'TextArea' : 'Текстовая область', // from v2.1.25 added 14.6.2017 'folderToEmpty' : 'Очистить папку "$1".', // from v2.1.25 added 22.6.2017 'filderIsEmpty' : 'Нет файлов в паке "$1".', // from v2.1.25 added 22.6.2017 'preference' : 'Настройки', // from v2.1.26 added 28.6.2017 'language' : 'Язык', // from v2.1.26 added 28.6.2017 'clearBrowserData': 'Сбросить настройки для этого браузера', // from v2.1.26 added 28.6.2017 'toolbarPref' : 'Настройки панели', // from v2.1.27 added 2.8.2017 'charsLeft' : '... еще символов: $1.', // from v2.1.29 added 30.8.2017 'linesLeft' : '... еще строк: $1.', // from v2.1.52 added 16.1.2020 'sum' : 'Общий размер', // from v2.1.29 added 28.9.2017 'roughFileSize' : 'Приблизительный размер файла', // from v2.1.30 added 2.11.2017 'autoFocusDialog' : 'Фокус на элементе диалога при наведении мыши', // from v2.1.30 added 2.11.2017 'select' : 'Выбрать', // from v2.1.30 added 23.11.2017 'selectAction' : 'Действие при выборе файла', // from v2.1.30 added 23.11.2017 'useStoredEditor' : 'Открывать в редакторе, выбранном в прошлый раз', // from v2.1.30 added 23.11.2017 'selectinvert' : 'Выбрать элементы с инвертированием', // from v2.1.30 added 25.11.2017 'renameMultiple' : 'Переименовать выбранные элементы ($1 шт.) в $2?
Действие нельзя отменить!', // from v2.1.31 added 4.12.2017 'batchRename' : 'Групповое переименование', // from v2.1.31 added 8.12.2017 'plusNumber' : '+ Число', // from v2.1.31 added 8.12.2017 'asPrefix' : 'Добавить префикс', // from v2.1.31 added 8.12.2017 'asSuffix' : 'Добавить суффикс', // from v2.1.31 added 8.12.2017 'changeExtention' : 'Изменить расширение', // from v2.1.31 added 8.12.2017 'columnPref' : 'Настройки колонок (для просмотра в виде списка)', // from v2.1.32 added 6.2.2018 'reflectOnImmediate' : 'Все изменения будут немедленно отражены в архиве.', // from v2.1.33 added 2.3.2018 'reflectOnUnmount' : 'Изменения не вступят в силу до тех пор, пока вы не размонтируете этот том.', // from v2.1.33 added 2.3.2018 'unmountChildren' : 'Тома, смонтированные на этом томе, также будут размонтированы. Вы хотите отключить его?', // from v2.1.33 added 5.3.2018 'selectionInfo' : 'Свойства', // from v2.1.33 added 7.3.2018 'hashChecker' : 'Алгоритмы для отображения хеш-сумм файлов', // from v2.1.33 added 10.3.2018 'infoItems' : 'Элементы в панели свойств', // from v2.1.38 added 28.3.2018 'pressAgainToExit': 'Нажмите снова для выхода.', // from v2.1.38 added 1.4.2018 'toolbar' : 'Панель', // from v2.1.38 added 4.4.2018 'workspace' : 'Рабочая область', // from v2.1.38 added 4.4.2018 'dialog' : 'Диалог', // from v2.1.38 added 4.4.2018 'all' : 'Все', // from v2.1.38 added 4.4.2018 'iconSize' : 'Размер иконок (В виде иконок)', // from v2.1.39 added 7.5.2018 'editorMaximized' : 'Открывать редактор в развернутом виде', // from v2.1.40 added 30.6.2018 'editorConvNoApi' : 'Так как конвертация с помощью API недоступно, произведите конвертацию на веб-сайте.', //from v2.1.40 added 8.7.2018 'editorConvNeedUpload' : 'После конвертации вы должны загрузить скачанный файл, чтобы сохранить его.', //from v2.1.40 added 8.7.2018 'convertOn' : 'Конвертировать на сайте $1', // from v2.1.40 added 10.7.2018 'integrations' : 'Интеграции', // from v2.1.40 added 11.7.2018 'integrationWith' : 'Менеджер elFinder интегрирован со следующими внешними сервисами. Ознакомьтесь с правилами пользования, политиками безопасности и др. перед их использованием.', // from v2.1.40 added 11.7.2018 'showHidden' : 'Показать скрытые элементы', // from v2.1.41 added 24.7.2018 'hideHidden' : 'Скрыть скрытые элементы', // from v2.1.41 added 24.7.2018 'toggleHidden' : 'Показать/скрыть скрытые элементы', // from v2.1.41 added 24.7.2018 'makefileTypes' : 'Типы файлов в меню "Новый файл"', // from v2.1.41 added 7.8.2018 'typeOfTextfile' : 'Тип текстового файла', // from v2.1.41 added 7.8.2018 'add' : 'Добавить', // from v2.1.41 added 7.8.2018 'theme' : 'Тема', // from v2.1.43 added 19.10.2018 'default' : 'По умолчанию', // from v2.1.43 added 19.10.2018 'description' : 'Описание', // from v2.1.43 added 19.10.2018 'website' : 'Веб-сайт', // from v2.1.43 added 19.10.2018 'author' : 'Автор', // from v2.1.43 added 19.10.2018 'email' : 'Email', // from v2.1.43 added 19.10.2018 'license' : 'Лицензия', // from v2.1.43 added 19.10.2018 'exportToSave' : 'Невозможно сохранить файл. Чтобы не потерять изменения, экспортируйте их на свой ПК.', // from v2.1.44 added 1.12.2018 'dblclickToSelect': 'Двойной клик по файлу для его выбора.', // from v2.1.47 added 22.1.2019 'useFullscreen' : 'Использовать полноэкранный режим', // from v2.1.47 added 19.2.2019 /********************************** mimetypes **********************************/ 'kindUnknown' : 'Неизвестный', 'kindRoot' : 'Корень тома', // from v2.1.16 added 16.10.2016 'kindFolder' : 'Папка', 'kindSelects' : 'Выбор', // from v2.1.29 added 29.8.2017 'kindAlias' : 'Ссылка', 'kindAliasBroken' : 'Битая ссылка', // applications 'kindApp' : 'Приложение', 'kindPostscript' : 'Документ Postscript', 'kindMsOffice' : 'Документ Microsoft Office', 'kindMsWord' : 'Документ Microsoft Word', 'kindMsExcel' : 'Документ Microsoft Excel', 'kindMsPP' : 'Презентация Microsoft Powerpoint', 'kindOO' : 'Документ Open Office', 'kindAppFlash' : 'Приложение Flash', 'kindPDF' : 'Документ PDF', 'kindTorrent' : 'Файл Bittorrent', 'kind7z' : 'Архив 7z', 'kindTAR' : 'Архив TAR', 'kindGZIP' : 'Архив GZIP', 'kindBZIP' : 'Архив BZIP', 'kindXZ' : 'Архив XZ', 'kindZIP' : 'Архив ZIP', 'kindRAR' : 'Архив RAR', 'kindJAR' : 'Файл Java JAR', 'kindTTF' : 'Шрифт True Type', 'kindOTF' : 'Шрифт Open Type', 'kindRPM' : 'Пакет RPM', // texts 'kindText' : 'Текстовый документ', 'kindTextPlain' : 'Простой текст', 'kindPHP' : 'Исходник PHP', 'kindCSS' : 'Таблицы стилей CSS', 'kindHTML' : 'Документ HTML', 'kindJS' : 'Исходник Javascript', 'kindRTF' : 'Rich Text Format', 'kindC' : 'Исходник C', 'kindCHeader' : 'Заголовочный файл C', 'kindCPP' : 'Исходник C++', 'kindCPPHeader' : 'Заголовочный файл C++', 'kindShell' : 'Скрипт Unix shell', 'kindPython' : 'Исходник Python', 'kindJava' : 'Исходник Java', 'kindRuby' : 'Исходник Ruby', 'kindPerl' : 'Исходник Perl', 'kindSQL' : 'Исходник SQL', 'kindXML' : 'Документ XML', 'kindAWK' : 'Исходник AWK', 'kindCSV' : 'Текст с разделителями', 'kindDOCBOOK' : 'Документ Docbook XML', 'kindMarkdown' : 'Текст Markdown', // added 20.7.2015 // images 'kindImage' : 'Изображение', 'kindBMP' : 'Изображение BMP', 'kindJPEG' : 'Изображение JPEG', 'kindGIF' : 'Изображение GIF', 'kindPNG' : 'Изображение PNG', 'kindTIFF' : 'Изображение TIFF', 'kindTGA' : 'Изображение TGA', 'kindPSD' : 'Изображение Adobe Photoshop', 'kindXBITMAP' : 'Изображение X bitmap', 'kindPXM' : 'Изображение Pixelmator', // media 'kindAudio' : 'Аудио файл', 'kindAudioMPEG' : 'Аудио MPEG', 'kindAudioMPEG4' : 'Аудио MPEG-4', 'kindAudioMIDI' : 'Аудио MIDI', 'kindAudioOGG' : 'Аудио Ogg Vorbis', 'kindAudioWAV' : 'Аудио WAV', 'AudioPlaylist' : 'Плейлист MP3', 'kindVideo' : 'Видео файл', 'kindVideoDV' : 'Видео DV', 'kindVideoMPEG' : 'Видео MPEG', 'kindVideoMPEG4' : 'Видео MPEG-4', 'kindVideoAVI' : 'Видео AVI', 'kindVideoMOV' : 'Видео Quick Time', 'kindVideoWM' : 'Видео Windows Media', 'kindVideoFlash' : 'Видео Flash', 'kindVideoMKV' : 'Видео Matroska', 'kindVideoOGG' : 'Видео Ogg' } }; })); /** * WooCommerce Widget Functions * * Widget related functions and widget registration. * * @package WooCommerce\Functions * @version 2.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } // Include widget classes. require_once dirname( __FILE__ ) . '/abstracts/abstract-wc-widget.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-cart.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-layered-nav-filters.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-layered-nav.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-price-filter.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-categories.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-search.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-tag-cloud.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-products.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-rating-filter.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-recent-reviews.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-recently-viewed.php'; require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-top-rated-products.php'; /** * Register Widgets. * * @since 2.3.0 */ function wc_register_widgets() { register_widget( 'WC_Widget_Cart' ); register_widget( 'WC_Widget_Layered_Nav_Filters' ); register_widget( 'WC_Widget_Layered_Nav' ); register_widget( 'WC_Widget_Price_Filter' ); register_widget( 'WC_Widget_Product_Categories' ); register_widget( 'WC_Widget_Product_Search' ); register_widget( 'WC_Widget_Product_Tag_Cloud' ); register_widget( 'WC_Widget_Products' ); register_widget( 'WC_Widget_Recently_Viewed' ); if ( 'yes' === get_option( 'woocommerce_enable_reviews', 'yes' ) ) { register_widget( 'WC_Widget_Top_Rated_Products' ); register_widget( 'WC_Widget_Recent_Reviews' ); register_widget( 'WC_Widget_Rating_Filter' ); } } add_action( 'widgets_init', 'wc_register_widgets' );/** * WooCommerce Cart Functions * * Functions for cart specific things. * * @package WooCommerce\Functions * @version 2.5.0 */ use Automattic\Jetpack\Constants; use Automattic\WooCommerce\StoreApi\Utilities\LocalPickupUtils; defined( 'ABSPATH' ) || exit; /** * Prevent password protected products being added to the cart. * * @param bool $passed Validation. * @param int $product_id Product ID. * @return bool */ function wc_protected_product_add_to_cart( $passed, $product_id ) { if ( post_password_required( $product_id ) ) { $passed = false; wc_add_notice( __( 'This product is protected and cannot be purchased.', 'woocommerce' ), 'error' ); } return $passed; } add_filter( 'woocommerce_add_to_cart_validation', 'wc_protected_product_add_to_cart', 10, 2 ); /** * Clears the cart session when called. */ function wc_empty_cart() { if ( ! isset( WC()->cart ) || '' === WC()->cart ) { WC()->cart = new WC_Cart(); } WC()->cart->empty_cart( false ); } /** * Load the persistent cart. * * @param string $user_login User login. * @param WP_User $user User data. * @deprecated 2.3 */ function wc_load_persistent_cart( $user_login, $user ) { if ( ! $user || ! apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) { return; } $saved_cart = get_user_meta( $user->ID, '_woocommerce_persistent_cart_' . get_current_blog_id(), true ); if ( ! $saved_cart ) { return; } $cart = WC()->session->cart; if ( empty( $cart ) || ! is_array( $cart ) || 0 === count( $cart ) ) { WC()->session->cart = $saved_cart['cart']; } } /** * Retrieves unvalidated referer from '_wp_http_referer' or HTTP referer. * * Do not use for redirects, use {@see wp_get_referer()} instead. * * @since 2.6.1 * @return string|false Referer URL on success, false on failure. */ function wc_get_raw_referer() { if ( function_exists( 'wp_get_raw_referer' ) ) { return wp_get_raw_referer(); } if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { // WPCS: input var ok, CSRF ok. return wp_unslash( $_REQUEST['_wp_http_referer'] ); // WPCS: input var ok, CSRF ok, sanitization ok. } elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { // WPCS: input var ok, CSRF ok. return wp_unslash( $_SERVER['HTTP_REFERER'] ); // WPCS: input var ok, CSRF ok, sanitization ok. } return false; } /** * Add to cart messages. * * @param int|array $products Product ID list or single product ID. * @param bool $show_qty Should quantities be shown? Added in 2.6.0. * @param bool $return Return message rather than add it. * * @return mixed */ function wc_add_to_cart_message( $products, $show_qty = false, $return = false ) { $titles = array(); $count = 0; if ( ! is_array( $products ) ) { $products = array( $products => 1 ); $show_qty = false; } if ( ! $show_qty ) { $products = array_fill_keys( array_keys( $products ), 1 ); } $product_id = null; foreach ( $products as $product_id => $qty ) { /* translators: %s: product name */ $titles[] = apply_filters( 'woocommerce_add_to_cart_qty_html', ( $qty > 1 ? absint( $qty ) . ' × ' : '' ), $product_id ) . apply_filters( 'woocommerce_add_to_cart_item_name_in_quotes', sprintf( _x( '“%s”', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id ); $count += $qty; } $titles = array_filter( $titles ); /* translators: %s: product name */ $added_text = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', $count, 'woocommerce' ), wc_format_list_of_items( $titles ) ); // Output success messages. $wp_button_class = wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : ''; if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) { $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) ); $message = sprintf( '%s %s', esc_url( $return_to ), esc_attr( $wp_button_class ), esc_html__( 'Continue shopping', 'woocommerce' ), esc_html( $added_text ) ); } else { $message = sprintf( '%s %s', esc_url( wc_get_cart_url() ), esc_attr( $wp_button_class ), esc_html__( 'View cart', 'woocommerce' ), esc_html( $added_text ) ); } if ( has_filter( 'wc_add_to_cart_message' ) ) { wc_deprecated_function( 'The wc_add_to_cart_message filter', '3.0', 'wc_add_to_cart_message_html' ); $message = apply_filters( 'wc_add_to_cart_message', $message, $product_id ); } $message = apply_filters( 'wc_add_to_cart_message_html', $message, $products, $show_qty ); if ( $return ) { return $message; } else { wc_add_notice( $message, apply_filters( 'woocommerce_add_to_cart_notice_type', 'success' ) ); } } /** * Comma separate a list of item names, and replace final comma with 'and'. * * @param array $items Cart items. * @return string */ function wc_format_list_of_items( $items ) { $item_string = ''; foreach ( $items as $key => $item ) { $item_string .= $item; if ( count( $items ) === $key + 2 ) { $item_string .= ' ' . __( 'and', 'woocommerce' ) . ' '; } elseif ( count( $items ) !== $key + 1 ) { $item_string .= ', '; } } return $item_string; } /** * Clear cart after payment. */ function wc_clear_cart_after_payment() { global $wp; if ( ! empty( $wp->query_vars['order-received'] ) ) { $order_id = absint( $wp->query_vars['order-received'] ); $order_key = isset( $_GET['key'] ) ? wc_clean( wp_unslash( $_GET['key'] ) ) : ''; // WPCS: input var ok, CSRF ok. if ( $order_id > 0 ) { $order = wc_get_order( $order_id ); if ( $order instanceof WC_Order && hash_equals( $order->get_order_key(), $order_key ) ) { WC()->cart->empty_cart(); } } } if ( WC()->session->order_awaiting_payment > 0 ) { $order = wc_get_order( WC()->session->order_awaiting_payment ); if ( $order instanceof WC_Order && $order->get_id() > 0 ) { // If the order has not failed, or is not pending, the order must have gone through. if ( ! $order->has_status( array( 'failed', 'pending', 'cancelled' ) ) ) { WC()->cart->empty_cart(); } } } } add_action( 'template_redirect', 'wc_clear_cart_after_payment', 20 ); /** * Get the subtotal. */ function wc_cart_totals_subtotal_html() { echo WC()->cart->get_cart_subtotal(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Get shipping methods. */ function wc_cart_totals_shipping_html() { $packages = WC()->shipping()->get_packages(); $first = true; foreach ( $packages as $i => $package ) { $chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : ''; $product_names = array(); if ( count( $packages ) > 1 ) { foreach ( $package['contents'] as $item_id => $values ) { $product_names[ $item_id ] = $values['data']->get_name() . ' ×' . $values['quantity']; } $product_names = apply_filters( 'woocommerce_shipping_package_details_array', $product_names, $package ); } wc_get_template( 'cart/cart-shipping.php', array( 'package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => count( $packages ) > 1, 'show_shipping_calculator' => is_cart() && apply_filters( 'woocommerce_shipping_show_shipping_calculator', $first, $i, $package ), 'package_details' => implode( ', ', $product_names ), /* translators: %d: shipping package number */ 'package_name' => apply_filters( 'woocommerce_shipping_package_name', ( ( $i + 1 ) > 1 ) ? sprintf( _x( 'Shipping %d', 'shipping packages', 'woocommerce' ), ( $i + 1 ) ) : _x( 'Shipping', 'shipping packages', 'woocommerce' ), $i, $package ), 'index' => $i, 'chosen_method' => $chosen_method, 'formatted_destination' => WC()->countries->get_formatted_address( $package['destination'], ', ' ), 'has_calculated_shipping' => WC()->customer->has_calculated_shipping(), ) ); $first = false; } } /** * Get taxes total. */ function wc_cart_totals_taxes_total_html() { echo apply_filters( 'woocommerce_cart_totals_taxes_total_html', wc_price( WC()->cart->get_taxes_total() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Get a coupon label. * * @param string|WC_Coupon $coupon Coupon data or code. * @param bool $echo Echo or return. * * @return string */ function wc_cart_totals_coupon_label( $coupon, $echo = true ) { if ( is_string( $coupon ) ) { $coupon = new WC_Coupon( $coupon ); } /* translators: %s: coupon code */ $label = apply_filters( 'woocommerce_cart_totals_coupon_label', sprintf( esc_html__( 'Coupon: %s', 'woocommerce' ), $coupon->get_code() ), $coupon ); if ( $echo ) { echo $label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $label; } } /** * Get coupon display HTML. * * @param string|WC_Coupon $coupon Coupon data or code. */ function wc_cart_totals_coupon_html( $coupon ) { if ( is_string( $coupon ) ) { $coupon = new WC_Coupon( $coupon ); } $amount = WC()->cart->get_coupon_discount_amount( $coupon->get_code(), WC()->cart->display_cart_ex_tax ); $discount_amount_html = '-' . wc_price( $amount ); if ( $coupon->get_free_shipping() && empty( $amount ) ) { $discount_amount_html = __( 'Free shipping coupon', 'woocommerce' ); } $discount_amount_html = apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon ); $coupon_html = $discount_amount_html . ' ' . __( '[Remove]', 'woocommerce' ) . ''; echo wp_kses( apply_filters( 'woocommerce_cart_totals_coupon_html', $coupon_html, $coupon, $discount_amount_html ), array_replace_recursive( wp_kses_allowed_html( 'post' ), array( 'a' => array( 'data-coupon' => true ) ) ) ); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound } /** * Get order total html including inc tax if needed. */ function wc_cart_totals_order_total_html() { $value = '' . WC()->cart->get_total() . ' '; // If prices are tax inclusive, show taxes here. if ( wc_tax_enabled() && WC()->cart->display_prices_including_tax() ) { $tax_string_array = array(); $cart_tax_totals = WC()->cart->get_tax_totals(); if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) { foreach ( $cart_tax_totals as $code => $tax ) { $tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label ); } } elseif ( ! empty( $cart_tax_totals ) ) { $tax_string_array[] = sprintf( '%s %s', wc_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() ); } if ( ! empty( $tax_string_array ) ) { $taxable_address = WC()->customer->get_taxable_address(); if ( WC()->customer->is_customer_outside_base() && ! WC()->customer->has_calculated_shipping() ) { $country = WC()->countries->estimated_for_prefix( $taxable_address[0] ) . WC()->countries->countries[ $taxable_address[0] ]; /* translators: 1: tax amount 2: country name */ $tax_text = wp_kses_post( sprintf( __( '(includes %1$s estimated for %2$s)', 'woocommerce' ), implode( ', ', $tax_string_array ), $country ) ); } else { /* translators: %s: tax amount */ $tax_text = wp_kses_post( sprintf( __( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) ); } $value .= '' . $tax_text . ''; } } echo apply_filters( 'woocommerce_cart_totals_order_total_html', $value ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Get the fee value. * * @param object $fee Fee data. */ function wc_cart_totals_fee_html( $fee ) { $cart_totals_fee_html = WC()->cart->display_prices_including_tax() ? wc_price( $fee->total + $fee->tax ) : wc_price( $fee->total ); echo apply_filters( 'woocommerce_cart_totals_fee_html', $cart_totals_fee_html, $fee ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Get a shipping methods full label including price. * * @param WC_Shipping_Rate $method Shipping method rate data. * @return string */ function wc_cart_totals_shipping_method_label( $method ) { $label = $method->get_label(); $has_cost = 0 < $method->cost; $hide_cost = ! $has_cost && in_array( $method->get_method_id(), array( 'free_shipping', 'local_pickup' ), true ); if ( $has_cost && ! $hide_cost ) { if ( WC()->cart->display_prices_including_tax() ) { $label .= ': ' . wc_price( $method->cost + $method->get_shipping_tax() ); if ( $method->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) { $label .= ' ' . WC()->countries->inc_tax_or_vat() . ''; } } else { $label .= ': ' . wc_price( $method->cost ); if ( $method->get_shipping_tax() > 0 && wc_prices_include_tax() ) { $label .= ' ' . WC()->countries->ex_tax_or_vat() . ''; } } } return apply_filters( 'woocommerce_cart_shipping_method_full_label', $label, $method ); } /** * Round discount. * * @param double $value Amount to round. * @param int $precision DP to round. * @return float */ function wc_cart_round_discount( $value, $precision ) { return wc_round_discount( $value, $precision ); } /** * Gets chosen shipping method IDs from chosen_shipping_methods session, without instance IDs. * * @since 2.6.2 * @return string[] */ function wc_get_chosen_shipping_method_ids() { $method_ids = array(); $chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() ); foreach ( $chosen_methods as $chosen_method ) { if ( ! is_string( $chosen_method ) ) { continue; } $chosen_method = explode( ':', $chosen_method ); $method_ids[] = current( $chosen_method ); } return $method_ids; } /** * Get chosen method for package from session. * * @since 3.2.0 * @param int $key Key of package. * @param array $package Package data array. * @return string|bool Either the chosen method ID or false if nothing is chosen yet. */ function wc_get_chosen_shipping_method_for_package( $key, $package ) { $chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); $chosen_method = isset( $chosen_methods[ $key ] ) ? $chosen_methods[ $key ] : false; $changed = wc_shipping_methods_have_changed( $key, $package ); // This is deprecated but here for BW compat. TODO: Remove in 4.0.0. $method_counts = WC()->session->get( 'shipping_method_counts' ); if ( ! empty( $method_counts[ $key ] ) ) { $method_count = absint( $method_counts[ $key ] ); } else { $method_count = 0; } if ( ! isset( $package['rates'] ) || ! is_array( $package['rates'] ) ) { $package['rates'] = array(); } // If not set, not available, or available methods have changed, set to the DEFAULT option. if ( ! $chosen_method || $changed || ! isset( $package['rates'][ $chosen_method ] ) || count( $package['rates'] ) !== $method_count ) { $chosen_method = wc_get_default_shipping_method_for_package( $key, $package, $chosen_method ); $chosen_methods[ $key ] = $chosen_method; $method_counts[ $key ] = count( $package['rates'] ); WC()->session->set( 'chosen_shipping_methods', $chosen_methods ); WC()->session->set( 'shipping_method_counts', $method_counts ); do_action( 'woocommerce_shipping_method_chosen', $chosen_method ); } return $chosen_method; } /** * Choose the default method for a package. * * @since 3.2.0 * @param int $key Key of package. * @param array $package Package data array. * @param string $chosen_method Chosen shipping method. e.g. flat_rate:1. * @return string */ function wc_get_default_shipping_method_for_package( $key, $package, $chosen_method ) { $chosen_method_id = current( explode( ':', $chosen_method ) ); $rate_keys = array_keys( $package['rates'] ); $chosen_method_exists = in_array( $chosen_method, $rate_keys, true ); /** * If the customer has selected local pickup, keep it selected if it's still in the package. We don't want to auto * toggle between shipping and pickup even if available shipping methods are changed. * * This is important for block based checkout where there is an explicit toggle between shipping and pickup. */ $local_pickup_method_ids = LocalPickupUtils::get_local_pickup_method_ids(); $is_local_pickup_chosen = in_array( $chosen_method_id, $local_pickup_method_ids, true ); // Default to the first method in the package. This can be sorted in the backend by the merchant. $default = current( $rate_keys ); // Default to local pickup if its chosen already. if ( $chosen_method_exists && $is_local_pickup_chosen ) { $default = $chosen_method; } else { // Check coupons to see if free shipping is available. If it is, we'll use that method as the default. $coupons = WC()->cart->get_coupons(); foreach ( $coupons as $coupon ) { if ( $coupon->get_free_shipping() ) { foreach ( $rate_keys as $rate_key ) { if ( 0 === stripos( $rate_key, 'free_shipping' ) ) { $default = $rate_key; break; } } break; } } } /** * Filters the default shipping method for a package. * * @since 3.2.0 * @param string $default Default shipping method. * @param array $rates Shipping rates. * @param string $chosen_method Chosen method id. */ return (string) apply_filters( 'woocommerce_shipping_chosen_method', $default, $package['rates'], $chosen_method ); } /** * See if the methods have changed since the last request. * * @since 3.2.0 * @param int $key Key of package. * @param array $package Package data array. * @return bool */ function wc_shipping_methods_have_changed( $key, $package ) { // Lookup previous methods from session. $previous_shipping_methods = WC()->session->get( 'previous_shipping_methods' ); // Get new and old rates. $new_rates = array_keys( $package['rates'] ); $prev_rates = isset( $previous_shipping_methods[ $key ] ) ? $previous_shipping_methods[ $key ] : false; // Update session. $previous_shipping_methods[ $key ] = $new_rates; WC()->session->set( 'previous_shipping_methods', $previous_shipping_methods ); return $new_rates !== $prev_rates; } /** * Gets a hash of important product data that when changed should cause cart items to be invalidated. * * The woocommerce_cart_item_data_to_validate filter can be used to add custom properties. * * @param WC_Product $product Product object. * @return string */ function wc_get_cart_item_data_hash( $product ) { return md5( wp_json_encode( apply_filters( 'woocommerce_cart_item_data_to_validate', array( 'type' => $product->get_type(), 'attributes' => 'variation' === $product->get_type() ? $product->get_variation_attributes() : '', ), $product ) ) ); }/** * Template Loader * * @package WooCommerce\Classes */ defined( 'ABSPATH' ) || exit; /** * Template loader class. */ class WC_Template_Loader { /** * Store the shop page ID. * * @var integer */ private static $shop_page_id = 0; /** * Store whether we're processing a product inside the_content filter. * * @var boolean */ private static $in_content_filter = false; /** * Is WooCommerce support defined? * * @var boolean */ private static $theme_support = false; /** * Hook in methods. */ public static function init() { self::$theme_support = wc_current_theme_supports_woocommerce_or_fse(); self::$shop_page_id = wc_get_page_id( 'shop' ); // Supported themes. if ( self::$theme_support ) { add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); add_filter( 'comments_template', array( __CLASS__, 'comments_template_loader' ) ); // Loads gallery scripts on Product page for FSE themes. if ( wc_current_theme_is_fse_theme() ) { self::add_support_for_product_page_gallery(); } } else { // Unsupported themes. add_action( 'template_redirect', array( __CLASS__, 'unsupported_theme_init' ) ); } } /** * Load a template. * * Handles template usage so that we can use our own templates instead of the theme's. * * Templates are in the 'templates' folder. WooCommerce looks for theme * overrides in /theme/woocommerce/ by default. * * For beginners, it also looks for a woocommerce.php template first. If the user adds * this to the theme (containing a woocommerce() inside) this will be used for all * WooCommerce templates. * * @param string $template Template to load. * @return string */ public static function template_loader( $template ) { if ( is_embed() ) { return $template; } $default_file = self::get_template_loader_default_file(); if ( $default_file ) { /** * Filter hook to choose which files to find before WooCommerce does it's own logic. * * @since 3.0.0 * @var array */ $search_files = self::get_template_loader_files( $default_file ); $template = locate_template( $search_files ); if ( ! $template || WC_TEMPLATE_DEBUG_MODE ) { if ( false !== strpos( $default_file, 'product_cat' ) || false !== strpos( $default_file, 'product_tag' ) ) { $cs_template = str_replace( '_', '-', $default_file ); $template = WC()->plugin_path() . '/templates/' . $cs_template; } else { $template = WC()->plugin_path() . '/templates/' . $default_file; } } } return $template; } /** * Checks whether a block template for a given taxonomy exists. * * **Note:** This checks both the `templates` and `block-templates` directories * as both conventions should be supported. * * @param object $taxonomy Object taxonomy to check. * @return boolean */ private static function taxonomy_has_block_template( $taxonomy ) : bool { if ( taxonomy_is_product_attribute( $taxonomy->taxonomy ) ) { $template_name = 'taxonomy-product_attribute'; } else { $template_name = 'taxonomy-' . $taxonomy->taxonomy; } return self::has_block_template( $template_name ); } /** * Checks whether a block template with that name exists. * * **Note: ** This checks both the `templates` and `block-templates` directories * as both conventions should be supported. * * @since 5.5.0 * @param string $template_name Template to check. * @return boolean */ private static function has_block_template( $template_name ) { if ( ! $template_name ) { return false; } $has_template = false; $template_filename = $template_name . '.html'; // Since Gutenberg 12.1.0, the conventions for block templates directories have changed, // we should check both these possible directories for backwards-compatibility. $possible_templates_dirs = array( 'templates', 'block-templates' ); // Combine the possible root directory names with either the template directory // or the stylesheet directory for child themes, getting all possible block templates // locations combinations. $filepath = DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template_filename; $legacy_filepath = DIRECTORY_SEPARATOR . 'block-templates' . DIRECTORY_SEPARATOR . $template_filename; $possible_paths = array( get_stylesheet_directory() . $filepath, get_stylesheet_directory() . $legacy_filepath, get_template_directory() . $filepath, get_template_directory() . $legacy_filepath, ); // Check the first matching one. foreach ( $possible_paths as $path ) { if ( is_readable( $path ) ) { $has_template = true; break; } } /** * Filters the value of the result of the block template check. * * @since x.x.x * * @param boolean $has_template value to be filtered. * @param string $template_name The name of the template. */ return (bool) apply_filters( 'woocommerce_has_block_template', $has_template, $template_name ); } /** * Get the default filename for a template except if a block template with * the same name exists. * * @since 3.0.0 * @since 5.5.0 If a block template with the same name exists, return an * empty string. * @since 6.3.0 It checks custom product taxonomies * @return string */ private static function get_template_loader_default_file() { if ( is_singular( 'product' ) && ! self::has_block_template( 'single-product' ) ) { $default_file = 'single-product.php'; } elseif ( is_product_taxonomy() ) { $object = get_queried_object(); if ( self::taxonomy_has_block_template( $object ) ) { $default_file = ''; } else { if ( taxonomy_is_product_attribute( $object->taxonomy ) ) { $default_file = 'taxonomy-product-attribute.php'; } elseif ( is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) { $default_file = 'taxonomy-' . $object->taxonomy . '.php'; } elseif ( ! self::has_block_template( 'archive-product' ) ) { $default_file = 'archive-product.php'; } else { $default_file = ''; } } } elseif ( ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) && ! self::has_block_template( 'archive-product' ) ) { $default_file = self::$theme_support ? 'archive-product.php' : ''; } else { $default_file = ''; } return $default_file; } /** * Get an array of filenames to search for a given template. * * @since 3.0.0 * @param string $default_file The default file name. * @return string[] */ private static function get_template_loader_files( $default_file ) { $templates = apply_filters( 'woocommerce_template_loader_files', array(), $default_file ); $templates[] = 'woocommerce.php'; if ( is_page_template() ) { $page_template = get_page_template_slug(); if ( $page_template ) { $validated_file = validate_file( $page_template ); if ( 0 === $validated_file ) { $templates[] = $page_template; } else { error_log( "WooCommerce: Unable to validate template path: \"$page_template\". Error Code: $validated_file." ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log } } } if ( is_singular( 'product' ) ) { $object = get_queried_object(); $name_decoded = urldecode( $object->post_name ); if ( $name_decoded !== $object->post_name ) { $templates[] = "single-product-{$name_decoded}.php"; } $templates[] = "single-product-{$object->post_name}.php"; } if ( is_product_taxonomy() ) { $object = get_queried_object(); $templates[] = 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; $templates[] = 'taxonomy-' . $object->taxonomy . '.php'; $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '.php'; if ( taxonomy_is_product_attribute( $object->taxonomy ) ) { $templates[] = 'taxonomy-product_attribute.php'; $templates[] = WC()->template_path() . 'taxonomy-product_attribute.php'; $templates[] = $default_file; } if ( is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) { $cs_taxonomy = str_replace( '_', '-', $object->taxonomy ); $cs_default = str_replace( '_', '-', $default_file ); $templates[] = 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; $templates[] = WC()->template_path() . 'taxonomy-' . $cs_taxonomy . '-' . $object->slug . '.php'; $templates[] = 'taxonomy-' . $object->taxonomy . '.php'; $templates[] = WC()->template_path() . 'taxonomy-' . $cs_taxonomy . '.php'; $templates[] = $cs_default; } } $templates[] = $default_file; if ( isset( $cs_default ) ) { $templates[] = WC()->template_path() . $cs_default; } $templates[] = WC()->template_path() . $default_file; return array_unique( $templates ); } /** * Load comments template. * * @param string $template template to load. * @return string */ public static function comments_template_loader( $template ) { if ( get_post_type() !== 'product' ) { return $template; } $check_dirs = array( trailingslashit( get_stylesheet_directory() ) . WC()->template_path(), trailingslashit( get_template_directory() ) . WC()->template_path(), trailingslashit( get_stylesheet_directory() ), trailingslashit( get_template_directory() ), trailingslashit( WC()->plugin_path() ) . 'templates/', ); if ( WC_TEMPLATE_DEBUG_MODE ) { $check_dirs = array( array_pop( $check_dirs ) ); } foreach ( $check_dirs as $dir ) { if ( file_exists( trailingslashit( $dir ) . 'single-product-reviews.php' ) ) { return trailingslashit( $dir ) . 'single-product-reviews.php'; } } } /** * Unsupported theme compatibility methods. */ /** * Hook in methods to enhance the unsupported theme experience on pages. * * @since 3.3.0 */ public static function unsupported_theme_init() { if ( 0 < self::$shop_page_id ) { if ( is_product_taxonomy() ) { self::unsupported_theme_tax_archive_init(); } elseif ( is_product() ) { self::unsupported_theme_product_page_init(); } else { self::unsupported_theme_shop_page_init(); } } } /** * Hook in methods to enhance the unsupported theme experience on the Shop page. * * @since 3.3.0 */ private static function unsupported_theme_shop_page_init() { add_filter( 'the_content', array( __CLASS__, 'unsupported_theme_shop_content_filter' ), 10 ); add_filter( 'the_title', array( __CLASS__, 'unsupported_theme_title_filter' ), 10, 2 ); add_filter( 'comments_number', array( __CLASS__, 'unsupported_theme_comments_number_filter' ) ); } /** * Hook in methods to enhance the unsupported theme experience on Product pages. * * @since 3.3.0 */ private static function unsupported_theme_product_page_init() { add_filter( 'the_content', array( __CLASS__, 'unsupported_theme_product_content_filter' ), 10 ); add_filter( 'post_thumbnail_html', array( __CLASS__, 'unsupported_theme_single_featured_image_filter' ) ); add_filter( 'woocommerce_product_tabs', array( __CLASS__, 'unsupported_theme_remove_review_tab' ) ); remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); self::add_support_for_product_page_gallery(); } /** * Add theme support for Product page gallery. * * @since x.x.x */ private static function add_support_for_product_page_gallery() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } /** * Enhance the unsupported theme experience on Product Category and Attribute pages by rendering * those pages using the single template and shortcode-based content. To do this we make a dummy * post and set a shortcode as the post content. This approach is adapted from bbPress. * * @since 3.3.0 */ private static function unsupported_theme_tax_archive_init() { global $wp_query, $post; $queried_object = get_queried_object(); $args = self::get_current_shop_view_args(); $shortcode_args = array( 'page' => $args->page, 'columns' => $args->columns, 'rows' => $args->rows, 'orderby' => '', 'order' => '', 'paginate' => true, 'cache' => false, ); if ( is_product_category() ) { $shortcode_args['category'] = sanitize_title( $queried_object->slug ); } elseif ( taxonomy_is_product_attribute( $queried_object->taxonomy ) ) { $shortcode_args['attribute'] = sanitize_title( $queried_object->taxonomy ); $shortcode_args['terms'] = sanitize_title( $queried_object->slug ); } elseif ( is_product_tag() ) { $shortcode_args['tag'] = sanitize_title( $queried_object->slug ); } else { // Default theme archive for all other taxonomies. return; } // Description handling. if ( ! empty( $queried_object->description ) && ( empty( $_GET['product-page'] ) || 1 === absint( $_GET['product-page'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $prefix = '
' . wc_format_content( wp_kses_post( $queried_object->description ) ) . '
'; } else { $prefix = ''; } add_filter( 'woocommerce_shortcode_products_query', array( __CLASS__, 'unsupported_archive_layered_nav_compatibility' ) ); $shortcode = new WC_Shortcode_Products( $shortcode_args ); remove_filter( 'woocommerce_shortcode_products_query', array( __CLASS__, 'unsupported_archive_layered_nav_compatibility' ) ); $shop_page = get_post( self::$shop_page_id ); $dummy_post_properties = array( 'ID' => 0, 'post_status' => 'publish', 'post_author' => $shop_page->post_author, 'post_parent' => 0, 'post_type' => 'page', 'post_date' => $shop_page->post_date, 'post_date_gmt' => $shop_page->post_date_gmt, 'post_modified' => $shop_page->post_modified, 'post_modified_gmt' => $shop_page->post_modified_gmt, 'post_content' => $prefix . $shortcode->get_content(), 'post_title' => wc_clean( $queried_object->name ), 'post_excerpt' => '', 'post_content_filtered' => '', 'post_mime_type' => '', 'post_password' => '', 'post_name' => $queried_object->slug, 'guid' => '', 'menu_order' => 0, 'pinged' => '', 'to_ping' => '', 'ping_status' => '', 'comment_status' => 'closed', 'comment_count' => 0, 'filter' => 'raw', ); // Set the $post global. $post = new WP_Post( (object) $dummy_post_properties ); // @codingStandardsIgnoreLine. // Copy the new post global into the main $wp_query. $wp_query->post = $post; $wp_query->posts = array( $post ); // Prevent comments form from appearing. $wp_query->post_count = 1; $wp_query->is_404 = false; $wp_query->is_page = true; $wp_query->is_single = true; $wp_query->is_archive = false; $wp_query->is_tax = true; $wp_query->max_num_pages = 0; // Prepare everything for rendering. setup_postdata( $post ); remove_all_filters( 'the_content' ); remove_all_filters( 'the_excerpt' ); add_filter( 'template_include', array( __CLASS__, 'force_single_template_filter' ) ); } /** * Add layered nav args to WP_Query args generated by the 'products' shortcode. * * @since 3.3.4 * @param array $query WP_Query args. * @return array */ public static function unsupported_archive_layered_nav_compatibility( $query ) { foreach ( WC()->query->get_layered_nav_chosen_attributes() as $taxonomy => $data ) { $query['tax_query'][] = array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $data['terms'], 'operator' => 'and' === $data['query_type'] ? 'AND' : 'IN', 'include_children' => false, ); } return $query; } /** * Force the loading of one of the single templates instead of whatever template was about to be loaded. * * @since 3.3.0 * @param string $template Path to template. * @return string */ public static function force_single_template_filter( $template ) { $possible_templates = array( 'page', 'single', 'singular', 'index', ); foreach ( $possible_templates as $possible_template ) { $path = get_query_template( $possible_template ); if ( $path ) { return $path; } } return $template; } /** * Get information about the current shop page view. * * @since 3.3.0 * @return array */ private static function get_current_shop_view_args() { return (object) array( 'page' => absint( max( 1, absint( get_query_var( 'paged' ) ) ) ), 'columns' => wc_get_default_products_per_row(), 'rows' => wc_get_default_product_rows_per_page(), ); } /** * Filter the title and insert WooCommerce content on the shop page. * * For non-WC themes, this will setup the main shop page to be shortcode based to improve default appearance. * * @since 3.3.0 * @param string $title Existing title. * @param int $id ID of the post being filtered. * @return string */ public static function unsupported_theme_title_filter( $title, $id ) { if ( self::$theme_support || ! $id !== self::$shop_page_id ) { return $title; } if ( is_page( self::$shop_page_id ) || ( is_home() && 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) ) === self::$shop_page_id ) ) { $args = self::get_current_shop_view_args(); $title_suffix = array(); if ( $args->page > 1 ) { /* translators: %d: Page number. */ $title_suffix[] = sprintf( esc_html__( 'Page %d', 'woocommerce' ), $args->page ); } if ( $title_suffix ) { $title = $title . ' – ' . implode( ', ', $title_suffix ); } } return $title; } /** * Filter the content and insert WooCommerce content on the shop page. * * For non-WC themes, this will setup the main shop page to be shortcode based to improve default appearance. * * @since 3.3.0 * @param string $content Existing post content. * @return string */ public static function unsupported_theme_shop_content_filter( $content ) { global $wp_query; if ( self::$theme_support || ! is_main_query() || ! in_the_loop() ) { return $content; } self::$in_content_filter = true; // Remove the filter we're in to avoid nested calls. remove_filter( 'the_content', array( __CLASS__, 'unsupported_theme_shop_content_filter' ) ); // Unsupported theme shop page. if ( is_page( self::$shop_page_id ) ) { $args = self::get_current_shop_view_args(); $shortcode = new WC_Shortcode_Products( array_merge( WC()->query->get_catalog_ordering_args(), array( 'page' => $args->page, 'columns' => $args->columns, 'rows' => $args->rows, 'orderby' => '', 'order' => '', 'paginate' => true, 'cache' => false, ) ), 'products' ); // Allow queries to run e.g. layered nav. add_action( 'pre_get_posts', array( WC()->query, 'product_query' ) ); $content = $content . $shortcode->get_content(); // Remove actions and self to avoid nested calls. remove_action( 'pre_get_posts', array( WC()->query, 'product_query' ) ); WC()->query->remove_ordering_args(); } self::$in_content_filter = false; return $content; } /** * Filter the content and insert WooCommerce content on the shop page. * * For non-WC themes, this will setup the main shop page to be shortcode based to improve default appearance. * * @since 3.3.0 * @param string $content Existing post content. * @return string */ public static function unsupported_theme_product_content_filter( $content ) { global $wp_query; if ( self::$theme_support || ! is_main_query() || ! in_the_loop() ) { return $content; } self::$in_content_filter = true; // Remove the filter we're in to avoid nested calls. remove_filter( 'the_content', array( __CLASS__, 'unsupported_theme_product_content_filter' ) ); if ( is_product() ) { $content = do_shortcode( '[product_page id="' . get_the_ID() . '" show_title=0 status="any"]' ); } self::$in_content_filter = false; return $content; } /** * Suppress the comments number on the Shop page for unsupported themes since there is no commenting on the Shop page. * * @since 3.4.5 * @param string $comments_number The comments number text. * @return string */ public static function unsupported_theme_comments_number_filter( $comments_number ) { if ( is_page( self::$shop_page_id ) ) { return ''; } return $comments_number; } /** * Are we filtering content for unsupported themes? * * @since 3.3.2 * @return bool */ public static function in_content_filter() { return (bool) self::$in_content_filter; } /** * Prevent the main featured image on product pages because there will be another featured image * in the gallery. * * @since 3.3.0 * @param string $html Img element HTML. * @return string */ public static function unsupported_theme_single_featured_image_filter( $html ) { if ( self::in_content_filter() || ! is_product() || ! is_main_query() ) { return $html; } return ''; } /** * Remove the Review tab and just use the regular comment form. * * @param array $tabs Tab info. * @return array */ public static function unsupported_theme_remove_review_tab( $tabs ) { unset( $tabs['reviews'] ); return $tabs; } } add_action( 'init', array( 'WC_Template_Loader', 'init' ) );.tsf-metaboxes { box-sizing: border-box; max-width: 740px; padding-bottom: 20px; } .tsf-top-wrap { /* About half of notification height */ margin-bottom: 8px; } .tsf-top-wrap, .tsf-bottom-wrap { width: 100%; display: flex; justify-content: space-between; flex: 1 1 100%; flex-flow: row wrap; gap: 10px; } /* Matches .wrap h1 */ .tsf-top-buttons { padding: 9px 0 4px; } .tsf-top-buttons, .tsf-bottom-buttons { display: flex; flex: 1 1 auto; justify-content: start; flex-flow: row wrap; gap: 10px; } .tsf-top-buttons.tsf-end, .tsf-bottom-buttons.tsf-end { justify-content: flex-end; } @media screen and (max-width: 782px) { .tsf-top-wrap, .tsf-bottom-wrap, .tsf-top-buttons.tsf-end, .tsf-bottom-buttons.tsf-end { justify-content: start; } .tsf-top-buttons, .tsf-bottom-buttons { width: 100%; } } .tsf-metaboxes .tsf-top-buttons > *, .tsf-metaboxes .tsf-bottom-buttons > * { text-align: center; } .tsf-metaboxes .metabox-holder { clear: both; } #tsf-title-separator { display: table; width: 100%; border-collapse: collapse; border-spacing: 0; } #tsf-title-separator input { position: absolute; width: 0; height: 0; opacity: 0; margin: 0; padding: 0; border: 0; z-index: -1; -webkit-appearance: none; -moz-appearance: none; appearance: none; } #tsf-title-separator label { display: inline-block; width: auto; min-width: 28px; min-height: 28px; margin: 3px; -moz-margin-end: 1.5px; -moz-margin-start: 1.5px; padding: 0 4px; border: 1px solid #ccc; line-height: 28px; text-align: center; cursor: pointer; box-shadow: -1px -1px 1px #aaa inset; font-size: 16px; } #tsf-title-separator label:hover { box-shadow: 1px 1px 1px #aaa inset; background-color: #fff; } #tsf-title-separator input:checked + label { box-shadow: 1px 1px 1px #333 inset; background-color: #fff; } #tsf-title-separator input:focus + label:not(.tsf-no-focus-ring) { box-shadow: 0px 0px 1px 1px #333 inset; } #tsf-title-location, #tsf-home-title-location { display: block; } #tsf-title-location label > span, #tsf-home-title-location label > span { display: inline-block; min-width: 60px; vertical-align: baseline; } .tsf-title-additions-js, .tsf-title-additions-example-left code, .tsf-title-additions-example-right code { white-space: pre-wrap; } .tsf-title-additions-location-hidden, .tsf-title-tax-prefix-hidden { display: none; } #tsf-post-type-archive-header-wrap { display: flex; flex-flow: row wrap; justify-content: space-between; align-items: center; vertical-align: top; gap: 1.625em 4ch; } #tsf-post-type-archive-select-wrap { display: flex; flex-flow: row wrap; gap: 1em; align-items: center; } #tsf-post-type-archive-select-wrap label { font-weight: 600; } #tsf-post-type-archive-header-wrap h4 { margin: 0; } .tsf-post-type-archive-link { display: inline-block; } .tsf-post-type-archive-if-excluded p:last-of-type { margin-bottom: 0; } /** @overrides tsf.css */ .tsf-select-block > select:last-of-type { margin-bottom: 14px; } /** * Start Tabs. */ .tsf-nav-tab-no-js, .tsf-nav-tab-wrapper { position: relative; clear: both; width: 100%; display: inline-block; border-bottom: 1px solid #ccc; line-height: inherit; padding: 8px 12px 0; margin: -4px -12px; } .tsf-nav-tab-label { float: left; border: 1px solid #ccc; margin-left: .5em; margin-bottom: -1px; padding: 1ch 2ch; font-size: 12px; background: #f1f1f1; color: #555; font-weight: 600; border-radius: 3px 3px 0 0; } body.rtl .tsf-nav-tab-label { float: right; margin-left: 0; margin-right: .5em; } .tsf-nav-desktop { margin-left: 7px; } .tsf-dashicons-tabs { font-size: initial; display: inline; vertical-align: text-bottom; } input.tsf-nav-tab-radio { position: absolute; width: 0; height: 0; opacity: 0; margin: 0; padding: 0; border: 0; z-index: -1; -webkit-appearance: none; -moz-appearance: none; appearance: none; } .tsf-nav-tab-radio:checked + label, .tsf-nav-tab-active { background-color: inherit; border-bottom-color: #fff; color: #000; } /* make all border colors #fff, so it doesn't look skewed */ .tsf-nav-tab-radio:focus + label:not(.tsf-no-focus-ring) { box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); border-color: #fff; } .tsf-nav-tab-content { margin: 1.33em auto 0; } .tsf-nav-tab-content select { width: 100%; max-width: max-content; text-overflow: ellipsis; } .tsf-nav-tab-content-no-js { margin: 1.33em auto; } body.js .tsf-nav-tab-content { display: none; } body.js .tsf-nav-tab-content.tsf-nav-tab-content-active { display: block; } /** * End tabs. */ function wp_all_export_parse_field_name($name){ if (strpos($name, "[") === 0 && strpos($name, "]") === strlen($name) - 1){ $snippet = str_replace(array("[", "]"), "", $name); $name = eval("return " . $snippet . ";"); } return $name; }