/**
* prettyPhoto.scss
* Styles for the prettyPhoto lightbox script. Includes a custom WooCommerce theme.
* http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
*/
/**
* Imports
*/
@import 'mixins';
@import 'variables';
@import 'fonts';
/**
* Mixins
*/
@mixin button() {
border-radius: 100%;
height: 1em;
width: 1em;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
background-color: #444;
color: #fff !important;
font-size: 16px !important;
line-height: 1em;
@include transition();
&:hover {
background-color: #000;
}
}
/**
* Custom WooCommerce prettyPhoto theme
*/
div.pp_woocommerce {
.pp_content_container {
background: #fff;
border-radius: 3px;
box-shadow: 0 1px 30px rgba(0, 0, 0, 0.25);
padding: 20px 0;
@include clearfix();
}
.pp_loaderIcon {
@include loader();
}
div.ppt {
color: black;
}
.pp_gallery {
ul {
li {
a {
border: 1px solid rgba(0, 0, 0, 0.5);
background: #fff;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
border-radius: 2px;
display: block;
&:hover {
border-color: #000;
}
}
&.selected {
a {
border-color: #000;
}
}
}
}
}
.pp_previous,
.pp_next {
&::before {
@include button();
font-family: 'WooCommerce';
content: '\e00b';
text-indent: 0;
display: none;
position: absolute;
top: 50%;
margin-top: -10px;
text-align: center;
}
&:hover {
&::before {
display: block;
}
}
}
.pp_previous {
&::before {
left: 1em;
}
}
.pp_next {
&::before {
right: 1em;
font-family: 'WooCommerce';
content: '\e008';
}
}
.pp_details {
margin: 0;
padding-top: 1em;
}
.pp_nav,
.pp_description {
font-size: 14px;
}
.pp_nav,
.pp_nav p,
.pp_play,
.pp_nav .pp_pause,
.pp_arrow_previous,
.pp_arrow_next {
margin: 0;
}
.pp_nav {
margin-right: 1em;
position: relative;
}
.pp_close {
@include button();
top: -0.5em;
right: -0.5em;
font-size: 1.618em !important;
&::before {
font-family: 'WooCommerce';
content: '\e013';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
text-indent: 0;
}
}
.pp_arrow_previous,
.pp_arrow_next {
@include button();
position: relative;
margin-top: -1px;
&::before {
font-family: 'WooCommerce';
content: '\e00b';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
text-indent: 0;
}
}
.pp_arrow_previous {
margin-right: 0.5em;
}
.pp_arrow_next {
margin-left: 0.5em;
&::before {
content: '\e008';
}
}
a.pp_expand,
a.pp_contract {
@include button();
right: auto;
left: -0.5em;
top: -0.5em;
font-size: 1.618em !important;
&::before {
font-family: 'WooCommerce';
content: '\e005';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
text-indent: 0;
}
}
a.pp_contract {
&::before {
content: '\e004';
}
}
#respond {
margin: 0;
width: 100%;
background: none;
border: none;
padding: 0;
.form-submit {
margin-top: 0;
float: none;
}
}
.pp_inline {
padding: 0!important;
}
}
// RTL support
.rtl {
div.pp_woocommerce {
.pp_content_container {
text-align: right;
}
}
}
@media only screen and (max-width: 768px) {
div.pp_woocommerce {
left: 5% !important;
right: 5% !important;
box-sizing: border-box;
width: 90% !important;
.pp_gallery,
.pp_previous,
.pp_next,
.pp_expand,
.pp_contract {
display: none !important;
}
.pp_arrow_previous,
.pp_arrow_next,
.pp_close {
height: 44px;
width: 44px;
font-size: 44px;
line-height: 44px;
&::before {
font-size: 44px;
}
}
.pp_description {
display: none !important;
}
.pp_details {
width: 100% !important;
}
}
.pp_content {
width: 100% !important;
#pp_full_res {
& > img {
width: 100% !important;
height: auto !important;
}
}
}
.currentTextHolder {
line-height: 3;
}
}
/**
* Default prettyPhoto css
* Do not edit!
*/
div.pp_pic_holder a:focus {
outline: none;
}
div.pp_overlay {
background: #000;
display: none;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 9999;
}
div.pp_pic_holder {
display: none;
position: absolute;
width: 100px;
z-index: 10000;
}
.pp_top {
height: 20px;
position: relative;
}
* html .pp_top {
padding: 0 20px;
}
.pp_top .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_top .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_top .pp_middle {
left: 0;
position: static;
}
.pp_top .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_content {
height: 40px;
min-width: 40px;
}
* html .pp_content {
width: 40px;
}
.pp_fade {
display: none;
}
.pp_content_container {
position: relative;
text-align: left;
width: 100%;
}
.pp_content_container .pp_left {
padding-left: 20px;
}
.pp_content_container .pp_right {
padding-right: 20px;
}
.pp_content_container .pp_details {
float: left;
margin: 10px 0 2px;
}
.pp_description {
display: none;
margin: 0;
}
.pp_social {
float: left;
margin: 0;
}
.pp_social .facebook {
float: left;
margin-left: 5px;
width: 55px;
overflow: hidden;
}
.pp_social .twitter {
float: left;
}
.pp_nav {
clear: right;
float: left;
margin: 3px 10px 0 0;
}
.pp_nav p {
float: left;
margin: 2px 4px;
white-space: nowrap;
}
.pp_nav .pp_play,
.pp_nav .pp_pause {
float: left;
margin-right: 4px;
text-indent: -10000px;
}
a.pp_arrow_previous,
a.pp_arrow_next {
display: block;
float: left;
height: 15px;
margin-top: 3px;
text-indent: -100000px;
width: 14px;
}
.pp_hoverContainer {
position: absolute;
top: 0;
width: 100%;
z-index: 2000;
}
.pp_gallery {
display: none;
left: 50%;
margin-top: -50px;
position: absolute;
z-index: 10000;
}
.pp_gallery div {
float: left;
overflow: hidden;
position: relative;
}
.pp_gallery ul {
float: left;
height: 35px;
margin: 0 0 0 5px;
padding: 0;
position: relative;
white-space: nowrap;
}
.pp_gallery ul a {
border: 1px #000 solid;
border: 1px rgba(0, 0, 0, 0.5) solid;
display: block;
float: left;
height: 33px;
overflow: hidden;
}
.pp_gallery ul a:hover,
.pp_gallery li.selected a {
border-color: #fff;
}
.pp_gallery ul a img {
border: 0;
}
.pp_gallery li {
display: block;
float: left;
margin: 0 5px 0 0;
padding: 0;
}
.pp_gallery li.default a {
display: block;
height: 33px;
width: 50px;
}
.pp_gallery li.default a img {
display: none;
}
.pp_gallery .pp_arrow_previous,
.pp_gallery .pp_arrow_next {
margin-top: 7px !important;
}
a.pp_next {
display: block;
float: right;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_previous {
display: block;
float: left;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_expand,
a.pp_contract {
cursor: pointer;
display: none;
height: 20px;
position: absolute;
right: 30px;
text-indent: -10000px;
top: 10px;
width: 20px;
z-index: 20000;
}
a.pp_close {
position: absolute;
right: 0;
top: 0;
display: block;
text-indent: -10000px;
}
.pp_bottom {
height: 20px;
position: relative;
}
* html .pp_bottom {
padding: 0 20px;
}
.pp_bottom .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_bottom .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_bottom .pp_middle {
left: 0;
position: static;
}
.pp_bottom .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_loaderIcon {
display: block;
height: 24px;
left: 50%;
margin: -12px 0 0 -12px;
position: absolute;
top: 50%;
width: 24px;
}
#pp_full_res .pp_inline {
text-align: left;
}
div.ppt {
color: #fff !important;
font-weight: 700;
display: none;
font-size: 17px;
margin: 0 0 5px 15px;
z-index: 9999;
}
/**
* WooCommerce Message Functions
*
* Functions for error/message handling and display.
*
* @package WooCommerce\Functions
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Get the count of notices added, either for all notices (default) or for one.
* particular notice type specified by $notice_type.
*
* @since 2.1
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
* @return int
*/
function wc_notice_count( $notice_type = '' ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return;
}
$notice_count = 0;
$all_notices = WC()->session->get( 'wc_notices', array() );
if ( isset( $all_notices[ $notice_type ] ) && is_array( $all_notices[ $notice_type ] ) ) {
$notice_count = count( $all_notices[ $notice_type ] );
} elseif ( empty( $notice_type ) ) {
foreach ( $all_notices as $notices ) {
if ( is_countable( $notices ) ) {
$notice_count += count( $notices );
}
}
}
return $notice_count;
}
/**
* Check if a notice has already been added.
*
* @since 2.1
* @param string $message The text to display in the notice.
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
* @return bool
*/
function wc_has_notice( $message, $notice_type = 'success' ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return false;
}
$notices = WC()->session->get( 'wc_notices', array() );
$notices = isset( $notices[ $notice_type ] ) ? $notices[ $notice_type ] : array();
return array_search( $message, wp_list_pluck( $notices, 'notice' ), true ) !== false;
}
/**
* Add and store a notice.
*
* @since 2.1
* @version 3.9.0
* @param string $message The text to display in the notice.
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
* @param array $data Optional notice data.
*/
function wc_add_notice( $message, $notice_type = 'success', $data = array() ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return;
}
$notices = WC()->session->get( 'wc_notices', array() );
// Backward compatibility.
if ( 'success' === $notice_type ) {
$message = apply_filters( 'woocommerce_add_message', $message );
}
$message = apply_filters( 'woocommerce_add_' . $notice_type, $message );
if ( ! empty( $message ) ) {
$notices[ $notice_type ][] = array(
'notice' => $message,
'data' => $data,
);
}
WC()->session->set( 'wc_notices', $notices );
}
/**
* Set all notices at once.
*
* @since 2.6.0
* @param array[] $notices Array of notices.
*/
function wc_set_notices( $notices ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.6' );
return;
}
WC()->session->set( 'wc_notices', $notices );
}
/**
* Unset all notices.
*
* @since 2.1
*/
function wc_clear_notices() {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return;
}
WC()->session->set( 'wc_notices', null );
}
/**
* Prints messages and errors which are stored in the session, then clears them.
*
* @since 2.1
* @param bool $return true to return rather than echo. @since 3.5.0.
* @return string|void
*/
function wc_print_notices( $return = false ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return;
}
$session = WC()->session;
// If the session handler has not initialized, there will be no notices for us to read.
if ( null === $session ) {
return;
}
$all_notices = $session->get( 'wc_notices', array() );
$notice_types = apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) );
// Buffer output.
ob_start();
foreach ( $notice_types as $notice_type ) {
if ( wc_notice_count( $notice_type ) > 0 ) {
$messages = array();
foreach ( $all_notices[ $notice_type ] as $notice ) {
$messages[] = isset( $notice['notice'] ) ? $notice['notice'] : $notice;
}
wc_get_template(
"notices/{$notice_type}.php",
array(
'messages' => array_filter( $messages ), // @deprecated 3.9.0
'notices' => array_filter( $all_notices[ $notice_type ] ),
)
);
}
}
wc_clear_notices();
$notices = wc_kses_notice( ob_get_clean() );
if ( $return ) {
return $notices;
}
echo $notices; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Print a single notice immediately.
*
* @since 2.1
* @version 3.9.0
* @param string $message The text to display in the notice.
* @param string $notice_type Optional. The singular name of the notice type - either error, success or notice.
* @param array $data Optional notice data. @since 3.9.0.
* @param bool $return true to return rather than echo. @since 7.7.0.
*/
function wc_print_notice( $message, $notice_type = 'success', $data = array(), $return = false ) {
if ( 'success' === $notice_type ) {
$message = apply_filters( 'woocommerce_add_message', $message );
}
$message = apply_filters( 'woocommerce_add_' . $notice_type, $message );
// Buffer output.
ob_start();
wc_get_template(
"notices/{$notice_type}.php",
array(
'messages' => array( $message ), // @deprecated 3.9.0
'notices' => array(
array(
'notice' => $message,
'data' => $data,
),
),
)
);
$notice = wc_kses_notice( ob_get_clean() );
if ( $return ) {
return $notice;
}
echo $notice; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Returns all queued notices, optionally filtered by a notice type.
*
* @since 2.1
* @version 3.9.0
* @param string $notice_type Optional. The singular name of the notice type - either error, success or notice.
* @return array[]
*/
function wc_get_notices( $notice_type = '' ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
return;
}
$notices = array();
if ( ! WC()->session ) {
return $notices;
}
$all_notices = WC()->session->get( 'wc_notices', array() );
if ( empty( $notice_type ) ) {
$notices = $all_notices;
} elseif ( isset( $all_notices[ $notice_type ] ) ) {
$notices = $all_notices[ $notice_type ];
}
return $notices;
}
/**
* Add notices for WP Errors.
*
* @param WP_Error $errors Errors.
*/
function wc_add_wp_error_notices( $errors ) {
if ( is_wp_error( $errors ) && $errors->get_error_messages() ) {
foreach ( $errors->get_error_messages() as $error ) {
wc_add_notice( $error, 'error' );
}
}
}
/**
* Filters out the same tags as wp_kses_post, but allows tabindex for element.
*
* @since 3.5.0
* @param string $message Content to filter through kses.
* @return string
*/
function wc_kses_notice( $message ) {
$allowed_tags = array_replace_recursive(
wp_kses_allowed_html( 'post' ),
array(
'a' => array(
'tabindex' => true,
),
)
);
/**
* Kses notice allowed tags.
*
* @since 3.9.0
* @param array[]|string $allowed_tags An array of allowed HTML elements and attributes, or a context name such as 'post'.
*/
return wp_kses( $message, apply_filters( 'woocommerce_kses_notice_allowed_tags', $allowed_tags ) );
}
/**
* Get notice data attribute.
*
* @since 3.9.0
* @param array $notice Notice data.
* @return string
*/
function wc_get_notice_data_attr( $notice ) {
if ( empty( $notice['data'] ) ) {
return;
}
$attr = '';
foreach ( $notice['data'] as $key => $value ) {
$attr .= sprintf(
' data-%1$s="%2$s"',
sanitize_title( $key ),
esc_attr( $value )
);
}
return $attr;
}