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:
Hotel Raxa Dev
2025-07-11 07:43:22 +02:00
commit 5b1e2453c7
9816 changed files with 2784509 additions and 0 deletions

View File

@@ -0,0 +1,810 @@
<?php // phpcs:ignore WordPress.NamingConventions.ValidFunctionName
/**
* Redux Framework Metaboxes API Class
* Makes instantiating a Redux Metabox object an absolute piece of cake.
*
* @package Redux_Framework
* @author Dovy Paukstys
* @subpackage Core
* @noinspection PhpUnused
*/
defined( 'ABSPATH' ) || exit;
// Don't duplicate me!
if ( ! class_exists( 'Redux_Metaboxes' ) ) {
/**
* Redux Metaboxes API Class
* Simple API for Redux Framework
*
* @since 1.0.0
*/
class Redux_Metaboxes {
/**
* Boxes array.
*
* @var array
*/
public static $boxes = array();
/**
* Sections array.
*
* @var array
*/
public static $sections = array();
/**
* Fields array.
*
* @var array
*/
public static $fields = array();
/**
* Priority array.
*
* @var array
*/
public static $priority = array();
/**
* Errors array.
*
* @var array
*/
public static $errors = array();
/**
* Init array.
*
* @var array
*/
public static $init = array();
/**
* Args array.
*
* @var array
*/
public static $args = array();
/**
* Code has run flag.
*
* @var bool
*/
public static $has_run = false;
/**
* Class load.
*/
public static function load() {
if ( version_compare( PHP_VERSION, '5.5.0', '<' ) ) {
include_once Redux_Core::$dir . 'inc/lib/array-column.php';
}
add_action( 'init', array( 'Redux_Metaboxes', 'enqueue' ), 99 );
}
/**
* Enqueue function.
*
* @throws ReflectionException Exception.
*/
public static function enqueue() {
global $pagenow;
// Check and run instances of Redux where the opt_name hasn't been run.
$pagenows = array( 'post-new.php', 'post.php' );
if ( ! empty( self::$sections ) && in_array( $pagenow, $pagenows, true ) ) {
$instances = ReduxFrameworkInstances::get_all_instances();
foreach ( self::$fields as $opt_name => $fields ) {
if ( ! isset( $instances[ $opt_name ] ) ) {
Redux::set_args(
$opt_name,
array(
'menu_type' => 'hidden',
)
);
Redux::set_sections(
$opt_name,
array(
array(
'id' => 'EXTENSION_FAKE_ID' . $opt_name,
'fields' => $fields,
'title' => 'N/A',
),
)
);
Redux::init( $opt_name );
$instances = ReduxFrameworkInstances::get_all_instances();
add_action( 'admin_enqueue_scripts', array( $instances[ $opt_name ], 'enqueue' ), 1 );
}
}
}
}
/**
* Filter Metaboxes function.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function filterMetaboxes() { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::filter_metaboxes()' );
self::filter_metaboxes();
}
/**
* Filter Metaboxes function.
*/
public static function filter_metaboxes() {
if ( true === self::$has_run ) {
return;
}
if ( ! class_exists( 'ReduxFramework' ) ) {
echo '<div id="message" class="error"><p>Redux Framework is <strong>not installed</strong>. Please install it.</p></div>';
return;
}
foreach ( self::$boxes as $opt_name => $the_boxes ) {
if ( ! self::$init[ $opt_name ] ) {
// phpcs:ignore WordPress.NamingConventions.ValidHookName
add_action( 'redux/metaboxes/' . $opt_name . '/boxes', array( 'Redux_Metaboxes', 'addMetaboxes' ), 2 );
}
}
self::$has_run = true;
}
/**
* Construct the global args array.
*
* @param string $opt_name Panel opt_name.
*
* @return mixed
* @deprecated 4.0.0 No more camelCase.
*/
public static function constructArgs( string $opt_name ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::construct_args( $opt_name )' );
return self::construct_args( $opt_name );
}
/**
* Construct the global args array.
*
* @param string $opt_name Panel opt_name.
*
* @return mixed
*/
public static function construct_args( string $opt_name ) {
Redux_Functions_Ex::record_caller( $opt_name );
$args = self::$args[ $opt_name ];
$args['opt_name'] = $opt_name;
if ( ! isset( $args['menu_title'] ) ) {
$args['menu_title'] = ucfirst( $opt_name ) . ' Options';
}
if ( ! isset( $args['page_title'] ) ) {
$args['page_title'] = ucfirst( $opt_name ) . ' Options';
}
if ( ! isset( $args['page_slug'] ) ) {
$args['page_slug'] = $opt_name . '_options';
}
return $args;
}
/**
* Construct metabox boxes array.
*
* @param string $opt_name Panel opt_name.
*
* @return array
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function constructBoxes( string $opt_name ): array { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::construct_boxes( $opt_name )' );
return self::construct_boxes( $opt_name );
}
/**
* Construct metabox boxes array.
*
* @param string $opt_name Panel opt_name.
*
* @return array
*/
public static function construct_boxes( string $opt_name ): array {
Redux_Functions_Ex::record_caller( $opt_name );
$boxes = array();
if ( ! isset( self::$boxes[ $opt_name ] ) ) {
return $boxes;
}
foreach ( self::$boxes[ $opt_name ] as $box ) {
$box['sections'] = self::construct_sections( $opt_name, $box['id'] );
$boxes[] = $box;
}
ksort( $boxes );
return $boxes;
}
/**
* Construct sections.
*
* @param string $opt_name Panel opt_name.
* @param string $box_id Metabox ID.
*
* @return array
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function constructSections( string $opt_name, string $box_id ): array { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::construct_sections( $opt_name, $box_id )' );
return self::construct_sections( $opt_name, $box_id );
}
/**
* Construct sections.
*
* @param string $opt_name Panel opt_name.
* @param string $box_id Metabox ID.
*
* @return array
*/
public static function construct_sections( string $opt_name, string $box_id ): array {
Redux_Functions_Ex::record_caller( $opt_name );
$sections = array();
if ( ! isset( self::$sections[ $opt_name ] ) ) {
return $sections;
}
foreach ( self::$sections[ $opt_name ] as $section_id => $section ) {
if ( $box_id === $section['box_id'] ) {
$p = $section['priority'];
while ( isset( $sections[ $p ] ) ) {
echo esc_html( $p++ );
}
$section['fields'] = self::construct_fields( $opt_name, $section_id );
$sections[ $p ] = $section;
}
}
ksort( $sections );
return $sections;
}
/**
* Construct fields.
*
* @param string $opt_name Panel opt_name.
* @param string|int $section_id Section ID.
*
* @return array
* @deprecated 4.0.0 No moe camelCase.
*/
public static function constructFields( string $opt_name = '', $section_id = '' ): array { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::construct_fields( $opt_name, $section_id )' );
return self::construct_fields( $opt_name, $section_id );
}
/**
* Construct fields.
*
* @param string $opt_name Panel opt_name.
* @param string|int $section_id Section ID.
*
* @return array
*/
public static function construct_fields( string $opt_name = '', $section_id = '' ): array {
Redux_Functions_Ex::record_caller( $opt_name );
$fields = array();
if ( ! isset( self::$fields[ $opt_name ] ) ) {
return $fields;
}
foreach ( self::$fields[ $opt_name ] as $field ) {
if ( $section_id === $field['section_id'] ) {
$p = $field['priority'];
while ( isset( $fields[ $p ] ) ) {
echo esc_html( $p++ );
}
$fields[ $p ] = $field;
}
}
ksort( $fields );
return $fields;
}
/**
* Retrieve the section array.
*
* @param string $opt_name Panel opt_name.
* @param string|int $id Section ID.
*
* @deprecated 4.0.0 No more camelCase.
*
* @return bool
*/
public static function getSection( string $opt_name = '', $id = '' ): bool { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::get_section( $opt_name, $id )' );
return self::get_section( $opt_name, $id );
}
/**
* Retrieve section ID.
*
* @param string $opt_name Panel opt_name.
* @param string|int $id Section ID.
*
* @return bool
*/
public static function get_section( string $opt_name = '', $id = '' ): bool {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( ! isset( self::$sections[ $opt_name ][ $id ] ) ) {
$id = strtolower( sanitize_html_class( $id ) );
}
return self::$sections[ $opt_name ][ $id ] ?? false;
}
return false;
}
/**
* Set section array.
*
* @param string $opt_name Panel opt_name.
* @param array $section Section array.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function setSection( string $opt_name = '', array $section = array() ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::set_section( $opt_name, $section )' );
self::set_section( $opt_name, $section );
}
/**
* Set section array.
*
* @param string $opt_name Panel opt_name.
* @param array $section Section array.
*/
public static function set_section( string $opt_name = '', array $section = array() ) {
Redux_Functions_Ex::record_caller( $opt_name );
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && is_array( $section ) && ! empty( $section ) ) {
if ( ! isset( $section['id'] ) ) {
if ( isset( $section['title'] ) ) {
$section['id'] = strtolower( sanitize_html_class( $section['title'] ) );
} else {
$section['id'] = 'section';
}
if ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) {
$orig = $section['id'];
$i = 0;
while ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) {
$section['id'] = $orig . '_' . $i;
++$i;
}
}
}
if ( ! isset( $section['priority'] ) ) {
$section['priority'] = self::get_priority( $opt_name, 'sections' );
}
if ( isset( $section['fields'] ) ) {
if ( ! empty( $section['fields'] ) && is_array( $section['fields'] ) ) {
self::process_fields_array( $opt_name, $section['id'], $section['fields'] );
}
unset( $section['fields'] );
}
self::$sections[ $opt_name ][ $section['id'] ] = $section;
} else {
self::$errors[ $opt_name ]['section']['empty'] = esc_html__( 'Unable to create a section due an empty section array or the section variable passed was not an array.', 'redux-framework' );
}
}
/**
* Process section arrays.
*
* @param string $opt_name Panel opt_name.
* @param string|int $box_id Box ID.
* @param array $sections Sections array.
*/
public static function process_sections_array( string $opt_name = '', $box_id = '', array $sections = array() ) {
if ( ! empty( $opt_name ) && ! empty( $box_id ) && is_array( $sections ) && ! empty( $sections ) ) {
foreach ( $sections as $section ) {
if ( ! is_array( $section ) ) {
continue;
}
$section['box_id'] = $box_id;
if ( ! isset( $section['fields'] ) || ! is_array( $section['fields'] ) ) {
$section['fields'] = array();
}
self::set_section( $opt_name, $section );
}
}
}
/**
* Process Field arrays.
*
* @param string $opt_name Panel opt_name.
* @param string|int $section_id Section ID.
* @param array $fields Field arrays.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function processFieldsArray( string $opt_name = '', $section_id = '', array $fields = array() ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::process_fields_array( $opt_name, $section_id, $fields )' );
self::process_fields_array( $opt_name, $section_id, $fields );
}
/**
* Process Field arrays.
*
* @param string $opt_name Panel opt_name.
* @param string|int $section_id Section ID.
* @param array $fields Field arrays.
*/
public static function process_fields_array( string $opt_name = '', $section_id = '', array $fields = array() ) {
if ( ! empty( $opt_name ) && ! empty( $section_id ) && is_array( $fields ) && ! empty( $fields ) ) {
foreach ( $fields as $field ) {
if ( ! is_array( $field ) ) {
continue;
}
$field['section_id'] = $section_id;
self::set_field( $opt_name, $field );
}
}
}
/**
* Retrieves the field array.
*
* @param string $opt_name Panel opt_name.
* @param string|int $id Field ID.
*
* @deprecated 4.0.0 No more camelCase.
*
* @return bool
*/
public static function getField( string $opt_name = '', $id = '' ): bool { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::get_field( $opt_name, $id )' );
return self::get_field( $opt_name, $id );
}
/**
* Retrieves the field array.
*
* @param string $opt_name Panel opt_name.
* @param string|int $id Field ID.
*
* @return bool
*/
public static function get_field( string $opt_name = '', $id = '' ): bool {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
return self::$fields[ $opt_name ][ $id ] ?? false;
}
return false;
}
/**
* Set field array.
*
* @param string $opt_name Panel opt_name.
* @param array $field Field array.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function setField( string $opt_name = '', array $field = array() ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::set_field( $opt_name, $field )' );
self::set_field( $opt_name, $field );
}
/**
* Set field array.
*
* @param string $opt_name Panel opt_name.
* @param array $field Field array.
*/
public static function set_field( string $opt_name = '', array $field = array() ) {
Redux_Functions_Ex::record_caller( $opt_name );
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && is_array( $field ) && ! empty( $field ) ) {
if ( ! isset( $field['priority'] ) ) {
$field['priority'] = self::get_priority( $opt_name, 'fields' );
}
self::$fields[ $opt_name ][ $field['id'] ] = $field;
}
}
/**
* Set metabox box.
*
* @param string $opt_name Panel opt_name.
* @param array $box Box array.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function setBox( string $opt_name = '', array $box = array() ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::set_box( $opt_name, $box )' );
self::set_box( $opt_name, $box );
}
/**
* Set metabox box.
*
* @param string $opt_name Panel opt_name.
* @param array $box Box array.
*/
public static function set_box( string $opt_name = '', array $box = array() ) {
Redux_Functions_Ex::record_caller( $opt_name );
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && is_array( $box ) && ! empty( $box ) ) {
if ( ! isset( $box['id'] ) ) {
if ( isset( $box['title'] ) ) {
$box['id'] = strtolower( sanitize_html_class( $box['title'] ) );
} else {
$box['id'] = 'box';
}
if ( isset( self::$boxes[ $opt_name ][ $box['id'] ] ) ) {
$orig = $box['id'];
$i = 0;
while ( isset( self::$boxes[ $opt_name ][ $box['id'] ] ) ) {
$box['id'] = $orig . '_' . $i;
++$i;
}
}
}
if ( isset( $box['sections'] ) ) {
if ( ! empty( $box['sections'] ) && is_array( $box['sections'] ) ) {
self::process_sections_array( $opt_name, $box['id'], $box['sections'] );
}
unset( $box['sections'] );
}
self::$boxes[ $opt_name ][ $box['id'] ] = $box;
} else {
self::$errors[ $opt_name ]['box']['empty'] = esc_html__( 'Unable to create a box due an empty box array or the box variable passed was not an array.', 'redux-framework' );
}
}
/**
* Set Metaboxes.
*
* @param string $opt_name Panel opt_name.
* @param array $boxes Boxes array.
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function setBoxes( string $opt_name = '', array $boxes = array() ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::set_boxes( $opt_name, $boxes )' );
self::set_boxes( $opt_name, $boxes );
}
/**
* Set Metaboxes.
*
* @param string $opt_name Panel opt_name.
* @param array $boxes Boxes array.
*/
public static function set_boxes( string $opt_name = '', array $boxes = array() ) {
Redux_Functions_Ex::record_caller( $opt_name );
if ( ! empty( $boxes ) && is_array( $boxes ) ) {
foreach ( $boxes as $box ) {
self::set_box( $opt_name, $box );
}
}
}
/**
* Retrieve Metabox arrays.
*
* @param string $opt_name Panel opt_name.
*
* @deprecated 4.0.0 No more camelCase.
*
* @return mixed
*/
public static function getBoxes( string $opt_name = '' ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::get_boxes( $opt_name )' );
return self::get_boxes( $opt_name );
}
/**
* Retrieve Metabox arrays.
*
* @param string $opt_name Panel opt_name.
*
* @return mixed
*/
public static function get_boxes( string $opt_name = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( self::$boxes[ $opt_name ] ) ) {
return self::$boxes[ $opt_name ];
}
return null;
}
/**
* Get Metabox box.
*
* @param string $opt_name Panel opt_name.
* @param string $key Box key.
*
* @deprecated 4.0.0 No more camelCase.
*
* @return mixed
*/
public static function getBox( string $opt_name = '', string $key = '' ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::get_box( $opt_name, $key )' );
return self::get_box( $opt_name, $key );
}
/**
* Get Metabox box.
*
* @param string $opt_name Panel opt_name.
* @param string $key Box key.
*
* @return mixed
*/
public static function get_box( string $opt_name = '', string $key = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $key ) && ! empty( self::$boxes[ $opt_name ] ) && isset( self::$boxes[ $opt_name ][ $key ] ) ) {
return self::$boxes[ $opt_name ][ $key ];
}
return null;
}
/**
* Get priority.
*
* @param string $opt_name Panel opt_name.
* @param string $type Type.
*
* @return mixed
*
* @deprecated 4.0.0 No more camelCase.
*/
public static function getPriority( string $opt_name, string $type ) { // phpcs:ignore: WordPress.NamingConventions.ValidFunctionName
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'Redux 4.3', __CLASS__ . '::get_priority( $opt_name, $type )' );
return self::get_priority( $opt_name, $type );
}
/**
* Get priority.
*
* @param string $opt_name Panel opt_name.
* @param string $type Type.
*
* @return mixed
*/
public static function get_priority( string $opt_name, string $type ) {
$priority = self::$priority[ $opt_name ][ $type ];
self::$priority[ $opt_name ][ $type ] += 1;
return $priority;
}
/**
* Check opt_name.
*
* @param string $opt_name Panel opt_name.
*/
public static function check_opt_name( string $opt_name = '' ) {
if ( empty( $opt_name ) || is_array( $opt_name ) ) {
return;
}
if ( ! isset( self::$boxes[ $opt_name ] ) ) {
self::$boxes[ $opt_name ] = array();
}
if ( ! isset( self::$priority[ $opt_name ] ) ) {
self::$priority[ $opt_name ]['args'] = 1;
}
if ( ! isset( self::$sections[ $opt_name ] ) ) {
self::$sections[ $opt_name ] = array();
self::$priority[ $opt_name ]['sections'] = 1;
}
if ( ! isset( self::$fields[ $opt_name ] ) ) {
self::$fields[ $opt_name ] = array();
self::$priority[ $opt_name ]['fields'] = 1;
}
if ( ! isset( self::$errors[ $opt_name ] ) ) {
self::$errors[ $opt_name ] = array();
}
if ( ! isset( self::$init[ $opt_name ] ) ) {
self::$init[ $opt_name ] = false;
}
if ( ! isset( self::$args[ $opt_name ] ) ) {
self::$args[ $opt_name ] = false;
}
}
}
Redux_Metaboxes::load();
}

