Hotel Raxa - Advanced Booking System Implementation
🏨 Hotel Booking Enhancements: - Implemented Eagle Booking Advanced Pricing add-on - Added Booking.com-style rate management system - Created professional calendar interface for pricing - Integrated deals and discounts functionality 💰 Advanced Pricing Features: - Dynamic pricing models (per room, per person, per adult) - Base rates, adult rates, and child rates management - Length of stay discounts and early bird deals - Mobile rates and secret deals implementation - Seasonal promotions and flash sales 📅 Availability Management: - Real-time availability tracking - Stop sell and restriction controls - Closed to arrival/departure functionality - Minimum/maximum stay requirements - Automatic sold-out management 💳 Payment Integration: - Maintained Redsys payment gateway integration - Seamless integration with existing Eagle Booking - No modifications to core Eagle Booking plugin 🛠️ Technical Implementation: - Custom database tables for advanced pricing - WordPress hooks and filters integration - AJAX-powered admin interface - Data migration from existing Eagle Booking - Professional calendar view for revenue management 📊 Admin Interface: - Booking.com-style management dashboard - Visual rate and availability calendar - Bulk operations for date ranges - Statistics and analytics dashboard - Modal dialogs for quick editing 🔧 Code Quality: - WordPress coding standards compliance - Secure database operations with prepared statements - Proper input validation and sanitization - Error handling and logging - Responsive admin interface 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,440 @@
|
||||
<?php
|
||||
/**
|
||||
* Background Field.
|
||||
*
|
||||
* @package ReduxFramework/Fields
|
||||
* @author Dovy Paukstys & Kevin Provance (kprovance)
|
||||
* @version 4.0.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
// Don't duplicate me!
|
||||
if ( ! class_exists( 'Redux_Background', false ) ) {
|
||||
|
||||
/**
|
||||
* Main Redux_background class
|
||||
*
|
||||
* @since 3.1.5
|
||||
*/
|
||||
class Redux_Background extends Redux_Field {
|
||||
|
||||
/**
|
||||
* Set field and value defaults.
|
||||
*/
|
||||
public function set_defaults() {
|
||||
$defaults = array(
|
||||
'background-color' => true,
|
||||
'background-repeat' => true,
|
||||
'background-attachment' => true,
|
||||
'background-position' => true,
|
||||
'background-image' => true,
|
||||
'background-gradient' => false,
|
||||
'background-clip' => false,
|
||||
'background-origin' => false,
|
||||
'background-size' => true,
|
||||
'preview_media' => false,
|
||||
'preview' => true,
|
||||
'preview_height' => '200px',
|
||||
'transparent' => true,
|
||||
);
|
||||
|
||||
$this->field = wp_parse_args( $this->field, $defaults );
|
||||
|
||||
// No errors please.
|
||||
$defaults = array(
|
||||
'background-color' => '',
|
||||
'background-repeat' => '',
|
||||
'background-attachment' => '',
|
||||
'background-position' => '',
|
||||
'background-image' => '',
|
||||
'background-clip' => '',
|
||||
'background-origin' => '',
|
||||
'background-size' => '',
|
||||
'media' => array(),
|
||||
);
|
||||
|
||||
$this->value = wp_parse_args( $this->value, $defaults );
|
||||
|
||||
$defaults = array(
|
||||
'id' => '',
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
'thumbnail' => '',
|
||||
);
|
||||
|
||||
$this->value['media'] = wp_parse_args( $this->value['media'], $defaults );
|
||||
}
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function render() {
|
||||
$this->select2_config['allowClear'] = true;
|
||||
|
||||
if ( isset( $this->field['select2'] ) ) {
|
||||
$this->field['select2'] = wp_parse_args( $this->field['select2'], $this->select2_config );
|
||||
} else {
|
||||
$this->field['select2'] = $this->select2_config;
|
||||
}
|
||||
|
||||
$this->field['select2'] = Redux_Functions::sanitize_camel_case_array_keys( $this->field['select2'] );
|
||||
|
||||
$select2_data = Redux_Functions::create_data_string( $this->field['select2'] );
|
||||
|
||||
if ( true === $this->field['background-color'] ) {
|
||||
if ( isset( $this->value['color'] ) && empty( $this->value['background-color'] ) ) {
|
||||
$this->value['background-color'] = $this->value['color'];
|
||||
}
|
||||
|
||||
$def_bg_color = $this->field['default']['background-color'] ?? '';
|
||||
|
||||
echo '<input ';
|
||||
echo 'data-id="' . esc_attr( $this->field['id'] ) . '"';
|
||||
echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-color]"';
|
||||
echo 'id="' . esc_attr( $this->field['id'] ) . '-color"';
|
||||
echo 'class="color-picker redux-color redux-background-input redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
|
||||
echo 'type="text" value="' . esc_attr( $this->value['background-color'] ) . '"';
|
||||
echo 'data-default-color="' . esc_attr( $def_bg_color ) . '"';
|
||||
|
||||
$data = array(
|
||||
'field' => $this->field,
|
||||
'index' => 'color',
|
||||
);
|
||||
|
||||
echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
|
||||
echo '>';
|
||||
|
||||
echo '<input type="hidden" class="redux-saved-color" id="' . esc_attr( $this->field['id'] ) . '-saved-color" value="">';
|
||||
|
||||
if ( ! isset( $this->field['transparent'] ) || false !== $this->field['transparent'] ) {
|
||||
$is_checked = '';
|
||||
if ( 'transparent' === $this->value['background-color'] ) {
|
||||
$is_checked = ' checked="checked"';
|
||||
}
|
||||
echo '<label for="' . esc_attr( $this->field['id'] ) . '-transparency" class="color-transparency-check"><input type="checkbox" class="checkbox color-transparency redux-background-input ' . esc_attr( $this->field['class'] ) . '" id="' . esc_attr( $this->field['id'] ) . '-transparency" data-id="' . esc_attr( $this->field['id'] ) . '-color" value="1" ' . esc_html( $is_checked ) . '> ' . esc_html__( 'Transparent', 'redux-framework' ) . '</label>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-repeat'] || true === $this->field['background-position'] || true === $this->field['background-attachment'] ) {
|
||||
echo '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-repeat'] ) {
|
||||
$array = array(
|
||||
'no-repeat' => esc_html__( 'No Repeat', 'redux-framework' ),
|
||||
'repeat' => esc_html__( 'Repeat All', 'redux-framework' ),
|
||||
'repeat-x' => esc_html__( 'Repeat Horizontally', 'redux-framework' ),
|
||||
'repeat-y' => esc_html__( 'Repeat Vertically', 'redux-framework' ),
|
||||
'inherit' => esc_html__( 'Inherit', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-repeat-select" data-placeholder="' . esc_html__( 'Background Repeat', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-repeat]" class="redux-select-item redux-background-input redux-background-repeat ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-repeat'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-clip'] ) {
|
||||
$array = array(
|
||||
'inherit' => esc_html__( 'Inherit', 'redux-framework' ),
|
||||
'border-box' => esc_html__( 'Border Box', 'redux-framework' ),
|
||||
'content-box' => esc_html__( 'Content Box', 'redux-framework' ),
|
||||
'padding-box' => esc_html__( 'Padding Box', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-clip-select" data-placeholder="' . esc_html__( 'Background Clip', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-clip]" class="redux-select-item redux-background-input redux-background-clip ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-clip'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-origin'] ) {
|
||||
$array = array(
|
||||
'inherit' => esc_html__( 'Inherit', 'redux-framework' ),
|
||||
'border-box' => esc_html__( 'Border Box', 'redux-framework' ),
|
||||
'content-box' => esc_html__( 'Content Box', 'redux-framework' ),
|
||||
'padding-box' => esc_html__( 'Padding Box', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-origin-select" data-placeholder="' . esc_html__( 'Background Origin', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-origin]" class="redux-select-item redux-background-input redux-background-origin ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-origin'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-size'] ) {
|
||||
$array = array(
|
||||
'inherit' => esc_html__( 'Inherit', 'redux-framework' ),
|
||||
'cover' => esc_html__( 'Cover', 'redux-framework' ),
|
||||
'contain' => esc_html__( 'Contain', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-size-select" data-placeholder="' . esc_html__( 'Background Size', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-size]" class="redux-select-item redux-background-input redux-background-size ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-size'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-attachment'] ) {
|
||||
$array = array(
|
||||
'fixed' => esc_html__( 'Fixed', 'redux-framework' ),
|
||||
'scroll' => esc_html__( 'Scroll', 'redux-framework' ),
|
||||
'inherit' => esc_html__( 'Inherit', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-attachment-select" data-placeholder="' . esc_html__( 'Background Attachment', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-attachment]" class="redux-select-item redux-background-input redux-background-attachment ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-attachment'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( true === $this->field['background-position'] ) {
|
||||
$array = array(
|
||||
'left top' => esc_html__( 'Left Top', 'redux-framework' ),
|
||||
'left center' => esc_html__( 'Left center', 'redux-framework' ),
|
||||
'left bottom' => esc_html__( 'Left Bottom', 'redux-framework' ),
|
||||
'center top' => esc_html__( 'Center Top', 'redux-framework' ),
|
||||
'center center' => esc_html__( 'Center Center', 'redux-framework' ),
|
||||
'center bottom' => esc_html__( 'Center Bottom', 'redux-framework' ),
|
||||
'right top' => esc_html__( 'Right Top', 'redux-framework' ),
|
||||
'right center' => esc_html__( 'Right center', 'redux-framework' ),
|
||||
'right bottom' => esc_html__( 'Right Bottom', 'redux-framework' ),
|
||||
);
|
||||
|
||||
echo '<select id="' . esc_attr( $this->field['id'] ) . '-position-select" data-placeholder="' . esc_html__( 'Background Position', 'redux-framework' ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-position]" class="redux-select-item redux-background-input redux-background-position ' . esc_attr( $this->field['class'] ) . '"' . esc_attr( $select2_data ) . '>';
|
||||
echo '<option></option>';
|
||||
|
||||
foreach ( $array as $k => $v ) {
|
||||
echo '<option value="' . esc_attr( $k ) . '" ' . selected( $this->value['background-position'], $k, false ) . '>' . esc_html( $v ) . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
if ( $this->field['background-image'] ) {
|
||||
echo '<br />';
|
||||
|
||||
if ( empty( $this->value ) && ! empty( $this->field['default'] ) ) {
|
||||
if ( is_array( $this->field['default'] ) ) {
|
||||
if ( ! empty( $this->field['default']['media']['id'] ) ) {
|
||||
$this->value['media']['id'] = $this->field['default']['media']['id'];
|
||||
} elseif ( ! empty( $this->field['default']['id'] ) ) {
|
||||
$this->value['media']['id'] = $this->field['default']['id'];
|
||||
}
|
||||
|
||||
if ( ! empty( $this->field['default']['url'] ) ) {
|
||||
$this->value['background-image'] = $this->field['default']['url'];
|
||||
} elseif ( ! empty( $this->field['default']['media']['url'] ) ) {
|
||||
$this->value['background-image'] = $this->field['default']['media']['url'];
|
||||
} elseif ( ! empty( $this->field['default']['background-image'] ) ) {
|
||||
$this->value['background-image'] = $this->field['default']['background-image'];
|
||||
}
|
||||
} elseif ( is_numeric( $this->field['default'] ) ) {
|
||||
// Check if it's an attachment ID.
|
||||
$this->value['media']['id'] = $this->field['default'];
|
||||
} else { // Must be a URL.
|
||||
$this->value['background-image'] = $this->field['default'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $this->value['background-image'] ) && ! empty( $this->value['media']['id'] ) ) {
|
||||
$img = wp_get_attachment_image_src( $this->value['media']['id'], 'full' );
|
||||
$this->value['background-image'] = $img[0];
|
||||
$this->value['media']['width'] = $img[1];
|
||||
$this->value['media']['height'] = $img[2];
|
||||
}
|
||||
|
||||
$hide = 'hide ';
|
||||
|
||||
if ( ( isset( $this->field['preview_media'] ) && false === $this->field['preview_media'] ) ) {
|
||||
$this->field['class'] .= ' noPreview';
|
||||
}
|
||||
|
||||
if ( ( ! empty( $this->field['background-image'] ) && true === $this->field['background-image'] ) || isset( $this->field['preview'] ) && false === $this->field['preview'] ) {
|
||||
$hide = '';
|
||||
}
|
||||
|
||||
$placeholder = $this->field['placeholder'] ?? esc_html__( 'No media selected', 'redux-framework' );
|
||||
|
||||
echo '<input placeholder="' . esc_html( $placeholder ) . '" type="text" class="redux-background-input ' . esc_attr( $hide ) . 'upload ' . esc_attr( $this->field['class'] ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[background-image]" id="' . esc_attr( $this->parent->args['opt_name'] ) . '[' . esc_attr( $this->field['id'] ) . '][background-image]" value="' . esc_url( $this->value['background-image'] ) . '" />';
|
||||
echo '<input type="hidden" class="upload-id ' . esc_attr( $this->field['class'] ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[media][id]" id="' . esc_attr( $this->parent->args['opt_name'] ) . '[' . esc_attr( $this->field['id'] ) . '][media][id]" value="' . esc_attr( $this->value['media']['id'] ) . '" />';
|
||||
echo '<input type="hidden" class="upload-height" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[media][height]" id="' . esc_attr( $this->parent->args['opt_name'] ) . '[' . esc_attr( $this->field['id'] ) . '][media][height]" value="' . esc_attr( $this->value['media']['height'] ) . '" />';
|
||||
echo '<input type="hidden" class="upload-width" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[media][width]" id="' . esc_attr( $this->parent->args['opt_name'] ) . '[' . esc_attr( $this->field['id'] ) . '][media][width]" value="' . esc_attr( $this->value['media']['width'] ) . '" />';
|
||||
echo '<input type="hidden" class="upload-thumbnail" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[media][thumbnail]" id="' . esc_attr( $this->parent->args['opt_name'] ) . '[' . esc_attr( $this->field['id'] ) . '][media][thumbnail]" value="' . esc_url( $this->value['media']['thumbnail'] ) . '" />';
|
||||
|
||||
// Preview.
|
||||
$hide = '';
|
||||
|
||||
if ( ( isset( $this->field['preview_media'] ) && false === $this->field['preview_media'] ) || empty( $this->value['background-image'] ) ) {
|
||||
$hide = 'hide ';
|
||||
}
|
||||
|
||||
if ( empty( $this->value['media']['thumbnail'] ) && ! empty( $this->value['background-image'] ) ) { // Just in case.
|
||||
if ( ! empty( $this->value['media']['id'] ) ) {
|
||||
$image = wp_get_attachment_image_src(
|
||||
$this->value['media']['id'],
|
||||
array(
|
||||
150,
|
||||
150,
|
||||
)
|
||||
);
|
||||
|
||||
$this->value['media']['thumbnail'] = $image[0];
|
||||
} else {
|
||||
$this->value['media']['thumbnail'] = $this->value['background-image'];
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="' . esc_attr( $hide ) . 'screenshot">';
|
||||
echo '<a class="of-uploaded-image" href="' . esc_url( $this->value['background-image'] ) . '" target="_blank">';
|
||||
|
||||
$alt = wp_prepare_attachment_for_js( $this->value['media']['id'] );
|
||||
$alt = $alt['alt'] ?? '';
|
||||
|
||||
echo '<img class="redux-option-image" id="image_' . esc_attr( $this->value['media']['id'] ) . '" src="' . esc_url( $this->value['media']['thumbnail'] ) . '" alt="' . esc_attr( $alt ) . '" target="_blank" rel="external" />';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
|
||||
// Upload controls DIV.
|
||||
echo '<div class="upload_button_div">';
|
||||
|
||||
// If the user has WP3.5+ show upload/remove button.
|
||||
echo '<span class="button redux-background-upload" id="' . esc_attr( $this->field['id'] ) . '-media">' . esc_html__( 'Upload', 'redux-framework' ) . '</span>';
|
||||
|
||||
$hide = '';
|
||||
if ( empty( $this->value['background-image'] ) || '' === $this->value['background-image'] ) {
|
||||
$hide = ' hide';
|
||||
}
|
||||
|
||||
echo '<span class="button removeCSS redux-remove-background' . esc_attr( $hide ) . '" id="reset_' . esc_attr( $this->field['id'] ) . '" rel="' . esc_attr( $this->field['id'] ) . '">' . esc_html__( 'Remove', 'redux-framework' ) . '</span>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview
|
||||
* */
|
||||
if ( ! isset( $this->field['preview'] ) || false !== $this->field['preview'] ) {
|
||||
$css = $this->css_style( $this->value );
|
||||
|
||||
$is_bg = strpos( $css, 'background-image' );
|
||||
|
||||
if ( empty( $css ) || ! $is_bg ) {
|
||||
$css = 'display:none;';
|
||||
}
|
||||
|
||||
$css .= 'height: ' . esc_attr( $this->field['preview_height'] ) . ';';
|
||||
echo '<p class="clear ' . esc_attr( $this->field['id'] ) . '_previewer background-preview" style="' . esc_attr( $css ) . '"> </p>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Function.
|
||||
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue() {
|
||||
if ( function_exists( 'wp_enqueue_media' ) ) {
|
||||
wp_enqueue_media();
|
||||
} elseif ( ! wp_script_is( 'media-upload' ) ) {
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
}
|
||||
|
||||
if ( ! wp_style_is( 'select2-css' ) ) {
|
||||
wp_enqueue_style( 'select2-css' );
|
||||
}
|
||||
|
||||
if ( ! wp_style_is( 'wp-color-picker' ) ) {
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
}
|
||||
|
||||
$dep_array = array( 'jquery', 'wp-color-picker', 'select2-js', 'redux-js' );
|
||||
|
||||
wp_enqueue_script(
|
||||
'redux-field-background',
|
||||
Redux_Core::$url . 'inc/fields/background/redux-background' . Redux_Functions::is_min() . '.js',
|
||||
$dep_array,
|
||||
$this->timestamp,
|
||||
true
|
||||
);
|
||||
|
||||
if ( $this->parent->args['dev_mode'] ) {
|
||||
wp_enqueue_style(
|
||||
'redux-field-background',
|
||||
Redux_Core::$url . 'inc/fields/background/redux-background.css',
|
||||
array(),
|
||||
$this->timestamp
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'redux-color-picker' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output CSS styling.
|
||||
*
|
||||
* @param array $data Value array.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function css_style( $data = array() ): string {
|
||||
$css = '';
|
||||
|
||||
if ( ! empty( $data ) && is_array( $data ) ) {
|
||||
foreach ( $data as $key => $val ) {
|
||||
if ( ! empty( $val ) && 'media' !== $key ) {
|
||||
if ( 'background-image' === $key ) {
|
||||
$css .= $key . ":url('" . esc_url( $val ) . "');";
|
||||
} else {
|
||||
$css .= $key . ':' . esc_attr( $val ) . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable output_variables to be generated.
|
||||
*
|
||||
* @since 4.0.3
|
||||
* @return void
|
||||
*/
|
||||
public function output_variables() {
|
||||
// No code needed, just defining the method is enough.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class_alias( 'Redux_Background', 'ReduxFramework_Background' );
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package Redux Framework
|
||||
*/
|
||||
|
||||
_deprecated_file( 'field_background.php', '4.3', 'class-redux-background.php', 'This file has been renamed and is no longer used in Redux 4. Please change any references to it as it will be removed in future versions of Redux.' );
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package Redux Framework
|
||||
*/
|
||||
|
||||
echo null;
|
||||
@@ -0,0 +1,17 @@
|
||||
.redux-main .redux-container-background .redux-background-position, .redux-main .redux-container-background .redux-background-position select, .redux-main .redux-container-background .redux-background-attachment, .redux-main .redux-container-background .redux-background-attachment select, .redux-main .redux-container-background .redux-background-clip, .redux-main .redux-container-background .redux-background-clip select, .redux-main .redux-container-background .redux-background-origin, .redux-main .redux-container-background .redux-background-origin select, .redux-main .redux-container-background .redux-background-size, .redux-main .redux-container-background .redux-background-size select, .redux-main .redux-container-background .redux-background-repeat, .redux-main .redux-container-background .redux-background-repeat select { width: 200px !important; margin-right: 10px; margin-bottom: 7px; }
|
||||
|
||||
.redux-main .redux-container-background .background-preview { display: block; width: 100%; margin: 5px 0 10px; border: 1px dotted #d3d3d3; }
|
||||
|
||||
.redux-main .redux-container-background .select2-container { margin-right: 10px; margin-bottom: 10px; }
|
||||
|
||||
.redux-main .redux-container-background .wp-picker-container { margin-bottom: 10px; }
|
||||
|
||||
.redux-main .redux-container-background .upload { width: 100%; margin-bottom: 8px; }
|
||||
|
||||
.redux-main .redux-container-select li.ui-state-highlight { height: 20px; margin-top: 2px; margin-left: 5px; width: 64px; margin-bottom: 0; }
|
||||
|
||||
.wp-customizer .redux-container-background .redux-background-position, .wp-customizer .redux-container-background .redux-background-position select, .wp-customizer .redux-container-background .redux-background-attachment, .wp-customizer .redux-container-background .redux-background-attachment select, .wp-customizer .redux-container-background .redux-background-clip, .wp-customizer .redux-container-background .redux-background-clip select, .wp-customizer .redux-container-background .redux-background-origin, .wp-customizer .redux-container-background .redux-background-origin select, .wp-customizer .redux-container-background .redux-background-size, .wp-customizer .redux-container-background .redux-background-size select, .wp-customizer .redux-container-background .redux-background-repeat, .wp-customizer .redux-container-background .redux-background-repeat select { width: 100% !important; }
|
||||
|
||||
/*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkdXgtYmFja2dyb3VuZC5jc3MiLCJzb3VyY2VzIjpbInJlZHV4LWJhY2tncm91bmQuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxBQUVRLFdBRkcsQ0FDUCwyQkFBMkIsQ0FDdkIsMEJBQTBCLEVBRmxDLFdBQVcsQ0FDUCwyQkFBMkIsQ0FFdkIsMEJBQTBCLENBQUMsTUFBTSxFQUh6QyxXQUFXLENBQ1AsMkJBQTJCLENBR3ZCLDRCQUE0QixFQUpwQyxXQUFXLENBQ1AsMkJBQTJCLENBSXZCLDRCQUE0QixDQUFDLE1BQU0sRUFMM0MsV0FBVyxDQUNQLDJCQUEyQixDQUt2QixzQkFBc0IsRUFOOUIsV0FBVyxDQUNQLDJCQUEyQixDQU12QixzQkFBc0IsQ0FBQyxNQUFNLEVBUHJDLFdBQVcsQ0FDUCwyQkFBMkIsQ0FPdkIsd0JBQXdCLEVBUmhDLFdBQVcsQ0FDUCwyQkFBMkIsQ0FRdkIsd0JBQXdCLENBQUMsTUFBTSxFQVR2QyxXQUFXLENBQ1AsMkJBQTJCLENBU3ZCLHNCQUFzQixFQVY5QixXQUFXLENBQ1AsMkJBQTJCLENBVXZCLHNCQUFzQixDQUFDLE1BQU0sRUFYckMsV0FBVyxDQUNQLDJCQUEyQixDQVd2Qix3QkFBd0IsRUFaaEMsV0FBVyxDQUNQLDJCQUEyQixDQVl2Qix3QkFBd0IsQ0FBQyxNQUFNLENBQUMsRUFDNUIsS0FBSyxFQUFFLGdCQUFnQixFQUN2QixZQUFZLEVBQUUsSUFBSSxFQUNsQixhQUFhLEVBQUUsR0FBRyxHQUNyQjs7QUFqQlQsQUFtQlEsV0FuQkcsQ0FDUCwyQkFBMkIsQ0FrQnZCLG1CQUFtQixDQUFDLEVBQ2hCLE9BQU8sRUFBRSxLQUFLLEVBQ2QsS0FBSyxFQUFFLElBQUksRUFDWCxNQUFNLEVBQUUsVUFBVSxFQUNsQixNQUFNLEVBQUUsa0JBQWtCLEdBQzdCOztBQXhCVCxBQTBCUSxXQTFCRyxDQUNQLDJCQUEyQixDQXlCdkIsa0JBQWtCLENBQUMsRUFDZixZQUFZLEVBQUUsSUFBSSxFQUNsQixhQUFhLEVBQUUsSUFBSSxHQUN0Qjs7QUE3QlQsQUErQlEsV0EvQkcsQ0FDUCwyQkFBMkIsQ0E4QnZCLG9CQUFvQixDQUFDLEVBQ2pCLGFBQWEsRUFBRSxJQUFJLEdBQ3RCOztBQWpDVCxBQW1DUSxXQW5DRyxDQUNQLDJCQUEyQixDQWtDdkIsT0FBTyxDQUFDLEVBQ0osS0FBSyxFQUFFLElBQUksRUFDWCxhQUFhLEVBQUUsR0FBRyxHQUNyQjs7QUF0Q1QsQUEwQ1EsV0ExQ0csQ0F5Q1AsdUJBQXVCLENBQ25CLEVBQUUsQUFBQSxtQkFBbUIsQ0FBQyxFQUNsQixNQUFNLEVBQUUsSUFBSSxFQUNaLFVBQVUsRUFBRSxHQUFHLEVBQ2YsV0FBVyxFQUFFLEdBQUcsRUFDaEIsS0FBSyxFQUFFLElBQUksRUFDWCxhQUFhLEVBQUUsQ0FBQyxHQUNuQjs7QUFJVCxBQUVRLGNBRk0sQ0FDViwyQkFBMkIsQ0FDdkIsMEJBQTBCLEVBRmxDLGNBQWMsQ0FDViwyQkFBMkIsQ0FFdkIsMEJBQTBCLENBQUMsTUFBTSxFQUh6QyxjQUFjLENBQ1YsMkJBQTJCLENBR3ZCLDRCQUE0QixFQUpwQyxjQUFjLENBQ1YsMkJBQTJCLENBSXZCLDRCQUE0QixDQUFDLE1BQU0sRUFMM0MsY0FBYyxDQUNWLDJCQUEyQixDQUt2QixzQkFBc0IsRUFOOUIsY0FBYyxDQUNWLDJCQUEyQixDQU12QixzQkFBc0IsQ0FBQyxNQUFNLEVBUHJDLGNBQWMsQ0FDViwyQkFBMkIsQ0FPdkIsd0JBQXdCLEVBUmhDLGNBQWMsQ0FDViwyQkFBMkIsQ0FRdkIsd0JBQXdCLENBQUMsTUFBTSxFQVR2QyxjQUFjLENBQ1YsMkJBQTJCLENBU3ZCLHNCQUFzQixFQVY5QixjQUFjLENBQ1YsMkJBQTJCLENBVXZCLHNCQUFzQixDQUFDLE1BQU0sRUFYckMsY0FBYyxDQUNWLDJCQUEyQixDQVd2Qix3QkFBd0IsRUFaaEMsY0FBYyxDQUNWLDJCQUEyQixDQVl2Qix3QkFBd0IsQ0FBQyxNQUFNLENBQUMsRUFDNUIsS0FBSyxFQUFFLGVBQWUsR0FDekIifQ== */
|
||||
|
||||
/*# sourceMappingURL=redux-background.css.map */
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,323 @@
|
||||
/**
|
||||
* Redux Background
|
||||
* Dependencies : jquery, wp media uploader
|
||||
* Feature added by : Dovy Paukstys
|
||||
* Date : 07 Jan 2014
|
||||
*/
|
||||
|
||||
/*global redux_change, wp, redux, colorValidate, jQuery */
|
||||
|
||||
(function( $ ) {
|
||||
'use strict';
|
||||
|
||||
redux.field_objects = redux.field_objects || {};
|
||||
redux.field_objects.background = redux.field_objects.background || {};
|
||||
|
||||
redux.field_objects.background.init = function( selector ) {
|
||||
selector = $.redux.getSelector( selector, 'background' );
|
||||
|
||||
$( selector ).each(
|
||||
function() {
|
||||
var el = $( this );
|
||||
var parent = el;
|
||||
|
||||
if ( ! el.hasClass( 'redux-field-container' ) ) {
|
||||
parent = el.parents( '.redux-field-container:first' );
|
||||
}
|
||||
|
||||
if ( parent.is( ':hidden' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( parent.hasClass( 'redux-field-init' ) ) {
|
||||
parent.removeClass( 'redux-field-init' );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the image button.
|
||||
el.find( '.redux-remove-background' ).off( 'click' ).on(
|
||||
'click',
|
||||
function( e ) {
|
||||
e.preventDefault();
|
||||
redux.field_objects.background.removeImage( $( this ).parents( '.redux-container-background:first' ) );
|
||||
redux.field_objects.background.preview( $( this ) );
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
// Upload media button.
|
||||
el.find( '.redux-background-upload' ).off().on(
|
||||
'click',
|
||||
function( event ) {
|
||||
redux.field_objects.background.addImage( event, $( this ).parents( '.redux-container-background:first' ) );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-background-input' ).on(
|
||||
'change',
|
||||
function() {
|
||||
redux.field_objects.background.preview( $( this ) );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-color' ).wpColorPicker(
|
||||
{
|
||||
change: function( e, ui ) {
|
||||
$( this ).val( ui.color.toString() );
|
||||
redux_change( $( this ) );
|
||||
$( '#' + e.target.id + '-transparency' ).prop( 'checked', false );
|
||||
redux.field_objects.background.preview( $( this ) );
|
||||
},
|
||||
|
||||
clear: function( e ) {
|
||||
e = null;
|
||||
redux_change( $( this ).parent().find( '.redux-color-init' ) );
|
||||
redux.field_objects.background.preview( $( this ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Replace and validate field on blur.
|
||||
el.find( '.redux-color' ).on(
|
||||
'blur',
|
||||
function() {
|
||||
var value = $( this ).val();
|
||||
var id = '#' + $( this ).attr( 'id' );
|
||||
|
||||
if ( 'transparent' === value ) {
|
||||
$( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' );
|
||||
|
||||
el.find( id + '-transparency' ).prop( 'checked', true );
|
||||
} else {
|
||||
if ( colorValidate( this ) === value ) {
|
||||
if ( 0 !== value.indexOf( '#' ) ) {
|
||||
$( this ).val( $( this ).data( 'oldcolor' ) );
|
||||
}
|
||||
}
|
||||
|
||||
el.find( id + '-transparency' ).prop( 'checked', false );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-color' ).on(
|
||||
'focus',
|
||||
function() {
|
||||
$( this ).data( 'oldcolor', $( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-color' ).on(
|
||||
'keyup',
|
||||
function() {
|
||||
var value = $( this ).val();
|
||||
var color = colorValidate( this );
|
||||
var id = '#' + $( this ).attr( 'id' );
|
||||
|
||||
if ( 'transparent' === value ) {
|
||||
$( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' );
|
||||
el.find( id + '-transparency' ).prop( 'checked', true );
|
||||
} else {
|
||||
el.find( id + '-transparency' ).prop( 'checked', false );
|
||||
|
||||
if ( color && color !== $( this ).val() ) {
|
||||
$( this ).val( color );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// When transparency checkbox is clicked.
|
||||
el.find( '.color-transparency' ).on(
|
||||
'click',
|
||||
function() {
|
||||
var prevColor;
|
||||
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
el.find( '.redux-saved-color' ).val( $( '#' + $( this ).data( 'id' ) ).val() );
|
||||
el.find( '#' + $( this ).data( 'id' ) ).val( 'transparent' );
|
||||
el.find( '#' + $( this ).data( 'id' ) ).parents( '.redux-field-container' ).find( '.wp-color-result' ).css( 'background-color', 'transparent' );
|
||||
} else {
|
||||
prevColor = $( this ).parents( '.redux-field-container' ).find( '.redux-saved-color' ).val();
|
||||
if ( '' === prevColor ) {
|
||||
prevColor = $( '#' + $( this ).data( 'id' ) ).data( 'default-color' );
|
||||
}
|
||||
el.find( '#' + $( this ).data( 'id' ) ).parents( '.redux-field-container' ).find( '.wp-color-result' ).css( 'background-color', prevColor );
|
||||
el.find( '#' + $( this ).data( 'id' ) ).val( prevColor );
|
||||
}
|
||||
|
||||
redux_change( $( this ) );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( ' .redux-background-repeat, .redux-background-clip, .redux-background-origin, .redux-background-size, .redux-background-attachment, .redux-background-position' ).select2();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// Update the background preview.
|
||||
redux.field_objects.background.preview = function( selector ) {
|
||||
var css;
|
||||
|
||||
var hide = true;
|
||||
var parent = $( selector ).parents( '.redux-container-background:first' );
|
||||
var preview = $( parent ).find( '.background-preview' );
|
||||
|
||||
if ( ! preview ) { // No preview present.
|
||||
return;
|
||||
}
|
||||
|
||||
css = 'height:' + preview.height() + 'px;';
|
||||
|
||||
$( parent ).find( '.redux-background-input' ).each(
|
||||
function() {
|
||||
var data = $( this ).serializeArray();
|
||||
|
||||
data = data[0];
|
||||
if ( data && data.name.indexOf( '[background-' ) !== - 1 ) {
|
||||
if ( '' !== data.value ) {
|
||||
hide = false;
|
||||
|
||||
data.name = data.name.split( '[background-' );
|
||||
data.name = 'background-' + data.name[1].replace( ']', '' );
|
||||
|
||||
if ( 'background-image' === data.name ) {
|
||||
css += data.name + ':url("' + data.value + '");';
|
||||
} else {
|
||||
css += data.name + ':' + data.value + ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if ( ! hide ) {
|
||||
preview.attr( 'style', css ).fadeIn();
|
||||
} else {
|
||||
preview.slideUp();
|
||||
}
|
||||
};
|
||||
|
||||
// Add a file via the wp.media function.
|
||||
redux.field_objects.background.addImage = function( event, selector ) {
|
||||
var frame;
|
||||
var jQueryel = $( this );
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if ( frame ) {
|
||||
frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media(
|
||||
{
|
||||
multiple: false,
|
||||
library: {
|
||||
|
||||
},
|
||||
title: jQueryel.data( 'choose' ),
|
||||
button: {
|
||||
text: jQueryel.data( 'update' )
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
frame.on(
|
||||
'select',
|
||||
function() {
|
||||
var thumbSrc;
|
||||
var height;
|
||||
var key;
|
||||
var object;
|
||||
|
||||
// Grab the selected attachment.
|
||||
var attachment = frame.state().get( 'selection' ).first();
|
||||
frame.close();
|
||||
|
||||
if ( 'image' !== attachment.attributes.type ) {
|
||||
return;
|
||||
}
|
||||
|
||||
selector.find( '.upload' ).val( attachment.attributes.url );
|
||||
selector.find( '.upload-id' ).val( attachment.attributes.id );
|
||||
selector.find( '.upload-height' ).val( attachment.attributes.height );
|
||||
selector.find( '.upload-width' ).val( attachment.attributes.width );
|
||||
|
||||
redux_change( $( selector ).find( '.upload-id' ) );
|
||||
|
||||
thumbSrc = attachment.attributes.url;
|
||||
|
||||
if ( 'undefined' !== typeof attachment.attributes.sizes && 'undefined' !== typeof attachment.attributes.sizes.thumbnail ) {
|
||||
thumbSrc = attachment.attributes.sizes.thumbnail.url;
|
||||
} else if ( 'undefined' !== typeof attachment.attributes.sizes ) {
|
||||
height = attachment.attributes.height;
|
||||
|
||||
for ( key in attachment.attributes.sizes ) {
|
||||
if ( attachment.attributes.sizes.hasOwnProperty( key ) ) {
|
||||
object = attachment.attributes.sizes[key];
|
||||
if ( object.height < height ) {
|
||||
height = object.height;
|
||||
thumbSrc = object.url;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
thumbSrc = attachment.attributes.icon;
|
||||
}
|
||||
|
||||
selector.find( '.upload-thumbnail' ).val( thumbSrc );
|
||||
|
||||
if ( ! selector.find( '.upload' ).hasClass( 'noPreview' ) ) {
|
||||
selector.find( '.screenshot' ).empty().hide().append( '<img class="redux-option-image" src="' + thumbSrc + '">' ).slideDown( 'fast' );
|
||||
}
|
||||
|
||||
selector.find( '.redux-remove-background' ).removeClass( 'hide' );
|
||||
selector.find( '.redux-background-input-properties' ).slideDown();
|
||||
|
||||
redux.field_objects.background.preview( selector.find( '.upload' ) );
|
||||
}
|
||||
);
|
||||
|
||||
// Finally, open the modal.
|
||||
frame.open();
|
||||
};
|
||||
|
||||
// Update the background preview.
|
||||
redux.field_objects.background.removeImage = function( selector ) {
|
||||
var screenshot;
|
||||
|
||||
// This shouldn't have been run...
|
||||
if ( ! selector.find( '.redux-remove-background' ).addClass( 'hide' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
selector.find( '.redux-remove-background' ).addClass( 'hide' ); // Hide "Remove" button.
|
||||
selector.find( '.upload' ).val( '' );
|
||||
selector.find( '.upload-id' ).val( '' );
|
||||
selector.find( '.upload-height' ).val( '' );
|
||||
selector.find( '.upload-width' ).val( '' );
|
||||
|
||||
redux_change( $( selector ).find( '.upload-id' ) );
|
||||
|
||||
selector.find( '.redux-background-input-properties' ).hide();
|
||||
|
||||
screenshot = selector.find( '.screenshot' );
|
||||
|
||||
// Hide the screenshot.
|
||||
screenshot.slideUp();
|
||||
|
||||
selector.find( '.remove-file' ).off();
|
||||
|
||||
// We don't display the upload button if .upload-notice is present
|
||||
// This means the user doesn't have the WordPress 3.5 Media Library Support.
|
||||
if ( $( '.section-upload .upload-notice' ).length > 0 ) {
|
||||
$( '.redux-background-upload' ).remove();
|
||||
}
|
||||
};
|
||||
})( jQuery );
|
||||
1
wp-content/plugins/eagle-booking/include/redux/inc/fields/background/redux-background.min.js
vendored
Normal file
1
wp-content/plugins/eagle-booking/include/redux/inc/fields/background/redux-background.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,70 @@
|
||||
.redux-main {
|
||||
.redux-container-background {
|
||||
.redux-background-position,
|
||||
.redux-background-position select,
|
||||
.redux-background-attachment,
|
||||
.redux-background-attachment select,
|
||||
.redux-background-clip,
|
||||
.redux-background-clip select,
|
||||
.redux-background-origin,
|
||||
.redux-background-origin select,
|
||||
.redux-background-size,
|
||||
.redux-background-size select,
|
||||
.redux-background-repeat,
|
||||
.redux-background-repeat select {
|
||||
width: 200px !important;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.background-preview {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: 5px 0 10px;
|
||||
border: 1px dotted #d3d3d3;
|
||||
}
|
||||
|
||||
.select2-container {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wp-picker-container {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 100%;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-container-select {
|
||||
li.ui-state-highlight {
|
||||
height: 20px;
|
||||
margin-top: 2px;
|
||||
margin-left: 5px;
|
||||
width: 64px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-customizer {
|
||||
.redux-container-background {
|
||||
.redux-background-position,
|
||||
.redux-background-position select,
|
||||
.redux-background-attachment,
|
||||
.redux-background-attachment select,
|
||||
.redux-background-clip,
|
||||
.redux-background-clip select,
|
||||
.redux-background-origin,
|
||||
.redux-background-origin select,
|
||||
.redux-background-size,
|
||||
.redux-background-size select,
|
||||
.redux-background-repeat,
|
||||
.redux-background-repeat select {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user