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,283 @@
|
||||
<?php
|
||||
/**
|
||||
* Redux Social Profiles Extension Class
|
||||
*
|
||||
* @package Redux
|
||||
* @author Kevin Provance <kevin.provance@gmail.com>
|
||||
* @class Redux_Extension_Social_Profiles
|
||||
* @version 4.3.17
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Extension_Social_Profiles' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Main ReduxFramework social profiles extension class
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Redux_Extension_Social_Profiles extends Redux_Extension_Abstract {
|
||||
|
||||
/**
|
||||
* Extension version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $version = '4.3.17';
|
||||
|
||||
/**
|
||||
* Extension friendly name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $extension_name = 'Social Profiles';
|
||||
|
||||
/**
|
||||
* Field ID.
|
||||
*
|
||||
* @var mixed|null
|
||||
*/
|
||||
private $field_id = null;
|
||||
|
||||
/**
|
||||
* Field array.
|
||||
*
|
||||
* @var array|mixed
|
||||
*/
|
||||
public $field = array();
|
||||
|
||||
/**
|
||||
* Panel opt_name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $opt_name = '';
|
||||
|
||||
/**
|
||||
* Class Constructor. Defines the args for the extensions class
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param ReduxFramework $redux Parent settings.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $redux ) {
|
||||
parent::__construct( $redux, __FILE__ );
|
||||
|
||||
$this->add_field( 'social_profiles' );
|
||||
|
||||
require_once __DIR__ . '/redux-social-profiles-helpers.php';
|
||||
|
||||
include_once 'social_profiles/inc/class-redux-social-profiles-defaults.php';
|
||||
include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
|
||||
|
||||
Redux_Social_Profiles_Functions::init( $redux );
|
||||
|
||||
$this->field = Redux_Social_Profiles_Functions::get_field( $redux );
|
||||
|
||||
if ( ! is_array( $this->field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->field_id = $this->field['id'];
|
||||
$this->opt_name = $redux->args['opt_name'];
|
||||
|
||||
$upload_dir = Redux_Social_Profiles_Functions::$upload_dir;
|
||||
|
||||
if ( ! is_dir( $upload_dir ) ) {
|
||||
$redux->filesystem->execute( 'mkdir', $upload_dir );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Widget' ) ) {
|
||||
$enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/widget/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
|
||||
if ( $enable ) {
|
||||
include_once 'social_profiles/inc/class-redux-social-profiles-widget.php';
|
||||
new Redux_Social_Profiles_Widget( $redux, $this->field_id );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Shortcode' ) ) {
|
||||
$enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/shortcode/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
|
||||
if ( $enable ) {
|
||||
include_once 'social_profiles/inc/class-redux-social-profiles-shortcode.php';
|
||||
new Redux_Social_Profiles_Shortcode( $redux, $this->field_id );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
||||
|
||||
add_filter( "redux/options/{$this->parent->args['opt_name']}/defaults", array( $this, 'set_defaults' ) );
|
||||
add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/before_validation', array( $this, 'save_me' ), 0, 3 );
|
||||
add_filter( 'redux/metaboxes/save/before_validate', array( $this, 'save_me' ), 0, 3 );
|
||||
|
||||
// Reset hooks.
|
||||
add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults', array( $this, 'reset_defaults' ), 0, 3 );
|
||||
add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults_section', array( $this, 'reset_defaults_section' ), 0, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset section defaults.
|
||||
*
|
||||
* @param array $defaults Default values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reset_defaults_section( array $defaults = array() ): array {
|
||||
if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) ) {
|
||||
$cur_tab = sanitize_title( wp_unslash( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) );
|
||||
$tab_num = strval( $this->parent->field_sections['social_profiles'][ $this->field_id ] );
|
||||
|
||||
if ( $cur_tab === $tab_num ) {
|
||||
if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
|
||||
$data = Redux_Social_Profiles_Functions::get_default_data();
|
||||
|
||||
Redux_Social_Profiles_Functions::write_data_file( $data );
|
||||
}
|
||||
}
|
||||
|
||||
$defaults[ $this->field_id ] = Redux_Social_Profiles_Functions::read_data_file();
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset defaults.
|
||||
*
|
||||
* @param array $defaults Default values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reset_defaults( array $defaults = array() ): array {
|
||||
if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
|
||||
$data = Redux_Social_Profiles_Functions::get_default_data();
|
||||
|
||||
Redux_Social_Profiles_Functions::write_data_file( $data );
|
||||
|
||||
$defaults[ $this->field_id ] = $data;
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default values.
|
||||
*
|
||||
* @param array $defaults Default values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function set_defaults( array $defaults = array() ): array {
|
||||
if ( empty( $this->field_id ) ) {
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
$comp_file = Redux_Social_Profiles_Functions::get_data_path();
|
||||
|
||||
if ( ! file_exists( $comp_file ) ) {
|
||||
$data = Redux_Social_Profiles_Functions::get_default_data();
|
||||
|
||||
Redux_Social_Profiles_Functions::write_data_file( $data );
|
||||
|
||||
$this->parent->options[ $this->field_id ] = $data;
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Data.
|
||||
*
|
||||
* @param array $saved_options Saved options.
|
||||
* @param array $changed_values Changed values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save_me( array $saved_options = array(), array $changed_values = array() ): array {
|
||||
if ( empty( $this->field ) ) {
|
||||
$this->field = Redux_Social_Profiles_Functions::get_field();
|
||||
$this->field_id = $this->field['id'];
|
||||
}
|
||||
|
||||
if ( ! isset( $saved_options[ $this->field_id ] ) || empty( $saved_options[ $this->field_id ] ) || ( is_array( $saved_options[ $this->field_id ] ) && $saved_options === $changed_values ) || ! array_key_exists( $this->field_id, $saved_options ) ) {
|
||||
return $saved_options;
|
||||
}
|
||||
|
||||
// We'll use the reset hook instead.
|
||||
if ( ! empty( $saved_options['defaults'] ) || ! empty( $saved_options['defaults-section'] ) ) {
|
||||
return $saved_options;
|
||||
}
|
||||
|
||||
$first_value = reset( $saved_options[ $this->field_id ] ); // First Element's Value.
|
||||
|
||||
if ( isset( $first_value['data'] ) ) {
|
||||
$raw_data = $saved_options[ $this->field_id ];
|
||||
|
||||
$save_data = array();
|
||||
|
||||
// Enum through saved data.
|
||||
foreach ( $raw_data as $val ) {
|
||||
if ( is_array( $val ) ) {
|
||||
|
||||
if ( ! isset( $val['data'] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$data = json_decode( rawurldecode( $val['data'] ), true );
|
||||
|
||||
$save_data[] = array(
|
||||
'id' => $data['id'],
|
||||
'icon' => $data['icon'],
|
||||
'enabled' => $data['enabled'],
|
||||
'url' => $data['url'],
|
||||
'color' => $data['color'],
|
||||
'background' => $data['background'],
|
||||
'order' => $data['order'],
|
||||
'name' => $data['name'],
|
||||
'label' => $data['label'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$save_file = false;
|
||||
|
||||
if ( ! isset( $old_options[ $this->field_id ] ) || ( isset( $old_options[ $this->field_id ] ) && ! empty( $old_options[ $this->field_id ] ) ) ) {
|
||||
$save_file = true;
|
||||
}
|
||||
|
||||
if ( ! empty( $old_options[ $this->field_id ] ) && $old_options[ $this->field_id ] !== $saved_options[ $this->field_id ] ) {
|
||||
$save_file = true;
|
||||
}
|
||||
|
||||
if ( $save_file ) {
|
||||
Redux_Social_Profiles_Functions::write_data_file( $save_data );
|
||||
}
|
||||
|
||||
$saved_options[ $this->field_id ] = $save_data;
|
||||
}
|
||||
|
||||
return $saved_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts/styles.
|
||||
*/
|
||||
public function enqueue_styles() {
|
||||
// Field CSS.
|
||||
wp_enqueue_style(
|
||||
'redux-field-social-profiles-frontend',
|
||||
$this->extension_url . 'social_profiles/css/field_social_profiles_frontend.css',
|
||||
array(),
|
||||
self::$version
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class_alias( 'Redux_Extension_Social_Profiles', 'ReduxFramework_Extension_social_profiles' );
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package Redux Framework
|
||||
*/
|
||||
|
||||
echo null;
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Redux Social Profiles Helpers
|
||||
*
|
||||
* @package Redux
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! function_exists( 'redux_social_profile_value_from_id' ) ) {
|
||||
/**
|
||||
* Returns social profile value from passed profile ID.
|
||||
*
|
||||
* @param string $opt_name Redux Framework opt_name.
|
||||
* @param string $id Profile ID.
|
||||
* @param string $value Social profile value to return (icon, name, background, color, url, or order).
|
||||
*
|
||||
* @return string Returns HTML string when $echo is set to false. Otherwise, true.
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
function redux_social_profile_value_from_id( string $opt_name, string $id, string $value ): string {
|
||||
if ( empty( $opt_name ) || empty( $id ) || empty( $value ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
|
||||
$social_profiles = $redux->extensions['social_profiles'];
|
||||
|
||||
$redux_options = get_option( $social_profiles->opt_name );
|
||||
$settings = $redux_options[ $social_profiles->field_id ];
|
||||
|
||||
foreach ( $settings as $arr ) {
|
||||
if ( $id === $arr['id'] ) {
|
||||
if ( $arr['enabled'] ) {
|
||||
if ( isset( $arr[ $value ] ) ) {
|
||||
return $arr[ $value ];
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'redux_render_icon_from_id' ) ) {
|
||||
/**
|
||||
* Renders social icon from passed profile ID.
|
||||
*
|
||||
* @param string $opt_name Redux Framework opt_name.
|
||||
* @param string $id Profile ID.
|
||||
* @param boolean $output Echos icon HTML when true. Returns icon HTML when false.
|
||||
* @param string $a_class Class name for a tag.
|
||||
*
|
||||
* @return string Returns HTML string when $echo is set to false. Otherwise, true.
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
function redux_render_icon_from_id( string $opt_name, string $id, bool $output = true, string $a_class = '' ) {
|
||||
if ( empty( $opt_name ) || empty( $id ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
|
||||
|
||||
$redux = ReduxFrameworkInstances::get_instance( $opt_name );
|
||||
$social_profiles = $redux->extensions['social_profiles'];
|
||||
|
||||
$redux_options = get_option( $social_profiles->opt_name );
|
||||
$settings = $redux_options[ $social_profiles->field_id ];
|
||||
|
||||
foreach ( $settings as $arr ) {
|
||||
if ( $id === $arr['id'] ) {
|
||||
if ( $arr['enabled'] ) {
|
||||
|
||||
if ( $output ) {
|
||||
echo '<a class="' . esc_attr( $a_class ) . '" href="' . esc_url( $arr['url'] ) . '">';
|
||||
Redux_Social_Profiles_Functions::render_icon( $arr['icon'], $arr['color'], $arr['background'], '' );
|
||||
echo '</a>';
|
||||
|
||||
return true;
|
||||
} else {
|
||||
$html = '<a class="' . $a_class . '"href="' . $arr['url'] . '">';
|
||||
|
||||
$html .= Redux_Social_Profiles_Functions::render_icon( $arr['icon'], $arr['color'], $arr['background'], '', false );
|
||||
$html .= '</a>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
/**
|
||||
* Redux Social Profiles Field Class
|
||||
*
|
||||
* @package Redux
|
||||
* @author Kevin Provance <kevin.provance@gmail.com>
|
||||
* @class Redux_Social_Profiles
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles' ) ) {
|
||||
|
||||
/**
|
||||
* Main Redux_Social_Profiles class
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Redux_Social_Profiles extends Redux_Field {
|
||||
|
||||
/**
|
||||
* Field ID.
|
||||
*
|
||||
* @var mixed|string
|
||||
*/
|
||||
public $field_id = '';
|
||||
|
||||
/**
|
||||
* Panel opt_name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $opt_name = '';
|
||||
|
||||
/**
|
||||
* Defaults array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $defaults = array();
|
||||
|
||||
/**
|
||||
* Set defaults.
|
||||
*/
|
||||
public function set_defaults() {
|
||||
$this->opt_name = $this->parent->args['opt_name'];
|
||||
$this->field_id = $this->field['id'];
|
||||
|
||||
$this->defaults = Redux_Social_Profiles_Functions::get_default_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Settings.
|
||||
*
|
||||
* @param array $settings Settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function rebuild_setttings( array $settings ): array {
|
||||
$fixed_arr = array();
|
||||
$stock = '';
|
||||
|
||||
foreach ( $this->defaults as $key => $arr ) {
|
||||
$search_default = true;
|
||||
|
||||
$default_id = $arr['id'];
|
||||
|
||||
foreach ( $settings as $a ) {
|
||||
if ( $default_id === $a['id'] ) {
|
||||
$search_default = false;
|
||||
$fixed_arr[ $key ] = $a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $search_default ) {
|
||||
if ( '' === $stock ) {
|
||||
$stock = Redux_Social_Profiles_Defaults::get_social_media_defaults();
|
||||
$stock = Redux_Social_Profiles_Functions::add_extra_icons( $stock );
|
||||
}
|
||||
|
||||
foreach ( $stock as $def_arr ) {
|
||||
if ( $default_id === $def_arr['id'] ) {
|
||||
$fixed_arr[ $key ] = $def_arr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fixed_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
if ( empty( $this->field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $pagenow, $post;
|
||||
|
||||
$redux_settings = get_option( $this->opt_name );
|
||||
$settings = $redux_settings[ $this->field_id ] ?? array();
|
||||
|
||||
if ( is_admin() && ( 'post-new.php' === $pagenow || 'post.php' === $pagenow ) ) {
|
||||
$post_settings = get_post_meta( $post->ID, $this->field_id, true );
|
||||
|
||||
if ( ! empty( $post_settings ) ) {
|
||||
$settings = $post_settings;
|
||||
}
|
||||
}
|
||||
|
||||
$color_pickers = $this->field['color_pickers'] ?? true;
|
||||
|
||||
// Icon container.
|
||||
echo '<div
|
||||
class="redux-social-profiles-container ' . esc_attr( $this->field['class'] ) . '"
|
||||
data-opt-name="' . esc_attr( $this->opt_name ) . '"
|
||||
data-id="' . esc_attr( $this->field_id ) . '"
|
||||
>';
|
||||
|
||||
$show_msg = $this->field['hide_widget_msg'] ?? true;
|
||||
|
||||
// translators: %1$s: Widget page HTML/URL. %s: widget admin URL.
|
||||
$def_msg = sprintf( esc_html__( 'Go to the %1$s page to add the Redux Social Widget to any active widget area.', 'redux-framework' ), sprintf( '<a href="%s">' . esc_html__( 'Widgets', 'redux-framework' ) . '</a> ', admin_url( 'widgets.php' ) ) );
|
||||
|
||||
$msg = $this->field['widget_msg'] ?? $def_msg;
|
||||
|
||||
if ( ! $show_msg ) {
|
||||
echo '<div class="redux-social-profiles-header">';
|
||||
echo $msg; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="redux-social-profiles-selector-container">';
|
||||
echo '<ul id="redux-social-profiles-selector-list">';
|
||||
|
||||
$settings = $this->rebuild_setttings( $settings );
|
||||
|
||||
foreach ( $this->defaults as $key => $social_provider_default ) {
|
||||
$social_provider_option = ( $settings && is_array( $settings ) && array_key_exists( $key, $settings ) ) ? $settings[ $key ] : null;
|
||||
|
||||
$icon = ( $social_provider_option && array_key_exists( 'icon', $social_provider_option ) && $social_provider_option['icon'] ) ? $social_provider_option['icon'] : $social_provider_default['icon'];
|
||||
$name = ( $social_provider_option && array_key_exists( 'name', $social_provider_option ) && $social_provider_option['name'] ) ? $social_provider_option['name'] : $social_provider_default['name'];
|
||||
$order = ( $social_provider_option && array_key_exists( 'order', $social_provider_option ) ) ? $social_provider_option['order'] : $key;
|
||||
$order = intval( $order );
|
||||
$enabled = ( $social_provider_option && array_key_exists( 'enabled', $social_provider_option ) && $social_provider_option['enabled'] ) ? $social_provider_option['enabled'] : $social_provider_default['enabled'];
|
||||
$display = ( $enabled ) ? 'enabled' : '';
|
||||
|
||||
echo '<li class="redux-social-profiles-item-enable ' . esc_attr( $display ) . '" id="redux-social-profiles-item-enable-' . esc_attr( $key ) . '" data-key="' . esc_attr( $key ) . '" data-order="' . esc_attr( $order ) . '">';
|
||||
Redux_Social_Profiles_Functions::render_icon( $icon, '', '', $name );
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<ul id="redux-social-profiles-list">';
|
||||
|
||||
foreach ( $this->defaults as $key => $social_provider_default ) {
|
||||
echo '<li id="redux-social-item-' . esc_attr( $key ) . '" data-key="' . esc_attr( $key ) . '" style="display: none;">';
|
||||
echo '<div class="redux-social-item-container">';
|
||||
|
||||
$social_provider_option = ( $settings && is_array( $settings ) && array_key_exists( $key, $settings ) ) ? $settings[ $key ] : null;
|
||||
$icon = ( $social_provider_option && array_key_exists( 'icon', $social_provider_option ) && $social_provider_option['icon'] ) ? $social_provider_option['icon'] : $social_provider_default['icon'];
|
||||
$id = ( $social_provider_option && array_key_exists( 'id', $social_provider_option ) && $social_provider_option['id'] ) ? $social_provider_option['id'] : $social_provider_default['id'];
|
||||
$enabled = ( $social_provider_option && array_key_exists( 'enabled', $social_provider_option ) && $social_provider_option['enabled'] ) ? $social_provider_option['enabled'] : $social_provider_default['enabled'];
|
||||
$name = ( $social_provider_option && array_key_exists( 'name', $social_provider_option ) && $social_provider_option['name'] ) ? $social_provider_option['name'] : $social_provider_default['name'];
|
||||
|
||||
$label = ( $social_provider_option && array_key_exists( 'label', $social_provider_option ) && $social_provider_option['label'] ) ? $social_provider_option['label'] : __( 'Link URL', 'redux-framework' );
|
||||
|
||||
$color = ( $social_provider_option && array_key_exists( 'color', $social_provider_option ) ) ? $social_provider_option['color'] : $social_provider_default['color'];
|
||||
$color = esc_attr( $color );
|
||||
|
||||
$background = ( $social_provider_option && array_key_exists( 'background', $social_provider_option ) ) ? $social_provider_option['background'] : $social_provider_default['background'];
|
||||
$background = esc_attr( $background );
|
||||
|
||||
$order = ( $social_provider_option && array_key_exists( 'order', $social_provider_option ) ) ? $social_provider_option['order'] : $key;
|
||||
$order = intval( $order );
|
||||
|
||||
$url = ( $social_provider_option && array_key_exists( 'url', $social_provider_option ) ) ? $social_provider_option['url'] : $social_provider_default['url'];
|
||||
$url = esc_attr( $url );
|
||||
|
||||
$profile_data = array(
|
||||
'id' => $id,
|
||||
'icon' => $icon,
|
||||
'enabled' => $enabled,
|
||||
'url' => $url,
|
||||
'color' => $color,
|
||||
'background' => $background,
|
||||
'order' => $order,
|
||||
'name' => $name,
|
||||
'label' => $label,
|
||||
);
|
||||
|
||||
$profile_data = rawurlencode( wp_json_encode( $profile_data ) );
|
||||
|
||||
echo '<input
|
||||
type="hidden"
|
||||
class="redux-social-profiles-hidden-data-' . esc_attr( $key ) . '"
|
||||
id="' . esc_attr( $this->field_id ) . '-' . esc_attr( $id ) . '-data"
|
||||
name="' . esc_attr( $this->field['name'] ) . esc_attr( $this->field['name_suffix'] ) . '[' . esc_attr( $key ) . '][data]"
|
||||
value="' . $profile_data . '" />'; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
|
||||
echo '<div class="redux-icon-preview">';
|
||||
Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, $name );
|
||||
echo ' </div>';
|
||||
|
||||
echo '<div class="redux-social-profiles-item-name">';
|
||||
echo esc_html( $name );
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="redux-social-profiles-item-enabled">';
|
||||
$checked = ( $enabled ) ? 'checked' : '';
|
||||
echo '<input type="checkbox" class="checkbox-' . esc_attr( $key ) . '" data-key="' . esc_attr( $key ) . '" value="1" ' . esc_attr( $checked ) . '/>';
|
||||
esc_html_e( 'Enabled', 'redux-framework' );
|
||||
echo '</div>';
|
||||
|
||||
$color_class = $color_pickers ? '' : ' no-color-pickers';
|
||||
|
||||
echo '<div class="redux-social-profiles-link-url input_wrapper' . esc_attr( $color_class ) . '">';
|
||||
echo '<label for="redux-social-profiles-url-' . esc_attr( $key ) . '-text" class="redux-text-url-label">' . esc_html( $label ) . '</label>';
|
||||
echo '<input id="redux-social-profiles-url-' . esc_attr( $key ) . '-text" class="redux-social-profiles-url-text" data-key="' . esc_attr( $key ) . '" type="text" value="' . esc_url( $url ) . '" />';
|
||||
echo '</div>';
|
||||
|
||||
$reset_text = __( 'Reset', 'redux-framework' );
|
||||
echo '<div class="redux-social-profiles-item-reset">';
|
||||
echo '<a class="button" data-value="' . esc_attr( $key ) . '" value="' . esc_attr( $reset_text ) . '" />' . esc_html( $reset_text ) . '</a>';
|
||||
echo '</div>';
|
||||
|
||||
if ( $color_pickers ) {
|
||||
// phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
$label = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/color_picker/text', esc_html__( 'Text', 'redux-framework' ) );
|
||||
|
||||
echo '<div class="redux-social-profiles-text-color picker_wrapper" >';
|
||||
echo '<label for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text" class="redux-text-color-label">' . esc_html( $label ) . '</label>';
|
||||
echo '<input
|
||||
class="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text"
|
||||
id="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text"
|
||||
type="text"
|
||||
value="' . esc_attr( $color ) . '"
|
||||
data-key="' . esc_attr( $key ) . '"
|
||||
/>';
|
||||
echo '</div>';
|
||||
|
||||
// phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
$label = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/color_picker/background', esc_html__( 'Background', 'redux-framework' ) );
|
||||
|
||||
echo '<div class="redux-social-profiles-background-color picker_wrapper">';
|
||||
echo '<label for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background" class="redux-background-color-label" for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background">' . esc_html( $label ) . '</label>';
|
||||
echo '<input
|
||||
class="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background"
|
||||
id="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background"
|
||||
type="text"
|
||||
value="' . esc_attr( $background ) . '"
|
||||
data-key="' . esc_attr( $key ) . '"
|
||||
/>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="redux-social-profiles-item-order">';
|
||||
echo '<input
|
||||
type="hidden"
|
||||
value="' . esc_attr( $order ) . '"
|
||||
/>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is unused, but necessary to trigger output.
|
||||
*
|
||||
* @param mixed $data CSS data.
|
||||
*
|
||||
* @return mixed|string|void
|
||||
*/
|
||||
public function css_style( $data ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to enqueue to the front-end
|
||||
*
|
||||
* @param string|null|array $style Style.
|
||||
*/
|
||||
public function output( $style = '' ) {
|
||||
if ( ! empty( $this->value ) ) {
|
||||
foreach ( $this->value as $arr ) {
|
||||
if ( $arr['enabled'] ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
|
||||
Redux_Functions_Ex::enqueue_font_awesome();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ( empty( $this->field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$min = Redux_Functions::isMin();
|
||||
|
||||
Redux_Functions_Ex::enqueue_font_awesome();
|
||||
|
||||
// Field dependent JS.
|
||||
wp_enqueue_script(
|
||||
'redux-field-social-profiles',
|
||||
$this->url . 'redux-social-profiles' . $min . '.js',
|
||||
array( 'jquery', 'jquery-ui-sortable', 'redux-spectrum-js', 'redux-js' ),
|
||||
Redux_Extension_Social_Profiles::$version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'redux-field-social-profiles',
|
||||
'reduxSocialDefaults',
|
||||
$this->defaults
|
||||
);
|
||||
|
||||
if ( $this->parent->args['dev_mode'] ) {
|
||||
wp_enqueue_style(
|
||||
'redux-field-social-profiles',
|
||||
$this->url . 'redux-social-profiles.css',
|
||||
array( 'redux-spectrum-css' ),
|
||||
Redux_Extension_Social_Profiles::$version
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
ul.redux-social-media-list{margin-top:-20px}ul.redux-social-media-list li{font-size:30px;float:left;margin-right:2px;padding:5px;display:block}ul.redux-social-media-list li:before{content:''}
|
||||
@@ -0,0 +1,17 @@
|
||||
ul {
|
||||
&.redux-social-media-list {
|
||||
margin-top: -20px;
|
||||
|
||||
li {
|
||||
font-size: 30px;
|
||||
float: left;
|
||||
margin-right: 2px;
|
||||
padding: 5px;
|
||||
display: block;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package Redux Framework
|
||||
*/
|
||||
|
||||
echo null;
|
||||
@@ -0,0 +1,850 @@
|
||||
<?php
|
||||
/**
|
||||
* Social Profiles Default Class.
|
||||
*
|
||||
* @package Redux
|
||||
* @subpackage Extensions
|
||||
* @author Kevin Provance (kprovance)
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Defaults' ) ) {
|
||||
|
||||
/**
|
||||
* Class Redux_Social_Profiles_Defaults
|
||||
*/
|
||||
class Redux_Social_Profiles_Defaults {
|
||||
|
||||
/**
|
||||
* Get defaults array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_social_media_defaults(): array {
|
||||
return array(
|
||||
0 => array(
|
||||
'id' => 'adn',
|
||||
'icon' => 'fa-adn',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'ADN', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 0,
|
||||
),
|
||||
1 => array(
|
||||
'id' => 'android',
|
||||
'icon' => 'fa-android',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Android', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#A4C639',
|
||||
'url' => '',
|
||||
'order' => 1,
|
||||
),
|
||||
2 => array(
|
||||
'id' => 'apple',
|
||||
'icon' => 'fa-apple',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Apple', 'redux-framework' ),
|
||||
'style' => '',
|
||||
'background' => '',
|
||||
'color' => '#e4e4e5',
|
||||
'url' => '',
|
||||
'order' => 2,
|
||||
),
|
||||
3 => array(
|
||||
'id' => 'behance',
|
||||
'icon' => 'fa-behance',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'behance', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#1769ff',
|
||||
'url' => '',
|
||||
'order' => 3,
|
||||
),
|
||||
4 => array(
|
||||
'id' => 'behance-square',
|
||||
'icon' => 'fa-behance-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'behance square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#1769ff',
|
||||
'url' => '',
|
||||
'order' => 4,
|
||||
),
|
||||
5 => array(
|
||||
'id' => 'bitbucket',
|
||||
'icon' => 'fa-bitbucket',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Bitbucket', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#205081',
|
||||
'url' => '',
|
||||
'order' => 5,
|
||||
),
|
||||
6 => array(
|
||||
'id' => 'bitbucket-square',
|
||||
'icon' => 'fa-bitbucket-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Bitbucket square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#205081',
|
||||
'url' => '',
|
||||
'order' => 6,
|
||||
),
|
||||
7 => array(
|
||||
'id' => 'bitcoin',
|
||||
'icon' => 'fa-btc',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Bitcoin', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 7,
|
||||
),
|
||||
8 => array(
|
||||
'id' => 'codepen',
|
||||
'icon' => 'fa-codepen',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'CodePen', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 8,
|
||||
),
|
||||
9 => array(
|
||||
'id' => 'css3',
|
||||
'icon' => 'fa-css3',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'CSS3', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 9,
|
||||
),
|
||||
10 => array(
|
||||
'id' => 'delicious',
|
||||
'icon' => 'fa-delicious',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Delicious', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#3399ff',
|
||||
'url' => '',
|
||||
'order' => 10,
|
||||
),
|
||||
11 => array(
|
||||
'id' => 'deviantart',
|
||||
'icon' => 'fa-deviantart',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Deviantart', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#4e6252',
|
||||
'url' => '',
|
||||
'order' => 11,
|
||||
),
|
||||
12 => array(
|
||||
'id' => 'digg',
|
||||
'icon' => 'fa-digg',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Digg', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 12,
|
||||
),
|
||||
13 => array(
|
||||
'id' => 'dribbble',
|
||||
'icon' => 'fa-dribbble',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Dribbble', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#444444',
|
||||
'url' => '',
|
||||
'order' => 13,
|
||||
),
|
||||
14 => array(
|
||||
'id' => 'dropbox',
|
||||
'icon' => 'fa-dropbox',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Dropbox', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#007ee5',
|
||||
'url' => '',
|
||||
'order' => 14,
|
||||
),
|
||||
15 => array(
|
||||
'id' => 'drupal',
|
||||
'icon' => 'fa-drupal',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Drupal', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#0077c0',
|
||||
'url' => '',
|
||||
'order' => 15,
|
||||
),
|
||||
16 => array(
|
||||
'id' => 'empire',
|
||||
'icon' => 'fa-empire',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Empire', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 16,
|
||||
),
|
||||
17 => array(
|
||||
'id' => 'facebook',
|
||||
'icon' => 'fa-facebook',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Facebook', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#3b5998',
|
||||
'url' => '',
|
||||
'order' => 17,
|
||||
),
|
||||
18 => array(
|
||||
'id' => 'facebook-square',
|
||||
'icon' => 'fa-facebook-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Facebook square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#3b5998',
|
||||
'url' => '',
|
||||
'order' => 18,
|
||||
),
|
||||
19 => array(
|
||||
'id' => 'flickr',
|
||||
'icon' => 'fa-flickr',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Flickr', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#0063dc',
|
||||
'url' => '',
|
||||
'order' => 19,
|
||||
),
|
||||
20 => array(
|
||||
'id' => 'foursquare',
|
||||
'icon' => 'fa-foursquare',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'FourSquare', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#0072b1',
|
||||
'url' => '',
|
||||
'order' => 20,
|
||||
),
|
||||
21 => array(
|
||||
'id' => 'git',
|
||||
'icon' => 'fa-git',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'git', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 21,
|
||||
),
|
||||
22 => array(
|
||||
'id' => 'git-square',
|
||||
'icon' => 'fa-git-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'git square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 22,
|
||||
),
|
||||
23 => array(
|
||||
'id' => 'github',
|
||||
'icon' => 'fa-github',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'github', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#4183c4',
|
||||
'url' => '',
|
||||
'order' => 23,
|
||||
),
|
||||
24 => array(
|
||||
'id' => 'github-alt',
|
||||
'icon' => 'fa-github-alt',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'github alt', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#4183c4',
|
||||
'url' => '',
|
||||
'order' => 24,
|
||||
),
|
||||
25 => array(
|
||||
'id' => 'github-square',
|
||||
'icon' => 'fa-github-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'github square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#4183c4',
|
||||
'url' => '',
|
||||
'order' => 25,
|
||||
),
|
||||
26 => array(
|
||||
'id' => 'gittip',
|
||||
'icon' => 'fa-gittip',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'git tip', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 26,
|
||||
),
|
||||
27 => array(
|
||||
'id' => 'google',
|
||||
'icon' => 'fa-google',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Google', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#dd4b39',
|
||||
'url' => '',
|
||||
'order' => 27,
|
||||
),
|
||||
28 => array(
|
||||
'id' => 'google-plus',
|
||||
'icon' => 'fa-google-plus',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Google Plus', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#dd4b39',
|
||||
'url' => '',
|
||||
'order' => 28,
|
||||
),
|
||||
29 => array(
|
||||
'id' => 'google-plus-square',
|
||||
'icon' => 'fa-google-plus-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Google Plus square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#dd4b39',
|
||||
'url' => '',
|
||||
'order' => 29,
|
||||
),
|
||||
30 => array(
|
||||
'id' => 'hacker-news',
|
||||
'icon' => 'fa-hacker-news',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Hacker News', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#ff6600',
|
||||
'url' => '',
|
||||
'order' => 30,
|
||||
),
|
||||
31 => array(
|
||||
'id' => 'html5',
|
||||
'icon' => 'fa-html5',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'HTML5', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#e34f26',
|
||||
'url' => '',
|
||||
'order' => 31,
|
||||
),
|
||||
32 => array(
|
||||
'id' => 'instagram',
|
||||
'icon' => 'fa-instagram',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Instagram', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#3f729b',
|
||||
'url' => '',
|
||||
'order' => 32,
|
||||
),
|
||||
33 => array(
|
||||
'id' => 'joomla',
|
||||
'icon' => 'fa-joomla',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Joomla', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 33,
|
||||
),
|
||||
34 => array(
|
||||
'id' => 'jsfiddle',
|
||||
'icon' => 'fa-jsfiddle',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'JS Fiddle', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 34,
|
||||
),
|
||||
35 => array(
|
||||
'id' => 'linkedin',
|
||||
'icon' => 'fa-linkedin',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'LinkedIn', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#0976b4',
|
||||
'url' => '',
|
||||
'order' => 35,
|
||||
),
|
||||
36 => array(
|
||||
'id' => 'linkedin-square',
|
||||
'icon' => 'fa-linkedin-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'LinkedIn square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#0976b4',
|
||||
'url' => '',
|
||||
'order' => 36,
|
||||
),
|
||||
37 => array(
|
||||
'id' => 'linux',
|
||||
'icon' => 'fa-linux',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Linux', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#333333',
|
||||
'url' => '',
|
||||
'order' => 37,
|
||||
),
|
||||
38 => array(
|
||||
'id' => 'maxcdn',
|
||||
'icon' => 'fa-maxcdn',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'MaxCDN', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#f8711e',
|
||||
'url' => '',
|
||||
'order' => 38,
|
||||
),
|
||||
39 => array(
|
||||
'id' => 'openid',
|
||||
'icon' => 'fa-openid',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'OpenID', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 39,
|
||||
),
|
||||
40 => array(
|
||||
'id' => 'pagelines',
|
||||
'icon' => 'fa-pagelines',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Page Lines', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 40,
|
||||
),
|
||||
41 => array(
|
||||
'id' => 'pied-piper',
|
||||
'icon' => 'fa-pied-piper',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Pied Piper', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 41,
|
||||
),
|
||||
42 => array(
|
||||
'id' => 'pied-piper-alt',
|
||||
'icon' => 'fa-pied-piper-alt',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Pied Piper alt', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 42,
|
||||
),
|
||||
43 => array(
|
||||
'id' => 'pinterest',
|
||||
'icon' => 'fa-pinterest',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Pinterest', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#1769ff',
|
||||
'url' => '',
|
||||
'order' => 43,
|
||||
),
|
||||
44 => array(
|
||||
'id' => 'pinterest-square',
|
||||
'icon' => 'fa-pinterest-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Pinterest square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#1769ff',
|
||||
'url' => '',
|
||||
'order' => 44,
|
||||
),
|
||||
45 => array(
|
||||
'id' => 'qq',
|
||||
'icon' => 'fa-qq',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'QQ', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 45,
|
||||
),
|
||||
46 => array(
|
||||
'id' => 'rebel',
|
||||
'icon' => 'fa-rebel',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Rebel', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#517fa4',
|
||||
'url' => '',
|
||||
'order' => 46,
|
||||
),
|
||||
47 => array(
|
||||
'id' => 'reddit',
|
||||
'icon' => 'fa-reddit',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Reddit', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#ff4500',
|
||||
'url' => '',
|
||||
'order' => 47,
|
||||
),
|
||||
48 => array(
|
||||
'id' => 'reddit-square',
|
||||
'icon' => 'fa-reddit-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Reddit square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#ff4500',
|
||||
'url' => '',
|
||||
'order' => 48,
|
||||
),
|
||||
49 => array(
|
||||
'id' => 'renren',
|
||||
'icon' => 'fa-renren',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Ren Ren', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#007bb6',
|
||||
'url' => '',
|
||||
'order' => 49,
|
||||
),
|
||||
50 => array(
|
||||
'id' => 'share-alt',
|
||||
'icon' => 'fa-share-alt',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Share alt', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 50,
|
||||
),
|
||||
51 => array(
|
||||
'id' => 'share-alt-square',
|
||||
'icon' => 'fa-share-alt-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Share square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 51,
|
||||
),
|
||||
52 => array(
|
||||
'id' => 'skype',
|
||||
'icon' => 'fa-skype',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Skype', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#00aff0',
|
||||
'url' => '',
|
||||
'order' => 52,
|
||||
),
|
||||
53 => array(
|
||||
'id' => 'slack',
|
||||
'icon' => 'fa-slack',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Slack', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 53,
|
||||
),
|
||||
54 => array(
|
||||
'id' => 'soundcloud',
|
||||
'icon' => 'fa-soundcloud',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Sound Cloud', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#f80',
|
||||
'url' => '',
|
||||
'order' => 54,
|
||||
),
|
||||
55 => array(
|
||||
'id' => 'spotify',
|
||||
'icon' => 'fa-spotify',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Spotify', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#7ab800',
|
||||
'url' => '',
|
||||
'order' => 55,
|
||||
),
|
||||
56 => array(
|
||||
'id' => 'stack-exchange',
|
||||
'icon' => 'fa-stack-exchange',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Stack Exchange', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 56,
|
||||
),
|
||||
57 => array(
|
||||
'id' => 'stack-overflow',
|
||||
'icon' => 'fa-stack-overflow',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Stack Overflow', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#fe7a15',
|
||||
'url' => '',
|
||||
'order' => 57,
|
||||
),
|
||||
58 => array(
|
||||
'id' => 'steam',
|
||||
'icon' => 'fa-steam',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Steam', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 58,
|
||||
),
|
||||
59 => array(
|
||||
'id' => 'steam-square',
|
||||
'icon' => 'fa-steam-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Steam square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 59,
|
||||
),
|
||||
60 => array(
|
||||
'id' => 'stumbleupon',
|
||||
'icon' => 'fa-stumbleupon',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Stumble Upon', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#eb4924',
|
||||
'url' => '',
|
||||
'order' => 60,
|
||||
),
|
||||
61 => array(
|
||||
'id' => 'stumbleupon-circle',
|
||||
'icon' => 'fa-stumbleupon-circle',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Stumble Upon circle', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#eb4924',
|
||||
'url' => '',
|
||||
'order' => 61,
|
||||
),
|
||||
62 => array(
|
||||
'id' => 'tencent-weibo',
|
||||
'icon' => 'fa-tencent-weibo',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Tencent Weibo', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 62,
|
||||
),
|
||||
63 => array(
|
||||
'id' => 'trello',
|
||||
'icon' => 'fa-trello',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Trello', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#256a92',
|
||||
'url' => '',
|
||||
'order' => 63,
|
||||
),
|
||||
64 => array(
|
||||
'id' => 'tumblr',
|
||||
'icon' => 'fa-tumblr',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Tumblr', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#35465c',
|
||||
'url' => '',
|
||||
'order' => 64,
|
||||
),
|
||||
65 => array(
|
||||
'id' => 'tumblr-square',
|
||||
'icon' => 'fa-tumblr-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Tumblr square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#35465c',
|
||||
'url' => '',
|
||||
'order' => 65,
|
||||
),
|
||||
66 => array(
|
||||
'id' => 'twitter',
|
||||
'icon' => 'fa-twitter',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Twitter', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#55acee',
|
||||
'url' => '',
|
||||
'order' => 66,
|
||||
),
|
||||
67 => array(
|
||||
'id' => 'twitter-square',
|
||||
'icon' => 'fa-twitter-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Twitter square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#55acee',
|
||||
'url' => '',
|
||||
'order' => 67,
|
||||
),
|
||||
68 => array(
|
||||
'id' => 'vimeo-square',
|
||||
'icon' => 'fa-vimeo-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Vimeo square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#1ab7ea',
|
||||
'url' => '',
|
||||
'order' => 68,
|
||||
),
|
||||
69 => array(
|
||||
'id' => 'vine',
|
||||
'icon' => 'fa-vine',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Vine', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#00b488',
|
||||
'url' => '',
|
||||
'order' => 69,
|
||||
),
|
||||
70 => array(
|
||||
'id' => 'vk',
|
||||
'icon' => 'fa-vk',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'VK', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 70,
|
||||
),
|
||||
71 => array(
|
||||
'id' => 'weibo',
|
||||
'icon' => 'fa-weibo',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Weibo', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 71,
|
||||
),
|
||||
72 => array(
|
||||
'id' => 'weixin',
|
||||
'icon' => 'fa-weixin',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Weixin', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#000000',
|
||||
'url' => '',
|
||||
'order' => 72,
|
||||
),
|
||||
73 => array(
|
||||
'id' => 'windows',
|
||||
'icon' => 'fa-windows',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Windows', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#00bcf2',
|
||||
'url' => '',
|
||||
'order' => 73,
|
||||
),
|
||||
74 => array(
|
||||
'id' => 'wordpress',
|
||||
'icon' => 'fa-wordpress',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'WordPress', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#21759b',
|
||||
'url' => '',
|
||||
'order' => 74,
|
||||
),
|
||||
75 => array(
|
||||
'id' => 'xing',
|
||||
'icon' => 'fa-xing',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Xing', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#026466',
|
||||
'url' => '',
|
||||
'order' => 75,
|
||||
),
|
||||
76 => array(
|
||||
'id' => 'xing-square',
|
||||
'icon' => 'fa-xing-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Xing square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#026466',
|
||||
'url' => '',
|
||||
'order' => 76,
|
||||
),
|
||||
77 => array(
|
||||
'id' => 'yahoo',
|
||||
'icon' => 'fa-yahoo',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Yahoo', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#400191',
|
||||
'url' => '',
|
||||
'order' => 77,
|
||||
),
|
||||
78 => array(
|
||||
'id' => 'yelp',
|
||||
'icon' => 'fa-yelp',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'Yelp', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#C93C27',
|
||||
'url' => '',
|
||||
'order' => 78,
|
||||
),
|
||||
79 => array(
|
||||
'id' => 'youtube',
|
||||
'icon' => 'fa-youtube',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'YouTube', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#e52d27',
|
||||
'url' => '',
|
||||
'order' => 79,
|
||||
),
|
||||
80 => array(
|
||||
'id' => 'youtube-play',
|
||||
'icon' => 'fa-youtube-play',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'YouTube play', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#e52d27',
|
||||
'url' => '',
|
||||
'order' => 80,
|
||||
),
|
||||
81 => array(
|
||||
'id' => 'youtube-square',
|
||||
'icon' => 'fa-youtube-square',
|
||||
'enabled' => false,
|
||||
'name' => esc_html__( 'YouTube square', 'redux-framework' ),
|
||||
'background' => '',
|
||||
'color' => '#e52d27',
|
||||
'url' => '',
|
||||
'order' => 81,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
<?php
|
||||
/**
|
||||
* Social Profiles Helper library.
|
||||
*
|
||||
* @package Redux
|
||||
* @subpackage Extensions
|
||||
* @author Kevin Provance (kprovance)
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Functions' ) ) {
|
||||
|
||||
/**
|
||||
* Class Redux_Social_Profiles_Functions
|
||||
*/
|
||||
class Redux_Social_Profiles_Functions {
|
||||
/**
|
||||
* ReduxFramework object pointer.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public static $parent;
|
||||
|
||||
/**
|
||||
* Field ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $field_id;
|
||||
|
||||
/**
|
||||
* Field array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $field;
|
||||
|
||||
/**
|
||||
* WordPress upload directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $upload_dir;
|
||||
|
||||
/**
|
||||
* WordPress upload URI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $upload_url;
|
||||
|
||||
/**
|
||||
* Init helper library.
|
||||
*
|
||||
* @param object $redux ReduxFramework object.
|
||||
*/
|
||||
public static function init( $redux ) {
|
||||
self::$parent = $redux;
|
||||
|
||||
if ( empty( self::$field_id ) ) {
|
||||
self::$field = self::get_field( $redux );
|
||||
|
||||
if ( ! is_array( self::$field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::$field_id = self::$field['id'];
|
||||
}
|
||||
|
||||
// Make sanitized upload dir DIR.
|
||||
self::$upload_dir = Redux_Functions_Ex::wp_normalize_path( Redux_Core::$upload_dir . 'social-profiles/' );
|
||||
|
||||
// Make sanitized upload dir URL.
|
||||
self::$upload_url = Redux_Functions_Ex::wp_normalize_path( Redux_Core::$upload_url . 'social-profiles/' );
|
||||
|
||||
Redux_Functions::init_wp_filesystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data file.
|
||||
*
|
||||
* @return array|bool|mixed|object
|
||||
*/
|
||||
public static function read_data_file() {
|
||||
$file = self::get_data_path();
|
||||
|
||||
if ( file_exists( $file ) ) {
|
||||
|
||||
// Get the contents of the file and stuff it in a variable.
|
||||
$data = self::$parent->filesystem->execute( 'get_contents', $file );
|
||||
|
||||
// Error or null, set the result to false.
|
||||
if ( false === $data || null === $data ) {
|
||||
$arr_data = false;
|
||||
|
||||
// Otherwise, decode the json object and return it.
|
||||
} else {
|
||||
$arr = json_decode( $data, true );
|
||||
$arr_data = $arr;
|
||||
}
|
||||
} else {
|
||||
$arr_data = false;
|
||||
}
|
||||
|
||||
return $arr_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write data file.
|
||||
*
|
||||
* @param array $arr_data Data.
|
||||
* @param string $file Filename.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function write_data_file( array $arr_data, string $file = '' ): bool {
|
||||
if ( ! is_dir( self::$upload_dir ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$file = ( '' === $file ) ? self::get_data_path() : self::$upload_dir . $file;
|
||||
|
||||
// Encode the array data.
|
||||
$data = wp_json_encode( $arr_data );
|
||||
|
||||
// Write to its file on the server, return the return value
|
||||
// True on success, false on error.
|
||||
return self::$parent->filesystem->execute( 'put_contents', $file, array( 'content' => $data ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data path.
|
||||
*
|
||||
* @return mixed|Redux_Functions_Ex|string
|
||||
*/
|
||||
public static function get_data_path() {
|
||||
return Redux_Functions_Ex::wp_normalize_path( self::$upload_dir . '/' . self::$parent->args['opt_name'] . '-' . self::$field_id . '.json' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field.
|
||||
*
|
||||
* @param array|ReduxFramework $redux ReduxFramework object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_field( $redux = array() ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( is_admin() && ( 'post-new.php' === $pagenow || 'post.php' === $pagenow ) ) {
|
||||
$inst = Redux_Instances::get_instance( self::$parent->args['opt_name'] );
|
||||
|
||||
$ext = $inst->extensions;
|
||||
|
||||
if ( isset( $ext['metaboxes'] ) ) {
|
||||
$obj = $ext['metaboxes'];
|
||||
$boxes = ( $obj->boxes );
|
||||
|
||||
foreach ( $boxes as $sections ) {
|
||||
foreach ( $sections['sections'] as $fields ) {
|
||||
if ( isset( $fields['fields'] ) ) {
|
||||
foreach ( $fields['fields'] as $f ) {
|
||||
if ( 'social_profiles' === $f['type'] ) {
|
||||
return $f;
|
||||
}
|
||||
|
||||
if ( 'repeater' === $f['type'] ) {
|
||||
foreach ( $f['fields'] as $r ) {
|
||||
if ( 'social_profiles' === $r['type'] ) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( ! empty( $redux ) ) {
|
||||
self::$parent = $redux;
|
||||
}
|
||||
|
||||
if ( isset( self::$parent->field_sections['social_profiles'] ) ) {
|
||||
return reset( self::$parent->field_sections['social_profiles'] );
|
||||
}
|
||||
|
||||
$arr = self::$parent;
|
||||
|
||||
foreach ( $arr as $part => $bla ) {
|
||||
if ( 'sections' === $part ) {
|
||||
foreach ( $bla as $field ) {
|
||||
|
||||
foreach ( $field as $arg => $val ) {
|
||||
if ( 'fields' === $arg ) {
|
||||
foreach ( $val as $v ) {
|
||||
if ( ! empty( $v ) ) {
|
||||
foreach ( $v as $id => $x ) {
|
||||
if ( 'type' === $id ) {
|
||||
if ( 'social_profiles' === $x ) {
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extra icons.
|
||||
*
|
||||
* @param array $defaults Default values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function add_extra_icons( array $defaults ): array {
|
||||
if ( empty( self::$field ) ) {
|
||||
self::$field = self::get_field();
|
||||
}
|
||||
|
||||
if ( isset( self::$field['icons'] ) && ! empty( self::$field['icons'] ) ) {
|
||||
$cur_count = count( $defaults );
|
||||
|
||||
foreach ( self::$field['icons'] as $arr ) {
|
||||
|
||||
$skip_add = false;
|
||||
foreach ( $defaults as $i => $v ) {
|
||||
if ( $arr['id'] === $v['id'] ) {
|
||||
|
||||
$defaults[ $i ] = array_replace( $v, $arr );
|
||||
$skip_add = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $skip_add ) {
|
||||
$arr['order'] = $cur_count;
|
||||
$defaults[ $cur_count ] = $arr;
|
||||
++$cur_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Included files.
|
||||
*
|
||||
* @param array $val Value.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function get_includes( array $val ): array {
|
||||
if ( empty( self::$field ) ) {
|
||||
self::$field = self::get_field();
|
||||
}
|
||||
|
||||
if ( isset( self::$field['include'] ) && is_array( self::$field['include'] ) && ! empty( self::$field['include'] ) ) {
|
||||
$icons = self::$field['include'];
|
||||
|
||||
$new_arr = array();
|
||||
|
||||
$idx = 0;
|
||||
foreach ( $val as $arr ) {
|
||||
foreach ( $icons as $icon ) {
|
||||
if ( $icon === $arr['id'] ) {
|
||||
$arr['order'] = $idx;
|
||||
$new_arr[ $idx ] = $arr;
|
||||
++$idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$new_arr = $val;
|
||||
}
|
||||
|
||||
return $new_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns default data from config.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_default_data(): array {
|
||||
$data = Redux_Social_Profiles_Defaults::get_social_media_defaults();
|
||||
$data = self::get_includes( $data );
|
||||
|
||||
return self::add_extra_icons( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to render the social icon.
|
||||
*
|
||||
* @param string $icon Icon css.
|
||||
* @param string $color Hex color.
|
||||
* @param string $background Background color.
|
||||
* @param string $title Icon title.
|
||||
* @param bool $output Print or echo.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public static function render_icon( string $icon, string $color, string $background, string $title, bool $output = true ) {
|
||||
if ( $color || $background ) {
|
||||
if ( '' === $color ) {
|
||||
$color = 'transparent';
|
||||
}
|
||||
|
||||
if ( '' === $background ) {
|
||||
$background = 'transparent';
|
||||
}
|
||||
|
||||
$inline = 'style="color:' . esc_attr( $color ) . ';background-color:' . esc_attr( $background ) . ';"';
|
||||
} else {
|
||||
$inline = '';
|
||||
}
|
||||
|
||||
$str = '<i class="fa ' . $icon . '" ' . $inline . ' title="' . $title . '"></i>';
|
||||
|
||||
if ( $output ) {
|
||||
echo $str; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Social Profiles Shortcode Class.
|
||||
*
|
||||
* @package Redux
|
||||
* @subpackage Extensions
|
||||
* @author Kevin Provance (kprovance)
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Shortcode' ) ) {
|
||||
|
||||
/**
|
||||
* Class Redux_Social_Profiles_Shortcode
|
||||
*/
|
||||
class Redux_Social_Profiles_Shortcode {
|
||||
|
||||
/**
|
||||
* ReduxFramework object pointer.
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* Field ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $field_id;
|
||||
|
||||
/**
|
||||
* Redux_Social_Profiles_Shortcode constructor.
|
||||
*
|
||||
* @param ReduxFramework $redux ReduxFramework object.
|
||||
* @param string $field_id Field ID.
|
||||
*/
|
||||
public function __construct( ReduxFramework $redux, string $field_id ) {
|
||||
$this->parent = $redux;
|
||||
$this->field_id = $field_id;
|
||||
|
||||
add_shortcode( 'social_profiles', array( $this, 'redux_social_profiles' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render shortcode.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function redux_social_profiles(): string {
|
||||
$redux_options = get_option( $this->parent->args['opt_name'] );
|
||||
$social_items = $redux_options[ $this->field_id ];
|
||||
|
||||
$html = '<ul class="redux-social-media-list clearfix">';
|
||||
|
||||
if ( is_array( $social_items ) ) {
|
||||
foreach ( $social_items as $social_item ) {
|
||||
if ( $social_item['enabled'] ) {
|
||||
$icon = $social_item['icon'];
|
||||
$color = $social_item['color'];
|
||||
$background = $social_item['background'];
|
||||
$base_url = $social_item['url'];
|
||||
$id = $social_item['id'];
|
||||
|
||||
// phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
$url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
|
||||
|
||||
$html .= '<li style="list-style: none;">';
|
||||
$html .= "<a href='" . $url . "'>";
|
||||
$html .= Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, '', false );
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= '</ul>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* Social Profiles Widget.
|
||||
*
|
||||
* @package Redux
|
||||
* @subpackage Extensions
|
||||
* @author Kevin Provance (kprovance)
|
||||
*/
|
||||
|
||||
// phpcs:ignoreFile
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Redux_Social_Profiles_Widget' ) ) {
|
||||
|
||||
/**
|
||||
* Class Redux_Social_Profiles_Widget
|
||||
*/
|
||||
class Redux_Social_Profiles_Widget {
|
||||
|
||||
/**
|
||||
* Field ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $field_id = '';
|
||||
|
||||
/**
|
||||
* ReduxFramework object pointer.
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
public $parent = null;
|
||||
|
||||
/**
|
||||
* Redux_Social_Profiles_Widget constructor.
|
||||
*
|
||||
* @param object $redux ReduxFramework object.
|
||||
* @param string $field_id Field ID.
|
||||
*/
|
||||
public function __construct( $redux, string $field_id ) {
|
||||
return;
|
||||
|
||||
$this->parent = $redux;
|
||||
$this->field_id = $field_id;
|
||||
|
||||
|
||||
$this->params = array(
|
||||
'parent' => $this->parent,
|
||||
'field_id' => $this->field_id,
|
||||
);
|
||||
|
||||
add_action( 'widgets_init', array( $this, 'load_widget' ), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load widget
|
||||
*/
|
||||
public function load_widget() {
|
||||
$x = new Extend_WP_Widget_Factory();
|
||||
$x->register( 'Redux_Social_Widget_Display', $this->params );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Extend_WP_Widget_Factory
|
||||
*/
|
||||
// phpcs:ignore Generic.Files.OneClassPerFile
|
||||
class Extend_WP_Widget_Factory extends WP_Widget_Factory {
|
||||
/**
|
||||
* Register widget.
|
||||
*
|
||||
* @param string|WP_Widget $widget Widget class.
|
||||
* @param null $param Who knows.
|
||||
*/
|
||||
public function register( $widget, $param = null ) {
|
||||
$this->widgets[ $widget ] = new $widget( $param );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Redux_Social_Widget_Display
|
||||
*/
|
||||
class Redux_Social_Widget_Display extends WP_Widget {
|
||||
|
||||
public $show_instance_in_rest = true;
|
||||
|
||||
/**
|
||||
* Redux_Social_Widget_Display constructor.
|
||||
*
|
||||
* @param array $params Params.
|
||||
*/
|
||||
public function __construct( $params ) {
|
||||
|
||||
extract( $params ); // phpcs:ignore WordPress.PHP.DontExtract
|
||||
|
||||
$this->parent = $parent;
|
||||
$this->field_id = $field_id;
|
||||
|
||||
$widget_ops = array(
|
||||
'classname' => 'redux-social-icons-display',
|
||||
'description' => __( 'Display social media links', 'redux-framework' ),
|
||||
'show_instance_in_rest' => true
|
||||
);
|
||||
|
||||
$control_ops = array(
|
||||
'width' => 250,
|
||||
'height' => 200,
|
||||
'id_base' => 'redux-social-icons-display',
|
||||
'show_instance_in_rest' => true,
|
||||
);
|
||||
|
||||
parent::__construct( 'redux-social-icons-display', 'Redux Social Widget', $widget_ops, $control_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget render.
|
||||
*
|
||||
* @param array $args Args.
|
||||
* @param array $instance Instance.
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
include_once 'class-redux-social-profiles-functions.php';
|
||||
|
||||
extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract
|
||||
|
||||
$title = $instance['title'];
|
||||
$redux_options = get_option( $this->parent->args['opt_name'] );
|
||||
|
||||
$social_items = $redux_options[ $this->field_id ];
|
||||
|
||||
echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
|
||||
if ( $title ) {
|
||||
echo $before_title . esc_html( $title ) . $after_title; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="redux-social-media-list clearfix">
|
||||
<?php
|
||||
if ( is_array( $social_items ) ) {
|
||||
foreach ( $social_items as $social_item ) {
|
||||
if ( $social_item['enabled'] ) {
|
||||
$icon = $social_item['icon'];
|
||||
$color = $social_item['color'];
|
||||
$background = $social_item['background'];
|
||||
$base_url = $social_item['url'];
|
||||
$id = $social_item['id'];
|
||||
|
||||
// phpcs:ignore WordPress.NamingConventions.ValidHookName
|
||||
$url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
|
||||
|
||||
echo '<li>';
|
||||
echo '<a href="' . esc_url( $url ) . '">';
|
||||
Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, '' );
|
||||
echo '</a>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
|
||||
echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Widget.
|
||||
*
|
||||
* @param array $new_instance New instance.
|
||||
* @param array $old_instance Old instance.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ): array {
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = wp_strip_all_tags( $new_instance['title'] ?? '' );
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render widget form.
|
||||
*
|
||||
* @param array $instance Instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
$defaults = array(
|
||||
'title' => esc_html__( 'Social', 'redux-framework' ),
|
||||
);
|
||||
|
||||
$instance = wp_parse_args( (array) $instance, $defaults );
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
||||
<?php esc_html_e( 'Title', 'redux-framework' ); ?>
|
||||
:
|
||||
<input
|
||||
class="widefat"
|
||||
id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
|
||||
value="<?php echo esc_attr( $instance['title'] ); ?>"/>
|
||||
</label>
|
||||
<label for="redux-social-icons-info">
|
||||
<?php
|
||||
$tab = Redux_Helpers::tab_from_field( $this->parent, 'social_profiles' );
|
||||
$slug = $this->parent->args['page_slug'];
|
||||
|
||||
// translators: %1$s: Settings page URL. %2$s: Closing a tag.
|
||||
printf( esc_html__( 'Control which icons are displayed and their urls on the %1$sssettings page%2$s', 'redux-framework' ), '<a href="' . esc_url( admin_url( 'admin.php?page=' . esc_attr( $slug ) . '&tab=' . esc_attr( $tab ) ) ) . '">', '</a>' );
|
||||
?>
|
||||
</label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package Redux Framework
|
||||
*/
|
||||
|
||||
echo null;
|
||||
@@ -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
@@ -0,0 +1,361 @@
|
||||
/* global redux, redux_change, reduxSocialDefaults */
|
||||
|
||||
( function( $ ) {
|
||||
'use strict';
|
||||
|
||||
redux.field_objects = redux.field_objects || {};
|
||||
redux.field_objects.social_profiles = redux.field_objects.social_profiles || {};
|
||||
redux.field_objects.social_profiles.fieldID = '';
|
||||
redux.field_objects.social_profiles.optName = '';
|
||||
|
||||
redux.field_objects.social_profiles.init = function( selector ) {
|
||||
if ( ! selector ) {
|
||||
selector = $( document ).find( '.redux-group-tab:visible' ).find( '.redux-container-social_profiles:visible' );
|
||||
}
|
||||
|
||||
$( 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;
|
||||
}
|
||||
|
||||
redux.field_objects.social_profiles.modInit( el );
|
||||
redux.field_objects.social_profiles.sortListByOrder( el );
|
||||
redux.field_objects.social_profiles.sortEnableListByOrder( el );
|
||||
redux.field_objects.social_profiles.initializeResetButtons( el );
|
||||
redux.field_objects.social_profiles.showEnabledDetails( el );
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.modInit = function( el ) {
|
||||
redux.field_objects.social_profiles.fieldID = el.find( '.redux-social-profiles-container' ).data( 'id' );
|
||||
redux.field_objects.social_profiles.optName = el.find( '.redux-social-profiles-container' ).data( 'opt-name' );
|
||||
|
||||
el.find( '#redux-social-profiles-list' ).sortable(
|
||||
{
|
||||
revert: 'invalid',
|
||||
cursor: 'move',
|
||||
helper: 'clone',
|
||||
handle: '.redux-icon-preview',
|
||||
placeholder: 'sortable-placeholder',
|
||||
stop: function() {
|
||||
redux.field_objects.social_profiles.reorderSocialItems( el );
|
||||
|
||||
redux_change( el.find( '.redux-social-profiles-container' ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '#redux-social-profiles-selector-list' ).sortable(
|
||||
{
|
||||
revert: 'invalid',
|
||||
cursor: 'move',
|
||||
helper: 'clone',
|
||||
placeholder: 'sortable-placeholder',
|
||||
stop: function() {
|
||||
redux.field_objects.social_profiles.reorderSocialEnable( el );
|
||||
|
||||
redux_change( el.find( '.redux-social-profiles-container' ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-social-profiles-url-text' ).on(
|
||||
'blur',
|
||||
function() {
|
||||
var key = $( this ).data( 'key' );
|
||||
var val = $( this ).val();
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString( el, key, 'url', val );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-social-profiles-item-enable' ).on(
|
||||
'click',
|
||||
function() {
|
||||
var key = $( this ).data( 'key' );
|
||||
|
||||
redux.field_objects.social_profiles.toggleEnabled( el, key );
|
||||
}
|
||||
);
|
||||
|
||||
el.find( '.redux-social-profiles-item-enabled input' ).on(
|
||||
'click',
|
||||
function( e ) {
|
||||
var item;
|
||||
var key;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
item = $( this );
|
||||
key = item.data( 'key' );
|
||||
|
||||
redux.field_objects.social_profiles.toggleEnabled( el, key );
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.valueFromDataString = function( el, key ) {
|
||||
var theData;
|
||||
|
||||
var dataEl = el.find( '.redux-social-profiles-hidden-data-' + key );
|
||||
var rawData = dataEl.val();
|
||||
|
||||
rawData = decodeURIComponent( rawData );
|
||||
rawData = JSON.parse( rawData );
|
||||
|
||||
theData = rawData.name;
|
||||
|
||||
return theData;
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString = function( el, key, name, value ) {
|
||||
var dataEl = el.find( '.redux-social-profiles-hidden-data-' + key );
|
||||
var rawData = dataEl.val();
|
||||
|
||||
rawData = decodeURIComponent( rawData );
|
||||
rawData = JSON.parse( rawData );
|
||||
|
||||
rawData[name] = value;
|
||||
|
||||
rawData = JSON.stringify( rawData );
|
||||
rawData = encodeURIComponent( rawData );
|
||||
|
||||
dataEl.val( rawData );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.sortListByOrder = function( el ) {
|
||||
var ul = el.find( 'ul#redux-social-profiles-list ' );
|
||||
var li = ul.children( 'li' );
|
||||
|
||||
li.detach().sort(
|
||||
function( a, b ) {
|
||||
return $( a ).find( '.redux-social-profiles-item-order input' ).val() - $( b ).find( '.redux-social-profiles-item-order input' ).val();
|
||||
}
|
||||
);
|
||||
|
||||
ul.append( li );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.sortEnableListByOrder = function( el ) {
|
||||
var ul = el.find( 'ul#redux-social-profiles-selector-list' );
|
||||
var li = ul.children( 'li' );
|
||||
|
||||
li.detach().sort(
|
||||
function( a, b ) {
|
||||
return $( a ).data( 'order' ) - $( b ).data( 'order' );
|
||||
}
|
||||
);
|
||||
|
||||
ul.append( li );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.initializeResetButtons = function( el ) {
|
||||
el.find( '.redux-social-profiles-item-reset a' ).on(
|
||||
'click',
|
||||
function() {
|
||||
var itemToReset;
|
||||
|
||||
var buttonClicked = $( this );
|
||||
|
||||
if ( buttonClicked.length > 0 ) {
|
||||
itemToReset = buttonClicked.data( 'value' );
|
||||
|
||||
redux.field_objects.social_profiles.resetItem( el, itemToReset );
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.resetItem = function( el, itemID ) {
|
||||
var defaultTextColor = reduxSocialDefaults[itemID].color;
|
||||
var defaultBackgroundColor = reduxSocialDefaults[itemID].background;
|
||||
|
||||
el.find( '.redux-social-profiles-color-picker-' + itemID + '.text' ).spectrum( 'set', defaultTextColor );
|
||||
el.find( '.redux-social-profiles-color-picker-' + itemID + '.background' ).spectrum( 'set', defaultBackgroundColor );
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString( el, itemID, 'color', defaultTextColor );
|
||||
redux.field_objects.social_profiles.updateDataString( el, itemID, 'background', defaultBackgroundColor );
|
||||
|
||||
redux.field_objects.social_profiles.updatePreview( el, itemID );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.updatePreview = function( el, itemID ) {
|
||||
var textColorInput = redux.field_objects.social_profiles.valueFromDataString( el, itemID, 'color' );
|
||||
var backgroundColorInput = redux.field_objects.social_profiles.valueFromDataString( el, itemID, 'background' );
|
||||
|
||||
var icon = reduxSocialDefaults[itemID].icon;
|
||||
var symbol = el.find( '#redux-social-item-' + itemID + ' i.' + icon );
|
||||
|
||||
symbol.css( 'background-color', backgroundColorInput );
|
||||
symbol.css( 'color', textColorInput );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.toggleEnabled = function( el, itemID ) {
|
||||
var itemEnable = el.find( '#redux-social-profiles-item-enable-' + itemID );
|
||||
var enabled = itemEnable.hasClass( 'enabled' );
|
||||
|
||||
var enabledBool;
|
||||
if ( enabled ) {
|
||||
itemEnable.removeClass( 'enabled' );
|
||||
enabledBool = false;
|
||||
} else {
|
||||
itemEnable.addClass( 'enabled' );
|
||||
enabledBool = true;
|
||||
}
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString( el, itemID, 'enabled', enabledBool );
|
||||
|
||||
redux_change( el.find( '.redux-social-profiles-container' ) );
|
||||
|
||||
redux.field_objects.social_profiles.showEnabledDetails( el );
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.showEnabledDetails = function( el ) {
|
||||
var palette;
|
||||
|
||||
var socialItems = el.find( 'li.redux-social-profiles-item-enable' );
|
||||
|
||||
if ( socialItems.length > 0 ) {
|
||||
|
||||
palette = [
|
||||
['#000000', '#434343', '#666666', '#999999', '#b7b7b7', '#cccccc', '#d9d9d9', '#efefef', '#f3f3f3', '#ffffff'],
|
||||
['#980000', '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff', '#ff00ff'],
|
||||
['#e6b8af', '#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d9ead3', '#c9daf8', '#cfe2f3', '#d9d2e9', '#ead1dc'],
|
||||
['#dd7e6b', '#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#a4c2f4', '#9fc5e8', '#b4a7d6', '#d5a6bd'],
|
||||
['#cc4125', '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6d9eeb', '#6fa8dc', '#8e7cc3', '#c27ba0'],
|
||||
['#a61c00', '#cc0000', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3c78d8', '#3d85c6', '#674ea7', '#a64d79'],
|
||||
['#85200c', '#990000', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#1155cc', '#0b5394', '#351c75', '#741b47'],
|
||||
['#5b0f00', '#660000', '#783f04', '#7f6000', '#274e13', '#0c343d', '#1c4587', '#073763', '#20124d', '#4c1130']
|
||||
];
|
||||
|
||||
socialItems.each(
|
||||
function() {
|
||||
var enabledInput;
|
||||
var hidden;
|
||||
|
||||
var item = $( this );
|
||||
var key = item.data( 'key' );
|
||||
|
||||
if ( item.hasClass( 'enabled' ) ) {
|
||||
|
||||
el.find( '.redux-social-profiles-color-picker-' + key ).spectrum(
|
||||
{
|
||||
showAlpha: true,
|
||||
showInput: true,
|
||||
allowEmpty: true,
|
||||
className: 'redux-full-spectrum',
|
||||
showInitial: true,
|
||||
showPalette: true,
|
||||
showSelectionPalette: true,
|
||||
clickoutFiresChange: true,
|
||||
preferredFormat: 'rgb',
|
||||
localStorageKey: 'redux.social-profiles.spectrum',
|
||||
palette: palette,
|
||||
change: function( color ) {
|
||||
var className;
|
||||
|
||||
if ( $( this ).hasClass( 'text' ) ) {
|
||||
className = 'color';
|
||||
} else {
|
||||
className = 'background';
|
||||
}
|
||||
|
||||
if ( null === color ) {
|
||||
color = '';
|
||||
} else {
|
||||
color = color.toRgbString();
|
||||
}
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString( el, key, className, color );
|
||||
redux.field_objects.social_profiles.updatePreview( el, key );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
el.find( 'li#redux-social-item-' + key ).slideDown();
|
||||
|
||||
enabledInput = el.find( 'input.checkbox-' + key );
|
||||
hidden = $( enabledInput ).parent().find( '.checkbox-check-' + key );
|
||||
|
||||
enabledInput.prop( 'checked', true );
|
||||
hidden.val( 1 );
|
||||
} else {
|
||||
item = el.find( 'li#redux-social-item-' + key );
|
||||
|
||||
if ( item.is( ':hidden' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.slideUp( 'medium' );
|
||||
|
||||
enabledInput = el.find( 'input.checkbox-' + key );
|
||||
hidden = $( enabledInput ).parent().find( '.checkbox-check-' + key );
|
||||
|
||||
enabledInput.prop( 'checked', false );
|
||||
hidden.val( 0 );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.reorderSocialItems = function( el ) {
|
||||
var socialItems = el.find( 'ul#redux-social-profiles-list li' );
|
||||
|
||||
if ( socialItems.length > 0 ) {
|
||||
socialItems.each(
|
||||
function( index ) {
|
||||
var item = $( this );
|
||||
var key = item.data( 'key' );
|
||||
var orderInput = item.find( '.redux-social-profiles-item-order input' );
|
||||
|
||||
orderInput.val( index );
|
||||
redux.field_objects.social_profiles.updateDataString( el, key, 'order', index );
|
||||
|
||||
el.find( '#redux-social-profiles-item-enable-' + key ).data( 'order', index );
|
||||
}
|
||||
);
|
||||
|
||||
redux.field_objects.social_profiles.sortEnableListByOrder( el );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
redux.field_objects.social_profiles.reorderSocialEnable = function( el ) {
|
||||
var socialItems = el.find( 'ul#redux-social-profiles-selector-list li' );
|
||||
|
||||
if ( socialItems.length > 0 ) {
|
||||
socialItems.each(
|
||||
function( index ) {
|
||||
var item = $( this );
|
||||
var key = item.data( 'key' );
|
||||
var control = el.find( 'li#redux-social-item-' + key );
|
||||
var orderInput = control.find( '.redux-social-profiles-item-order input' );
|
||||
|
||||
item.data( 'order', index );
|
||||
|
||||
orderInput.val( index );
|
||||
|
||||
redux.field_objects.social_profiles.updateDataString( el, key, 'order', index );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
redux.field_objects.social_profiles.sortListByOrder( el );
|
||||
};
|
||||
} )( jQuery );
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,250 @@
|
||||
ul {
|
||||
&#redux-social-profiles-selector-list {
|
||||
li {
|
||||
&.sortable-placeholder {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border: 1px dashed gray;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&#redux-social-profiles-list {
|
||||
li {
|
||||
line-height: 40px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
clear: left;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.redux-icon-preview {
|
||||
float: left;
|
||||
display: block;
|
||||
font-size: 30px;
|
||||
cursor: move;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.redux-social-item-container {
|
||||
background-color: white;
|
||||
height: 100%;
|
||||
border: #D8D8D8 1px solid;
|
||||
}
|
||||
|
||||
#redux-social-profiles-information {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.redux-social-profiles-item-enabled {
|
||||
float: right !important;
|
||||
padding-right: 10px;
|
||||
margin-top: -40px;
|
||||
}
|
||||
|
||||
.redux-social-profiles-selector-container {
|
||||
display: inline-block;
|
||||
padding-left: 10px;
|
||||
padding-bottom: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
li {
|
||||
&.redux-social-profiles-item-enable {
|
||||
display: block;
|
||||
float: left;
|
||||
font-size: 30px;
|
||||
cursor: pointer;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
padding: 0 5px 5px;
|
||||
text-align: center;
|
||||
border: 1px solid transparent;
|
||||
&.enabled {
|
||||
color: #555;
|
||||
border-color: #D8D8D8;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #e5e5e5;
|
||||
color: #777;
|
||||
border-color: #D8D8D8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-item-name {
|
||||
width: auto;
|
||||
font-size: 150% !important;
|
||||
|
||||
.redux-text-name-label {
|
||||
font-size: 150% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-icon-preview,
|
||||
.redux-social-profiles-item-enable-item-name,
|
||||
.redux-social-profiles-item-enabled,
|
||||
.redux-social-profiles-text-color,
|
||||
.redux-social-profiles-background-color,
|
||||
.redux-social-profiles-link-url,
|
||||
.redux-social-profiles-item-order,
|
||||
.redux-social-profiles-item-reset {
|
||||
display: block;
|
||||
float: left;
|
||||
margin-left: 10px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.rdx-icon-preview input,
|
||||
.rdx-social-profiles-item-name input,
|
||||
.rdx-social-profiles-item-enabled input,
|
||||
.rdx-social-profiles-text-color div,
|
||||
.rdx-social-profiles-background-color div,
|
||||
.rdx-social-profiles-link-url input,
|
||||
.rdx-social-profiles-item-order input {
|
||||
/* margin-left: 5px;*/
|
||||
}
|
||||
|
||||
.redux-social-profiles-text-color {
|
||||
.redux-text-color-label {
|
||||
top: -30px;
|
||||
left: auto;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-background-color {
|
||||
padding-left: 9px !important;
|
||||
|
||||
.redux-background-color-label {
|
||||
top: -30px;
|
||||
left: auto;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-item-order {
|
||||
display: none;
|
||||
|
||||
input {
|
||||
width: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-item-reset {
|
||||
float: right;
|
||||
padding-right: 10px;
|
||||
margin-top: 15px;
|
||||
|
||||
.button {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-link-url {
|
||||
clear: left !important;
|
||||
margin-top: -10px;
|
||||
|
||||
.redux-text-url-label {
|
||||
margin-bottom: 3px !important;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
top: 30px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-item-container {
|
||||
label {
|
||||
display: block;
|
||||
position: relative;
|
||||
font-size: 12px !important;
|
||||
text-align: left;
|
||||
color: #999999;
|
||||
margin: 4px 0 2px 0 !important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.input_wrapper {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
width: 54%;
|
||||
max-width: 54%;
|
||||
min-width: 70px;
|
||||
float: left;
|
||||
clear: none;
|
||||
height: 57px;
|
||||
box-sizing: border-box;
|
||||
vertical-align: baseline;
|
||||
|
||||
&.no-color-pickers {
|
||||
width: 80%;
|
||||
max-width: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
.picker_wrapper {
|
||||
top: 17px;
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 0 4px 0 5px;
|
||||
padding: 0 0 0 10px;
|
||||
clear: none;
|
||||
height: 57px;
|
||||
box-sizing: border-box;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
ul {
|
||||
&#redux-social-profiles-list {
|
||||
li {
|
||||
height: 110px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-item-container {
|
||||
.picker_wrapper {
|
||||
top: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-link-url {
|
||||
.redux-text-url-label {
|
||||
margin-bottom: -16px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 628px) {
|
||||
ul {
|
||||
&#redux-social-profiles-list {
|
||||
li {
|
||||
height: 170px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.redux-social-profiles-text-color {
|
||||
clear: both !important;
|
||||
}
|
||||
|
||||
.redux-social-item-container {
|
||||
.picker_wrapper {
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user