View File

@@ -0,0 +1,8 @@
<?php
/**
* Silence is golden.
*
* @package Redux Framework
*/
echo null;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,147 @@
/* global reduxMetaboxes */
jQuery(
function ( $ ) {
'use strict';
var isGutenberg = false;
$.reduxMetaBoxes = $.reduxMetaBoxes || {};
$( document ).ready(
function () {
$.reduxMetaBoxes.init();
if ( $( 'body' ).hasClass( 'block-editor-page' ) ) {
isGutenberg = true;
}
}
);
setTimeout(
function () {
if ( true === isGutenberg ) {
$( '.postbox .toggle-indicator' ).removeClass( 'toggle-indicator' ).addClass( 'el' );
}
$( '#publishing-action .button, #save-action .button, .editor-post-publish-button' ).on(
'click',
function () {
$( '.redux-save-warn' ).slideUp();
window.onbeforeunload = null;
}
);
},
1000
);
$.reduxMetaBoxes.init = function () {
$.reduxMetaBoxes.notLoaded = true;
$.redux.initFields();
if ( $( 'body' ).hasClass( 'block-editor-page' ) ) {
isGutenberg = true;
}
if ( isGutenberg ) {
setTimeout(
function () {
$.reduxMetaBoxes.checkBoxVisibility();
$( '.editor-post-format__content select, .editor-post-format select' ).on(
'change',
function () {
$.reduxMetaBoxes.checkBoxVisibility( 'post_format' );
}
);
$( '.edit-post-post-template__toggle' ).on(
'click',
function () {
setTimeout(
function () {
$( '.components-popover .components-select-control__input' ).on(
'change',
function () {
$.reduxMetaBoxes.checkBoxVisibility( 'page_template' );
}
);
},
1000
);
}
);
},
1000
);
} else {
$.reduxMetaBoxes.checkBoxVisibility();
$( '#page_template' ).on(
'change',
function () {
$.reduxMetaBoxes.checkBoxVisibility( 'page_template' );
}
);
$( 'input[name="post_format"]:radio' ).on(
'change',
function () {
$.reduxMetaBoxes.checkBoxVisibility( 'post_format' );
}
);
}
};
$.reduxMetaBoxes.checkBoxVisibility = function ( fieldID ) {
if ( 0 !== reduxMetaboxes.length ) {
$.each(
reduxMetaboxes,
function ( box, values ) {
$.each(
values,
function ( field, v ) {
var visible = false;
var testValue;
if ( field === fieldID || ! fieldID ) {
if ( 'post_format' === field ) {
if ( isGutenberg ) {
testValue = $( '.editor-post-format__content select option:selected, .editor-post-format select option:Selected' ).val();
} else {
testValue = $( 'input:radio[name="post_format"]:checked' ).val();
}
} else {
testValue = $( '#' + field ).val();
}
if ( testValue ) {
$.each(
v,
function ( key, val ) {
if ( val === testValue ) {
visible = true;
}
}
);
if ( ! visible && ! $.reduxMetaBoxes.notLoaded ) {
$( '#' + box ).hide();
} else if ( ! visible ) {
$( '#' + box ).hide();
} else {
$( '#' + box ).fadeIn( '300' );
$.redux.initFields();
}
}
}
}
);
}
);
}
};
}
);

View File

@@ -0,0 +1 @@
jQuery(function(s){"use strict";var c=!1;s.reduxMetaBoxes=s.reduxMetaBoxes||{},s(document).ready(function(){s.reduxMetaBoxes.init(),s("body").hasClass("block-editor-page")&&(c=!0)}),setTimeout(function(){!0===c&&s(".postbox .toggle-indicator").removeClass("toggle-indicator").addClass("el"),s("#publishing-action .button, #save-action .button, .editor-post-publish-button").on("click",function(){s(".redux-save-warn").slideUp(),window.onbeforeunload=null})},1e3),s.reduxMetaBoxes.init=function(){s.reduxMetaBoxes.notLoaded=!0,s.redux.initFields(),(c=s("body").hasClass("block-editor-page")?!0:c)?setTimeout(function(){s.reduxMetaBoxes.checkBoxVisibility(),s(".editor-post-format__content select, .editor-post-format select").on("change",function(){s.reduxMetaBoxes.checkBoxVisibility("post_format")}),s(".edit-post-post-template__toggle").on("click",function(){setTimeout(function(){s(".components-popover .components-select-control__input").on("change",function(){s.reduxMetaBoxes.checkBoxVisibility("page_template")})},1e3)})},1e3):(s.reduxMetaBoxes.checkBoxVisibility(),s("#page_template").on("change",function(){s.reduxMetaBoxes.checkBoxVisibility("page_template")}),s('input[name="post_format"]:radio').on("change",function(){s.reduxMetaBoxes.checkBoxVisibility("post_format")}))},s.reduxMetaBoxes.checkBoxVisibility=function(a){0!==reduxMetaboxes.length&&s.each(reduxMetaboxes,function(n,e){s.each(e,function(e,t){var o,i=!1;e!==a&&a||(o=s("post_format"===e?c?".editor-post-format__content select option:selected, .editor-post-format select option:Selected":'input:radio[name="post_format"]:checked':"#"+e).val())&&(s.each(t,function(e,t){t===o&&(i=!0)}),(i||s.reduxMetaBoxes.notLoaded)&&i?(s("#"+n).fadeIn("300"),s.redux.initFields()):s("#"+n).hide())})})}});

View File

@@ -0,0 +1,358 @@
.block-editor-page {
.postbox{
&.closed .el {
&:before {
content: ""!important;
}
}
.el{
&:before{
content: ""
}
}
}
}
.postbox {
.redux_field_th {
padding-bottom: 0 !important;
}
.redux-group-tab {
margin-bottom: 0 !important;
}
.redux-container {
filter: none;
border: none;
-moz-border-radius: 0;
/* Firefox */
-webkit-border-radius: 0;
/* Safari, Chrome */
border-radius: 0;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
.redux-group-menu .active a {
background: #FFF;
}
.redux-section-title {
padding-left: 0 !important;
margin-bottom: 15px !important;
}
.redux-section-desc {
margin-bottom: 20px;
}
.redux_main {
border-left: 1px solid #D8D8D8;
-webkit-box-shadow: none;
box-shadow: none;
input[type=text] {
width: 95%;
}
}
&.redux-no-sections {
margin: 0;
background: none;
.redux-main {
background: none;
margin-left: inherit;
padding: inherit;
border-left: none !important;
min-height: 0 !important;
tr {
&:last-child {
border-bottom: none;
}
&:last-child {
th,
td {
padding-bottom: 0;
}
}
td {
//padding-top: 20px !important;
padding-top: 10px !important;
width: 100%;
}
}
.form-table:first-child tr:first-child td {
padding-top: 0 !important;
}
.redux-field {
margin-bottom: 10px !important;
}
.redux-field:last-child {
margin-bottom: 0 !important;
}
}
}
&.redux-has-sections {
.redux-main {
background: #fff;
span.description {
padding-bottom: 20px;
}
}
}
}
.redux-main h3 {
cursor: text !important;
-webkit-user-select: inherit !important;
-moz-user-select: inherit !important;
user-select: inherit !important;
padding-left: 0 !important;
}
}
.redux-box-side {
.redux-main {
.redux-field-container {
padding: 5px 0 0;
.select2-container,
select {
width: 100% !important;
}
}
}
.form-table {
tr {
td {
padding: 15px 0 !important;
}
&:last-child td {
padding-bottom: 0 !important;
}
&:first-child td {
padding-top: 5px !important;
}
}
}
}
#poststuff .redux-metabox h3.hndle,
.metabox-holder .redux-metabox h3.hndle {
cursor: pointer;
border-bottom: 0;
}
.display-group {
display: inherit !important;
}
/* Metaboxes CSS overrides */
@media (min-width: 1125px) and (max-width: 1405px) {
.postbox {
table.form-table,
.form-table > thead,
.form-table > tbody,
.form-table > tbody > tr > th,
.form-table > tbody > tr > td,
.form-table > tbody > tr {
display: block !important;
width: 100% !important;
padding: 0 !important;
&.hide {
display: none !important;
}
}
.form-table > tbody > tr {
> th,
> td {
padding: 10px !important;
}
}
.form-table > tbody > tr > th {
width: 35%;
}
}
}
.redux-metabox .form-table th,
.redux-metabox .form-table td {
margin: 0;
padding: 0;
/* width: auto;*/
}
.redux-box-side .redux-main .redux-field-container {
.select2-container,
select {
width: 96% !important;
}
}
@media (max-width: 1405px) {
.redux-box-side .redux-main .redux-field-container {
.select2-container,
select {
width: 92% !important;
}
}
}
@media (max-width: 1125px) {
.redux-box-side .redux-main .redux-field-container {
.select2-container,
select {
width: 100% !important;
}
}
}
@media (max-width: 1405px) {
.redux-main {
.form-table > tbody > tr > td {
padding-top: 0 !important;
padding-bottom: 0 !important;
}
.redux-field-container {
padding: 0 0 20px 0 !important;
padding-bottom: 10px !important;
}
}
.postbox .form-table > tbody > tr > th {
padding-bottom: 0 !important;
}
.redux_field_th {
padding-top: 0 !important;
padding-bottom: 10px !important;
}
}
.redux-no-sections .redux-group-tab {
display: block !important;
}
@mixin metaboxesAdminThemeColorOverrides ($darkColor, $textColor) {
#poststuff .redux-metabox h3.hndle,
.metabox-holder .redux-metabox h3.hndle {
background: $darkColor;
color: $textColor;
}
}
/* Light fresh theme */
.admin-color-fresh {
@include metaboxesAdminThemeColorOverrides(#222222, #fff);
}
/* Light admin theme */
.admin-color-light {
@include metaboxesAdminThemeColorOverrides(#888888, #fff);
}
/* Blue admin theme */
.admin-color-blue {
@include metaboxesAdminThemeColorOverrides(#096484, #fff);
}
/* Coffee admin theme */
.admin-color-coffee {
@include metaboxesAdminThemeColorOverrides(#46403c, #fff);
}
/* Ectoplasm admin theme */
.admin-color-ectoplasm {
@include metaboxesAdminThemeColorOverrides(#413256, #fff);
}
/* Midnight admin theme */
.admin-color-midnight {
@include metaboxesAdminThemeColorOverrides(#363b3f, #fff);
}
/* Ocean admin theme */
.admin-color-ocean {
@include metaboxesAdminThemeColorOverrides(#627c83, #fff);
}
/* Sunrise admin theme */
.admin-color-sunrise {
@include metaboxesAdminThemeColorOverrides(#b43c38, #fff);
}
.redux-notices {
margin-bottom: 0;
border: 0;
}
.redux-metabox {
.redux-container {
margin-top: 0;
}
.inside {
margin: 0 !important;
padding: 0 !important;
}
.redux-no-sections {
.redux-main {
padding: 6px 15px 15px 15px !important;
.default_br {
display: none;
}
.redux-field-container {
padding: 10px 0 20px !important;
}
.redux_field_th {
padding-top: 5px !important;
}
}
&.redux-box-side {
.redux-main {
padding: 6px 8px 8px 8px !important;
input[type=text] {
width: 100% !important;
}
}
}
}
}
.wp-color-result {
margin: 0 6px 0 0 !important;
}
.redux-container .ui-button-text-only .ui-button-text {
padding: 0;
}
.wpseotab tr {
display: table-row !important
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* Redux Metabox Extension Helpers
*
* @package Redux
*/
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'redux_metaboxes_loop_start' ) ) {
/**
* Start loop.
*
* @param string $opt_name Panel opt_name.
* @param array $the_post Post object.
*/
function redux_metaboxes_loop_start( string $opt_name, array $the_post = array() ) {
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
$metaboxes = $redux->extensions['metaboxes'];
$metaboxes->loop_start( $the_post );
}
}
if ( ! function_exists( 'redux_metaboxes_loop_end' ) ) {
/**
* End loop.
*
* @param string $opt_name Panel opt_name.
* @param array $the_post Post object.
*/
function redux_metaboxes_loop_end( string $opt_name, array $the_post = array() ) {
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
$metaboxes = $redux->extensions['metaboxes'];
$metaboxes->loop_end();
}
}
if ( ! function_exists( 'redux_post_meta' ) ) {
/**
* Retrieve post meta values/settings.
*
* @param string $opt_name Panel opt_name.
* @param mixed $the_post Post ID.
* @param string $meta_key Meta key.
* @param mixed $def_val Default value.
*
* @return string|void
*/
function redux_post_meta( string $opt_name = '', $the_post = array(), string $meta_key = '', $def_val = '' ) {
return Redux::get_post_meta( $opt_name, $the_post, $meta_key, $def_val );
}
}