Install all public plugins
This commit is contained in:
parent
8ca4617847
commit
bfcddf649c
170
wp-content/plugins/attesa-extra/attesa-extra.php
Normal file
170
wp-content/plugins/attesa-extra/attesa-extra.php
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Plugin Name: Attesa Extra
|
||||||
|
* Plugin URI: https://attesawp.com/
|
||||||
|
* Description: Add extra features to Attesa WordPress Theme.
|
||||||
|
* Version: 1.2.2
|
||||||
|
* Author: AttesaWP
|
||||||
|
* Author URI: https://attesawp.com/about/
|
||||||
|
* Domain Path: /languages
|
||||||
|
* Text Domain: attesa-extra
|
||||||
|
* License: GPL2
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exit if accessed directly */
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Attesa_extra() {
|
||||||
|
return Attesa_extra::instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
Attesa_extra();
|
||||||
|
|
||||||
|
final class Attesa_extra {
|
||||||
|
private static $_instance = null;
|
||||||
|
public function __construct() {
|
||||||
|
$this->plugin_path = plugin_dir_path( __FILE__ );
|
||||||
|
define( 'ATTESA_EXTRA_PLUGIN_VERSION', '1.2.2' );
|
||||||
|
define( 'AE_PATH', $this->plugin_path );
|
||||||
|
if ($this->attesaextra_check_load()) {
|
||||||
|
add_action( 'after_setup_theme', array($this, 'attesaextra_add_image_size' ));
|
||||||
|
add_action( 'init', array( $this, 'setup' ) );
|
||||||
|
require_once dirname( __FILE__ ) .'/panel/attesa-custom-templates.php';
|
||||||
|
add_filter( 'plugin_row_meta', array($this, 'attesaextra_add_meta_links'), 10 , 2 );
|
||||||
|
add_action( 'widgets_init', array( $this, 'custom_widgets' ), 10 );
|
||||||
|
add_action( 'init', array($this, 'attesaextra_actions') );
|
||||||
|
}
|
||||||
|
// Allow shortcodes in text widgets
|
||||||
|
add_filter( 'widget_text', 'do_shortcode' );
|
||||||
|
add_action( 'plugins_loaded', array($this, 'attesaextra_load_plugin') );
|
||||||
|
}
|
||||||
|
/* Check if Attesa or parent theme is active */
|
||||||
|
public function attesaextra_check_load() {
|
||||||
|
$theme = wp_get_theme();
|
||||||
|
if ('Attesa' == $theme->name || 'attesa' == $theme->template ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Setup */
|
||||||
|
public function setup() {
|
||||||
|
require_once dirname( __FILE__ ) .'/metabox/butterbean/butterbean.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/metabox/metabox.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/metabox/hooks.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/metabox/functions.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/metabox/shortcodes.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/customizer/customizer.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/customizer/functions.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/panel/attesa-admin-page.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/panel/demos.php';
|
||||||
|
if ( !class_exists( 'Attesa_pro' ) ) {
|
||||||
|
require_once dirname( __FILE__ ) .'/panel/attesa-pro-features.php';
|
||||||
|
}
|
||||||
|
/* Check if Elementor plugin is installed */
|
||||||
|
if ( in_array( 'elementor/elementor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
||||||
|
require_once dirname( __FILE__ ) .'/elementor/widgets.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/elementor/compatibility/wpml_compatibility.php';
|
||||||
|
}
|
||||||
|
add_action( 'init', array( $this, 'register_custom_js' ) );
|
||||||
|
add_action( 'wp_head', array( $this, 'custom_js_head' ), 9999 );
|
||||||
|
add_action( 'wp_footer', array( $this, 'custom_js_footer' ), 9999 );
|
||||||
|
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'attesaextra_add_install_demos_link') );
|
||||||
|
}
|
||||||
|
/* Register custom widgets */
|
||||||
|
public static function custom_widgets() {
|
||||||
|
if (function_exists('attesa_options')) {
|
||||||
|
require_once dirname( __FILE__ ) .'/widgets/recent-post.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/widgets/latest-comments.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/widgets/random-post.php';
|
||||||
|
require_once dirname( __FILE__ ) .'/widgets/social-buttons.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Register custom code for header and footer */
|
||||||
|
public function register_custom_js() {
|
||||||
|
require_once dirname( __FILE__ ) .'/panel/custom-code.php';
|
||||||
|
}
|
||||||
|
/* Add extra link to the meta plugin */
|
||||||
|
public function attesaextra_add_meta_links( $links, $file ) {
|
||||||
|
if ( strpos( $file, 'attesa-extra.php' ) !== false && !class_exists( 'Attesa_pro' ) ) {
|
||||||
|
$new_links = array(
|
||||||
|
'<a style="font-weight:bold;" href="https://attesawp.com/attesa-pro/" target="_blank" rel="external" ><span class="dashicons dashicons-star-filled"></span> ' . esc_html__( 'Get Attesa PRO Addon', 'attesa-extra' ) . '</a>',
|
||||||
|
);
|
||||||
|
$links = array_merge( $links, $new_links );
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
/* Add Install Demos link */
|
||||||
|
public function attesaextra_add_install_demos_link($links) {
|
||||||
|
$demos_link = array(
|
||||||
|
'<a href="' . admin_url('admin.php?page=install_demos') . '">' . esc_html__( 'Install Demos','attesa-extra') . '</a>',
|
||||||
|
);
|
||||||
|
return array_merge( $links, $demos_link );
|
||||||
|
}
|
||||||
|
/* Add or Remove action from Attesa Theme */
|
||||||
|
public function attesaextra_actions() {
|
||||||
|
remove_action('attesa_footer_widgets', 'attesa_get_footer_widgets');
|
||||||
|
add_action('attesa_footer_widgets', 'attesaextra_get_footer');
|
||||||
|
remove_action('attesa_header', 'attesa_get_header');
|
||||||
|
add_action('attesa_header', 'attesaextra_get_header');
|
||||||
|
remove_action('attesa_entry_header', 'attesa_get_entry_header');
|
||||||
|
add_action('attesa_entry_header', 'attesaextra_get_entry_header');
|
||||||
|
}
|
||||||
|
/* Load text domain and check for admin notices */
|
||||||
|
public function attesaextra_load_plugin() {
|
||||||
|
load_plugin_textdomain( 'attesa-extra', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
||||||
|
if (!$this->attesaextra_check_load()) {
|
||||||
|
add_action( 'admin_notices', array($this, 'attesaextra_fail_load' ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Admin notices if Attesa theme is not installed or active */
|
||||||
|
public function attesaextra_fail_load() {
|
||||||
|
$screen = get_current_screen();
|
||||||
|
if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( ! current_user_can( 'install_themes' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$activation_url = admin_url( 'theme-install.php?search=attesa');
|
||||||
|
$message = '<p>' . esc_html__( 'Attesa Extra plugin is not working because you need to activate Attesa theme.', 'attesa-extra' ) . '</p>';
|
||||||
|
$message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', esc_url($activation_url), esc_html__( 'Activate Attesa theme', 'attesa-extra' ) ) . '</p>';
|
||||||
|
echo '<div class="notice notice-warning attesa-extra"><p>' . $message . '</p></div>'; //$message is escaped
|
||||||
|
}
|
||||||
|
/* Add custom js in header */
|
||||||
|
public static function custom_js_head( $output = NULL ) {
|
||||||
|
$output = apply_filters( 'attesa_header_code', $output );
|
||||||
|
if ( ! empty( $output ) ) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<?php echo $output; ?>
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Add custom js in footer */
|
||||||
|
public static function custom_js_footer( $output = NULL ) {
|
||||||
|
$output = apply_filters( 'attesa_footer_code', $output );
|
||||||
|
if ( ! empty( $output ) ) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<?php echo $output; ?>
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Load this file after setup theme */
|
||||||
|
public function attesaextra_add_image_size() {
|
||||||
|
add_image_size( 'attesa-box-small', 70, 70, true);
|
||||||
|
}
|
||||||
|
public function __clone() {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'attesa-extra' ), '1.0.0' );
|
||||||
|
}
|
||||||
|
public function __wakeup() {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'attesa-extra' ), '1.0.0' );
|
||||||
|
}
|
||||||
|
public static function instance() {
|
||||||
|
if ( is_null( self::$_instance ) )
|
||||||
|
self::$_instance = new self();
|
||||||
|
return self::$_instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
202
wp-content/plugins/attesa-extra/customizer/customizer.php
Normal file
202
wp-content/plugins/attesa-extra/customizer/customizer.php
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<?php
|
||||||
|
/* Additional settings for the customizer */
|
||||||
|
function attesaextra_manage_customizer() {
|
||||||
|
if (function_exists('attesa_options') ) {
|
||||||
|
global $wp_customize;
|
||||||
|
/* Create the "Custom JS Code" section */
|
||||||
|
$wp_customize->add_section( 'section_attesa_theme_options_custom_code', array(
|
||||||
|
'title' => esc_html__( 'Custom JS Code', 'attesa-extra' ),
|
||||||
|
'priority' => 12,
|
||||||
|
'panel' => 'attesa_themeoptions',
|
||||||
|
) );
|
||||||
|
/* Heading custom js code */
|
||||||
|
if( class_exists( 'Attesa_Customize_Heading' ) ) {
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_heading_custom_code]', array(
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
'type' => 'option',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new Attesa_Customize_Heading(
|
||||||
|
$wp_customize,
|
||||||
|
'attesa_theme_options[_heading_custom_code]',
|
||||||
|
array(
|
||||||
|
'settings' => 'attesa_theme_options[_heading_custom_code]',
|
||||||
|
'section' => 'section_attesa_theme_options_custom_code',
|
||||||
|
'label' => __( 'Custom JS code', 'attesa-extra' ),
|
||||||
|
'description' => __( 'Use this section to insert custom JavaScript code in your website.', 'attesa-extra' ),
|
||||||
|
'priority' => 1,
|
||||||
|
))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/* Use header code */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_custom_code_header_use]', array(
|
||||||
|
'default' => '',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'sanitize_callback' => 'attesa_sanitize_checkbox'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_custom_code_header_use]', array(
|
||||||
|
'label' => __( 'Add javascript in header', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_custom_code',
|
||||||
|
'settings' => 'attesa_theme_options[_custom_code_header_use]',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'priority' => 1,
|
||||||
|
) );
|
||||||
|
/* Header Code */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_custom_code_header]', array(
|
||||||
|
'default' => '',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'transport' => 'postMessage',
|
||||||
|
'sanitize_callback' => 'wp_unslash',
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_custom_code_header]', array(
|
||||||
|
'label' => __( 'Header Code', 'attesa-extra' ),
|
||||||
|
'description' => __( 'These scripts will be printed in the <code><head></code> section. No need to add <script> tag.', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_custom_code',
|
||||||
|
'settings' => 'attesa_theme_options[_custom_code_header]',
|
||||||
|
'type' => 'textarea',
|
||||||
|
'active_callback' => 'attesaextra_is_headercode_active',
|
||||||
|
'priority' => 2,
|
||||||
|
) );
|
||||||
|
/* Use footer code */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_custom_code_footer_use]', array(
|
||||||
|
'default' => '',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'sanitize_callback' => 'attesa_sanitize_checkbox'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_custom_code_footer_use]', array(
|
||||||
|
'label' => __( 'Add javascript in footer', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_custom_code',
|
||||||
|
'settings' => 'attesa_theme_options[_custom_code_footer_use]',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'priority' => 3,
|
||||||
|
) );
|
||||||
|
/* Footer Code */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_custom_code_footer]', array(
|
||||||
|
'default' => '',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'transport' => 'postMessage',
|
||||||
|
'sanitize_callback' => 'wp_unslash',
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_custom_code_footer]', array(
|
||||||
|
'label' => __( 'Footer Code', 'attesa-extra' ),
|
||||||
|
'description' => __( 'These scripts will be printed above the <code></body></code> tag. No need to add <script> tag.', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_custom_code',
|
||||||
|
'settings' => 'attesa_theme_options[_custom_code_footer]',
|
||||||
|
'type' => 'textarea',
|
||||||
|
'active_callback' => 'attesaextra_is_footercode_active',
|
||||||
|
'priority' => 4,
|
||||||
|
) );
|
||||||
|
/* Custom Footer with Attesa Templates */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_footer_choose]', array(
|
||||||
|
'default' => 'default',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'sanitize_callback' => 'attesa_sanitize_select'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_footer_choose]', array(
|
||||||
|
'label' => __( 'Choose the footer', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_footer',
|
||||||
|
'settings' => 'attesa_theme_options[_footer_choose]',
|
||||||
|
'type' => 'select',
|
||||||
|
'priority' => 1,
|
||||||
|
'choices' => array(
|
||||||
|
'default' => __( 'Default with widgets', 'attesa-extra'),
|
||||||
|
'custom' => __( 'Custom via Attesa Templates', 'attesa-extra'),
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
/* Get all Attesa Templates */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_footer_get_attesa_template]', array(
|
||||||
|
'default' => '0',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'sanitize_callback' => 'attesa_sanitize_select'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_footer_get_attesa_template]', array(
|
||||||
|
'label' => __( 'Choose the template for the footer', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_footer',
|
||||||
|
'settings' => 'attesa_theme_options[_footer_get_attesa_template]',
|
||||||
|
'type' => 'select',
|
||||||
|
'active_callback' => 'attesaextra_is_customfooter_active',
|
||||||
|
'priority' => 1,
|
||||||
|
'choices' => attesaextra_get_attesa_templates(),
|
||||||
|
) );
|
||||||
|
/* Add new attesa templates for header format */
|
||||||
|
$wp_customize->get_control( 'attesa_theme_options[_header_format]' )->choices = array(
|
||||||
|
'compat' => __( 'Compat', 'attesa-extra'),
|
||||||
|
'featuredtitle' => __( 'Featured Title', 'attesa-extra'),
|
||||||
|
'menupopup' => __( 'Menu Popup', 'attesa-extra'),
|
||||||
|
'custom' => __( 'Custom via Attesa Templates', 'attesa-extra'),
|
||||||
|
);
|
||||||
|
/* Get all Attesa Templates */
|
||||||
|
$wp_customize->add_setting('attesa_theme_options[_header_get_attesa_template]', array(
|
||||||
|
'default' => '0',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'sanitize_callback' => 'attesa_sanitize_select'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control('attesa_theme_options[_header_get_attesa_template]', array(
|
||||||
|
'label' => __( 'Choose the template for the header', 'attesa-extra' ),
|
||||||
|
'section' => 'section_attesa_theme_options_header',
|
||||||
|
'settings' => 'attesa_theme_options[_header_get_attesa_template]',
|
||||||
|
'type' => 'select',
|
||||||
|
'active_callback' => 'attesaextra_is_customheader_active',
|
||||||
|
'priority' => 1,
|
||||||
|
'choices' => attesaextra_get_attesa_templates(),
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'customize_register', 'attesaextra_manage_customizer', 11 );
|
||||||
|
|
||||||
|
function attesaextra_is_headercode_active() {
|
||||||
|
$useHeaderCode = attesa_options('_custom_code_header_use', '');
|
||||||
|
if ($useHeaderCode == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function attesaextra_is_footercode_active() {
|
||||||
|
$useFooterCode = attesa_options('_custom_code_footer_use', '');
|
||||||
|
if ($useFooterCode == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function attesaextra_is_customfooter_active() {
|
||||||
|
$customFooter = attesa_options('_footer_choose', 'default');
|
||||||
|
if ($customFooter == 'custom') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter('attesa_is_customfooter_active_filter', 'attesaextra_is_customfooter_active_filter');
|
||||||
|
function attesaextra_is_customfooter_active_filter() {
|
||||||
|
$customFooter = attesa_options('_footer_choose', 'default');
|
||||||
|
if ($customFooter == 'custom') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function attesaextra_is_customheader_active() {
|
||||||
|
$customHeader = attesa_options('_header_format', 'compat');
|
||||||
|
if ($customHeader == 'custom') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter('attesa_is_customheader_active_filter', 'attesaextra_is_customheader_active_filter');
|
||||||
|
function attesaextra_is_customheader_active_filter() {
|
||||||
|
$customHeader = attesa_options('_header_format', 'compat');
|
||||||
|
if ($customHeader == 'custom') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
634
wp-content/plugins/attesa-extra/customizer/functions.php
Normal file
634
wp-content/plugins/attesa-extra/customizer/functions.php
Normal file
@ -0,0 +1,634 @@
|
|||||||
|
<?php
|
||||||
|
/* Add custom code in the header */
|
||||||
|
function attesaextra_custom_code_header() {
|
||||||
|
if (function_exists('attesa_options') ) {
|
||||||
|
// Ignore if Attesa option for header code is uncheck
|
||||||
|
if ( !attesa_options('_custom_code_header_use', '')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ignore admin, feed, robots or trackbacks
|
||||||
|
if ( is_admin() || is_feed() || is_robots() || is_trackback() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$customHeaderCode = attesa_options('_custom_code_header', false);
|
||||||
|
if ( empty( $customHeaderCode ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( trim( $customHeaderCode ) == '' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return wp_unslash( $customHeaderCode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'attesa_header_code','attesaextra_custom_code_header' );
|
||||||
|
|
||||||
|
/* Add custom code in the footer */
|
||||||
|
function attesaextra_custom_code_footer() {
|
||||||
|
if (function_exists('attesa_options') ) {
|
||||||
|
// Ignore if Attesa option for footer code is uncheck
|
||||||
|
if ( !attesa_options('_custom_code_footer_use', '')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ignore admin, feed, robots or trackbacks
|
||||||
|
if ( is_admin() || is_feed() || is_robots() || is_trackback() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$customFooterCode = attesa_options('_custom_code_footer', false);
|
||||||
|
if ( empty( $customFooterCode ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( trim( $customFooterCode ) == '' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return wp_unslash( $customFooterCode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'attesa_footer_code','attesaextra_custom_code_footer' );
|
||||||
|
|
||||||
|
/* Get all Attesa Templates post */
|
||||||
|
function attesaextra_get_attesa_templates() {
|
||||||
|
$templates = array( __( '-- Select --', 'attesa-extra' ) );
|
||||||
|
$get_templates = get_posts( array( 'post_type' => 'attesa_templates', 'numberposts' => -1, 'post_status' => 'publish' ) );
|
||||||
|
if ( ! empty ( $get_templates ) ) {
|
||||||
|
foreach ( $get_templates as $template ) {
|
||||||
|
$templates[ $template->ID ] = $template->post_title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $templates;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the footer with optional Attesa Templates */
|
||||||
|
function attesaextra_get_footer() {
|
||||||
|
if(attesa_check_bar('footer')):
|
||||||
|
if (attesa_options('_footer_choose', 'default') == 'default' ): ?>
|
||||||
|
<?php $footerNumbers = attesa_options('_footer_numbers', 'threecol'); ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-1' ) || is_active_sidebar( 'footer-2' ) || is_active_sidebar( 'footer-3' ) || is_active_sidebar( 'footer-4' ) ) : ?>
|
||||||
|
<div class="footerArea">
|
||||||
|
<div class="attesaFooterWidget <?php echo esc_attr($footerNumbers); ?>">
|
||||||
|
<?php do_action('attesa_before_footer_widgets'); ?>
|
||||||
|
<div class="attesa-footer-container">
|
||||||
|
<?php if ($footerNumbers == 'onecol'): ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
|
||||||
|
<aside id="footer-1" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-1' ); ?>
|
||||||
|
</aside><!-- #footer-1 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php elseif ($footerNumbers == 'twocol'): ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
|
||||||
|
<aside id="footer-1" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-1' ); ?>
|
||||||
|
</aside><!-- #footer-1 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
|
||||||
|
<aside id="footer-2" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-2' ); ?>
|
||||||
|
</aside><!-- #footer-2 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php elseif ($footerNumbers == 'threecol'): ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
|
||||||
|
<aside id="footer-1" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-1' ); ?>
|
||||||
|
</aside><!-- #footer-1 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
|
||||||
|
<aside id="footer-2" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-2' ); ?>
|
||||||
|
</aside><!-- #footer-2 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-3' ) ) : ?>
|
||||||
|
<aside id="footer-3" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-3' ); ?>
|
||||||
|
</aside><!-- #footer-3 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php elseif ($footerNumbers == 'fourcol'): ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
|
||||||
|
<aside id="footer-1" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-1' ); ?>
|
||||||
|
</aside><!-- #footer-1 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
|
||||||
|
<aside id="footer-2" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-2' ); ?>
|
||||||
|
</aside><!-- #footer-2 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-3' ) ) : ?>
|
||||||
|
<aside id="footer-3" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-3' ); ?>
|
||||||
|
</aside><!-- #footer-3 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( 'footer-4' ) ) : ?>
|
||||||
|
<aside id="footer-4" class="widget-area footer">
|
||||||
|
<?php dynamic_sidebar( 'footer-4' ); ?>
|
||||||
|
</aside><!-- #footer-3 -->
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php do_action('attesa_after_footer_widgets'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="attesa-custom-footer">
|
||||||
|
<?php $attesaTemplateID = attesa_options('_footer_get_attesa_template', '0'); ?>
|
||||||
|
<?php if($attesaTemplateID != '0') {
|
||||||
|
$args = array( 'p' => intval($attesaTemplateID), 'post_type' => 'attesa_templates');
|
||||||
|
$query = new WP_Query( $args );
|
||||||
|
if ( $query->have_posts() ) :
|
||||||
|
while ( $query->have_posts() ) :
|
||||||
|
$query->the_post();
|
||||||
|
the_content();
|
||||||
|
endwhile;
|
||||||
|
endif;
|
||||||
|
wp_reset_postdata();
|
||||||
|
} else {
|
||||||
|
printf(
|
||||||
|
/* translators: %1$s: create new custom template link */
|
||||||
|
wp_kses( __( 'Choose a template to display. If you haven\'t created a custom template yet, <a href="%1$s">get started here</a>.', 'attesa-extra' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'edit.php?post_type=attesa_templates' ) )
|
||||||
|
);
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the header with optional Attesa Templates */
|
||||||
|
function attesaextra_get_header() {
|
||||||
|
$showTopBar = apply_filters( 'attesa_show_top_bar', attesa_options('_show_topbar', '1') );
|
||||||
|
$headerScroll = attesa_options('_header_scroll', 'smaller');
|
||||||
|
$headerFormat = attesa_options('_header_format', 'compat');
|
||||||
|
$showInHeader = attesa_options('_social_menu', '');
|
||||||
|
$headerStyle = apply_filters( 'attesa_header_style', attesa_options('_header_style', 'boxed') );
|
||||||
|
$menuPosition = attesa_options('_menu_position', 'right');
|
||||||
|
$showWooCartButton = attesa_options('_show_woocart', '');
|
||||||
|
$showEddCartButton = attesa_options('_show_eddcart', '');
|
||||||
|
$showSearchButton = attesa_options('_show_search', '1');
|
||||||
|
$mobileMenuOpen = attesa_options('_menu_mobile_open', 'dropdown');
|
||||||
|
$mobileMenuIcon = attesa_options('_mobile_menu_icon', 'fas fa fa-bars');
|
||||||
|
$mobileMenuText = attesa_options('_menu_mobile_default_text', __( 'Menu', 'attesa-extra' ));
|
||||||
|
?>
|
||||||
|
<?php /* if the header format is compat */ if ($headerFormat == 'compat'): ?>
|
||||||
|
<?php if ($mobileMenuOpen == 'pushmenu' && $headerFormat != 'menupopup'): ?>
|
||||||
|
<div class="opacityMenu"></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="nav-middle headerscroll<?php echo esc_attr($headerScroll); ?> format_<?php echo esc_attr($headerFormat); ?>">
|
||||||
|
<div class="container <?php echo esc_attr($headerStyle); ?>">
|
||||||
|
<div class="mainLogo">
|
||||||
|
<div class="subLogo">
|
||||||
|
<div class="site-branding menuposition_<?php echo esc_attr($menuPosition); ?>" <?php attesa_schema_markup('site-title'); ?>>
|
||||||
|
<?php
|
||||||
|
if ( function_exists( 'the_custom_logo' ) ) : ?>
|
||||||
|
<div class="attesa-logo">
|
||||||
|
<?php the_custom_logo(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="attesa-text-logo">
|
||||||
|
<?php
|
||||||
|
if ( is_front_page() && is_home() ) :
|
||||||
|
?>
|
||||||
|
<h1 class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||||
|
<?php
|
||||||
|
else :
|
||||||
|
?>
|
||||||
|
<p class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
$removeSiteDescription = attesa_options('_hide_description', '');
|
||||||
|
if (empty($removeSiteDescription)) :
|
||||||
|
$attesa_description = get_bloginfo( 'description', 'display' );
|
||||||
|
if ( $attesa_description || is_customize_preview() ) :
|
||||||
|
?>
|
||||||
|
<p class="site-description smallText"><?php echo $attesa_description; /* WPCS: xss ok. */ ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainLogo -->
|
||||||
|
<div class="mainFunc">
|
||||||
|
<div class="subFunc">
|
||||||
|
<?php
|
||||||
|
if ($showWooCartButton && function_exists( 'is_woocommerce') && $showTopBar ) : ?>
|
||||||
|
<div class="cartwoo-button-mobile">
|
||||||
|
<a class="woo-cart" href="<?php echo esc_url(wc_get_cart_url()); ?>">
|
||||||
|
<div class="cart-handle">
|
||||||
|
<div class="cart-body">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_woocommercecart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="cart-items"><span class="shopping-count">
|
||||||
|
<?php if(WC()->cart->get_cart_contents_count() != 0){ echo intval(WC()->cart->get_cart_contents_count()); } ?>
|
||||||
|
</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
if ($showEddCartButton && function_exists( 'EDD') && $showTopBar ) : ?>
|
||||||
|
<div class="cartedd-button-mobile">
|
||||||
|
<a class="edd-cart" href="<?php echo esc_url(edd_get_checkout_uri()); ?>">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_eddcart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="header-cart edd-cart-quantity">
|
||||||
|
<?php if (edd_get_cart_quantity() != 0) { echo intval(edd_get_cart_quantity()); } ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
if ($showInHeader == 1 ) {
|
||||||
|
echo '<div class="attesa-social-header-desktop">';
|
||||||
|
echo attesa_show_social_network('header');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php if ( is_active_sidebar( attesa_get_push_sidebar() ) && attesa_check_bar('push') ) : ?>
|
||||||
|
<?php if(attesa_options('_pushsidebar_icon','three_lines_icon') == 'three_lines_icon') : ?>
|
||||||
|
<div class="hamburger-menu">
|
||||||
|
<div class="menu__line menu_line1"></div>
|
||||||
|
<div class="menu__line menu_line2"></div>
|
||||||
|
<div class="menu__line menu_line3"></div>
|
||||||
|
<div class="menu__line menu_line4"></div>
|
||||||
|
<div class="menu__line menu_line5"></div>
|
||||||
|
</div>
|
||||||
|
<?php elseif(attesa_options('_pushsidebar_icon','three_lines_icon') == 'plus_icon'): ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__plus menu_plus1"></div>
|
||||||
|
<div class="menu__plus menu_plus2"></div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__circle"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainFunc -->
|
||||||
|
<div class="mainHead">
|
||||||
|
<div class="subHead">
|
||||||
|
<?php $menuLinksStyle = attesa_options('_menu_links_style', 'minimal'); ?>
|
||||||
|
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false" aria-label="<?php echo esc_attr($mobileMenuText); ?>"><?php echo esc_html($mobileMenuText); ?><i class="spaceLeft <?php echo esc_attr($mobileMenuIcon); ?>" aria-hidden="true"></i></button>
|
||||||
|
<div class="attesa-main-menu-container open_<?php echo esc_attr($mobileMenuOpen); ?>">
|
||||||
|
<?php if ($mobileMenuOpen == 'pushmenu'): ?>
|
||||||
|
<?php $closeMenuText = attesa_options('_menu_mobile_text_close',__( 'Close menu', 'attesa-extra' )); ?>
|
||||||
|
<div class="attesa-close-pushmenu"><i class="<?php attesa_fontawesome_icons('close'); ?> spaceRight" aria-hidden="true"></i><?php echo esc_html($closeMenuText); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<nav id="site-navigation" class="main-navigation menustyle_<?php echo esc_attr($menuLinksStyle); ?>" <?php attesa_schema_markup('site-navigation'); ?>>
|
||||||
|
<?php
|
||||||
|
wp_nav_menu( array(
|
||||||
|
'theme_location' => 'main',
|
||||||
|
'menu_id' => 'primary-menu',
|
||||||
|
) );
|
||||||
|
?>
|
||||||
|
</nav><!-- #site-navigation -->
|
||||||
|
<?php
|
||||||
|
if ($showInHeader == 1) {
|
||||||
|
echo '<div class="attesa-social-header-mobile">';
|
||||||
|
echo attesa_show_social_network('header');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
if ($showSearchButton && $showTopBar) {
|
||||||
|
echo '<div class="attesa-search-button-mobile">';
|
||||||
|
get_search_form();
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainHead -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php /* if the header format is featuredtitle */ elseif ($headerFormat == 'featuredtitle'): ?>
|
||||||
|
<?php if ($mobileMenuOpen == 'pushmenu' && $headerFormat != 'menupopup'): ?>
|
||||||
|
<div class="opacityMenu"></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="nav-middle-top-title">
|
||||||
|
<div class="container <?php echo esc_attr($headerStyle); ?>">
|
||||||
|
<div class="mainSoc">
|
||||||
|
<div class="subSoc">
|
||||||
|
<?php
|
||||||
|
if ($showInHeader == 1) {
|
||||||
|
echo '<div class="attesa-social-header-desktop">';
|
||||||
|
echo attesa_show_social_network('header');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainSoc -->
|
||||||
|
<div class="mainLogo">
|
||||||
|
<div class="subLogo">
|
||||||
|
<div class="site-branding" <?php attesa_schema_markup('site-title'); ?>>
|
||||||
|
<?php
|
||||||
|
if ( function_exists( 'the_custom_logo' ) ) : ?>
|
||||||
|
<div class="attesa-logo">
|
||||||
|
<?php the_custom_logo(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="attesa-text-logo">
|
||||||
|
<?php
|
||||||
|
if ( is_front_page() && is_home() ) :
|
||||||
|
?>
|
||||||
|
<h1 class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||||
|
<?php
|
||||||
|
else :
|
||||||
|
?>
|
||||||
|
<p class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
$removeSiteDescription = attesa_options('_hide_description', '');
|
||||||
|
if (empty($removeSiteDescription)) :
|
||||||
|
$attesa_description = get_bloginfo( 'description', 'display' );
|
||||||
|
if ( $attesa_description || is_customize_preview() ) :
|
||||||
|
?>
|
||||||
|
<p class="site-description smallText"><?php echo $attesa_description; /* WPCS: xss ok. */ ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainLogo -->
|
||||||
|
<div class="mainFunc">
|
||||||
|
<div class="subFunc">
|
||||||
|
<?php
|
||||||
|
if ($showWooCartButton && function_exists( 'is_woocommerce') && $showTopBar ) : ?>
|
||||||
|
<div class="cartwoo-button-mobile">
|
||||||
|
<a class="woo-cart" href="<?php echo esc_url(wc_get_cart_url()); ?>">
|
||||||
|
<div class="cart-handle">
|
||||||
|
<div class="cart-body">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_woocommercecart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="cart-items"><span class="shopping-count">
|
||||||
|
<?php if(WC()->cart->get_cart_contents_count() != 0){ echo intval(WC()->cart->get_cart_contents_count()); } ?>
|
||||||
|
</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
if ($showEddCartButton && function_exists( 'EDD') && $showTopBar ) : ?>
|
||||||
|
<div class="cartedd-button-mobile">
|
||||||
|
<a class="edd-cart" href="<?php echo esc_url(edd_get_checkout_uri()); ?>">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_eddcart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="header-cart edd-cart-quantity">
|
||||||
|
<?php if (edd_get_cart_quantity() != 0) { echo intval(edd_get_cart_quantity()); } ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( attesa_get_push_sidebar() ) && attesa_check_bar('push') ) : ?>
|
||||||
|
<?php if(attesa_options('_pushsidebar_icon','three_lines_icon') == 'three_lines_icon') : ?>
|
||||||
|
<div class="hamburger-menu">
|
||||||
|
<div class="menu__line menu_line1"></div>
|
||||||
|
<div class="menu__line menu_line2"></div>
|
||||||
|
<div class="menu__line menu_line3"></div>
|
||||||
|
<div class="menu__line menu_line4"></div>
|
||||||
|
<div class="menu__line menu_line5"></div>
|
||||||
|
</div>
|
||||||
|
<?php elseif(attesa_options('_pushsidebar_icon','three_lines_icon') == 'plus_icon'): ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__plus menu_plus1"></div>
|
||||||
|
<div class="menu__plus menu_plus2"></div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__circle"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainFunc -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="nav-middle headerscroll<?php echo esc_attr($headerScroll); ?> format_<?php echo esc_attr($headerFormat); ?>" <?php attesa_schema_markup('site-navigation'); ?>>
|
||||||
|
<div class="container <?php echo esc_attr($headerStyle); ?>">
|
||||||
|
<div class="mainHead">
|
||||||
|
<div class="subHead">
|
||||||
|
<?php $menuLinksStyle = attesa_options('_menu_links_style', 'minimal'); ?>
|
||||||
|
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false" aria-label="<?php echo esc_attr($mobileMenuText); ?>"><?php echo esc_html($mobileMenuText); ?><i class="spaceLeft <?php echo esc_attr($mobileMenuIcon); ?>" aria-hidden="true"></i></button>
|
||||||
|
<div class="attesa-main-menu-container open_<?php echo esc_attr($mobileMenuOpen); ?>">
|
||||||
|
<?php if ($mobileMenuOpen == 'pushmenu'): ?>
|
||||||
|
<?php $closeMenuText = attesa_options('_menu_mobile_text_close',__( 'Close menu', 'attesa-extra' )); ?>
|
||||||
|
<div class="attesa-close-pushmenu"><i class="<?php attesa_fontawesome_icons('close'); ?> spaceRight" aria-hidden="true"></i><?php echo esc_html($closeMenuText); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<nav id="site-navigation" class="main-navigation menustyle_<?php echo esc_attr($menuLinksStyle); ?>">
|
||||||
|
<?php
|
||||||
|
wp_nav_menu( array(
|
||||||
|
'theme_location' => 'main',
|
||||||
|
'menu_id' => 'primary-menu',
|
||||||
|
) );
|
||||||
|
?>
|
||||||
|
</nav><!-- #site-navigation -->
|
||||||
|
<?php
|
||||||
|
if ($showInHeader == 1) {
|
||||||
|
echo '<div class="attesa-social-header-mobile">';
|
||||||
|
echo attesa_show_social_network('header');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
if ($showSearchButton && $showTopBar) {
|
||||||
|
echo '<div class="attesa-search-button-mobile">';
|
||||||
|
get_search_form();
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainHead -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php /* if the header format is menupopup */ elseif ($headerFormat == 'menupopup'): ?>
|
||||||
|
<div class="nav-middle headerscroll<?php echo esc_attr($headerScroll); ?> format_<?php echo esc_attr($headerFormat); ?>">
|
||||||
|
<div class="container <?php echo esc_attr($headerStyle); ?>">
|
||||||
|
<div class="mainLogo">
|
||||||
|
<div class="subLogo">
|
||||||
|
<div class="site-branding menuposition_<?php echo esc_attr($menuPosition); ?>" <?php attesa_schema_markup('site-title'); ?>>
|
||||||
|
<?php
|
||||||
|
if ( function_exists( 'the_custom_logo' ) ) : ?>
|
||||||
|
<div class="attesa-logo">
|
||||||
|
<?php the_custom_logo(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="attesa-text-logo">
|
||||||
|
<?php
|
||||||
|
if ( is_front_page() && is_home() ) :
|
||||||
|
?>
|
||||||
|
<h1 class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||||
|
<?php
|
||||||
|
else :
|
||||||
|
?>
|
||||||
|
<p class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
$removeSiteDescription = attesa_options('_hide_description', '');
|
||||||
|
if (empty($removeSiteDescription)) :
|
||||||
|
$attesa_description = get_bloginfo( 'description', 'display' );
|
||||||
|
if ( $attesa_description || is_customize_preview() ) :
|
||||||
|
?>
|
||||||
|
<p class="site-description smallText"><?php echo $attesa_description; /* WPCS: xss ok. */ ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainLogo -->
|
||||||
|
<div class="mainFunc">
|
||||||
|
<div class="subFunc">
|
||||||
|
<?php
|
||||||
|
if ($showWooCartButton && function_exists( 'is_woocommerce') && $showTopBar ) : ?>
|
||||||
|
<div class="cartwoo-button-mobile">
|
||||||
|
<a class="woo-cart" href="<?php echo esc_url(wc_get_cart_url()); ?>">
|
||||||
|
<div class="cart-handle">
|
||||||
|
<div class="cart-body">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_woocommercecart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="cart-items"><span class="shopping-count">
|
||||||
|
<?php if(WC()->cart->get_cart_contents_count() != 0){ echo intval(WC()->cart->get_cart_contents_count()); } ?>
|
||||||
|
</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
if ($showEddCartButton && function_exists( 'EDD') && $showTopBar ) : ?>
|
||||||
|
<div class="cartedd-button-mobile">
|
||||||
|
<a class="edd-cart" href="<?php echo esc_url(edd_get_checkout_uri()); ?>">
|
||||||
|
<i class="<?php echo esc_attr(attesa_options('_eddcart_icon', 'fa fa-shopping-cart')); ?>" aria-hidden="true"></i>
|
||||||
|
<span class="header-cart edd-cart-quantity">
|
||||||
|
<?php if (edd_get_cart_quantity() != 0) { echo intval(edd_get_cart_quantity()); } ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( is_active_sidebar( attesa_get_push_sidebar() ) && attesa_check_bar('push') ) : ?>
|
||||||
|
<?php if(attesa_options('_pushsidebar_icon','three_lines_icon') == 'three_lines_icon') : ?>
|
||||||
|
<div class="hamburger-menu">
|
||||||
|
<div class="menu__line menu_line1"></div>
|
||||||
|
<div class="menu__line menu_line2"></div>
|
||||||
|
<div class="menu__line menu_line3"></div>
|
||||||
|
<div class="menu__line menu_line4"></div>
|
||||||
|
<div class="menu__line menu_line5"></div>
|
||||||
|
</div>
|
||||||
|
<?php elseif(attesa_options('_pushsidebar_icon','three_lines_icon') == 'plus_icon'): ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__plus menu_plus1"></div>
|
||||||
|
<div class="menu__plus menu_plus2"></div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__circle"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainFunc -->
|
||||||
|
<div class="mainHead">
|
||||||
|
<div class="subHead">
|
||||||
|
<div class="menu-full-screen-icon">
|
||||||
|
<div class="icon-full-screen">
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
<div class="square-full-screen"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php $menuLinksStyle = attesa_options('_menu_links_style', 'minimal'); ?>
|
||||||
|
<div class="attesa-main-menu-full-screen">
|
||||||
|
<div class="attesa-main-menu-full-screen-container">
|
||||||
|
<div class="attesa-main-menu-full-screen-sub-container">
|
||||||
|
<nav id="site-navigation" class="main-navigation-popup menustyle_<?php echo esc_attr($menuLinksStyle); ?>" <?php attesa_schema_markup('site-navigation'); ?>>
|
||||||
|
<?php
|
||||||
|
wp_nav_menu( array(
|
||||||
|
'theme_location' => 'main',
|
||||||
|
'menu_id' => 'primary-menu',
|
||||||
|
) );
|
||||||
|
?>
|
||||||
|
</nav><!-- #site-navigation -->
|
||||||
|
<?php
|
||||||
|
if ($showSearchButton && $showTopBar) {
|
||||||
|
echo '<div class="attesa-search-button-popup">';
|
||||||
|
get_search_form();
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
if ($showInHeader == 1) {
|
||||||
|
echo '<div class="attesa-social-header-popup">';
|
||||||
|
echo attesa_show_social_network('header');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainHead -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php /* if the header format is custom */ elseif ($headerFormat == 'custom'): ?>
|
||||||
|
<div class="opacityMenu"></div>
|
||||||
|
<div class="nav-middle format_elementor">
|
||||||
|
<div class="container">
|
||||||
|
<?php $attesaTemplateID = attesa_options('_header_get_attesa_template', '0'); ?>
|
||||||
|
<?php if($attesaTemplateID != '0') {
|
||||||
|
$args = array( 'p' => intval($attesaTemplateID), 'post_type' => 'attesa_templates');
|
||||||
|
$query = new WP_Query( $args );
|
||||||
|
if ( $query->have_posts() ) :
|
||||||
|
while ( $query->have_posts() ) :
|
||||||
|
$query->the_post();
|
||||||
|
the_content();
|
||||||
|
endwhile;
|
||||||
|
endif;
|
||||||
|
wp_reset_postdata();
|
||||||
|
} else {
|
||||||
|
printf(
|
||||||
|
/* translators: %1$s: create new custom template link */
|
||||||
|
wp_kses( __( 'Choose a template to display. If you haven\'t created a custom template yet, <a href="%1$s">get started here</a>.', 'attesa-extra' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'edit.php?post_type=attesa_templates' ) )
|
||||||
|
);
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
/* Get the entry header filtered for 100% full width for page builders */
|
||||||
|
function attesaextra_get_entry_header() {
|
||||||
|
if (attesaextra_check_use_custom_settings() && attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
if ( 'post' === get_post_type() ) {
|
||||||
|
?>
|
||||||
|
<div class="entry-meta smallText">
|
||||||
|
<?php
|
||||||
|
attesa_posted_on();
|
||||||
|
the_title( '<span class="entry-title hidden" '. attesa_get_schema_markup('name') .'>', '</span>' );
|
||||||
|
?>
|
||||||
|
</div><!-- .entry-meta -->
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
the_title( '<span class="entry-title hidden" '. attesa_get_schema_markup('name') .'>', '</span>' );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( 'post' === get_post_type() ) :
|
||||||
|
$attesa_featImageTitle = apply_filters( 'attesa_title_featured_image_style', attesa_options('_featimage_style_posts_title', 'insidecontent') );
|
||||||
|
$attesa_featImage = apply_filters( 'attesa_post_featured_image_style', attesa_options('_featimage_style_posts', 'content') ); ?>
|
||||||
|
<div class="entry-meta smallText">
|
||||||
|
<?php
|
||||||
|
attesa_posted_on();
|
||||||
|
?>
|
||||||
|
</div><!-- .entry-meta -->
|
||||||
|
<?php else:
|
||||||
|
$attesa_featImageTitle = apply_filters( 'attesa_title_featured_image_style_page', attesa_options('_featimage_style_pages_title', 'insidecontent') );
|
||||||
|
$attesa_featImage = apply_filters( 'attesa_page_featured_image_style', attesa_options('_featimage_style_pages', 'content') );
|
||||||
|
endif;
|
||||||
|
if ($attesa_featImageTitle == 'insideheader' && $attesa_featImage == 'header' && '' != get_the_post_thumbnail()) {
|
||||||
|
the_title( '<span class="entry-title hidden" '. attesa_get_schema_markup('name') .'>', '</span>' );
|
||||||
|
} else {
|
||||||
|
the_title( '<h1 class="entry-title" '. attesa_get_schema_markup('name') .'>', '</h1>' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if WPML String Translation plugin is active */
|
||||||
|
if ( ! function_exists( 'attesaextra_is_wpml_string_translation_active' ) ) {
|
||||||
|
function is_wpml_string_translation_active() {
|
||||||
|
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||||
|
return is_plugin_active( 'wpml-string-translation/plugin.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
} // Exit if accessed directly
|
||||||
|
|
||||||
|
|
||||||
|
class Attesa_WPML_Heading_Typewriter extends WPML_Elementor_Module_With_Items {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get widget field name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_items_field() {
|
||||||
|
return 'type_list';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fields inside the repeater.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_fields() {
|
||||||
|
return array(
|
||||||
|
'title_text',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
*
|
||||||
|
* Get the field title string
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_title( $field ) {
|
||||||
|
return esc_html__( 'Heading typewriter text', 'attesa-extra');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
*
|
||||||
|
* Get perspective field types.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_editor_type( $field ) {
|
||||||
|
return 'LINE';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
class awpWPML {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.1.7
|
||||||
|
* @var Object
|
||||||
|
*/
|
||||||
|
public static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class instance
|
||||||
|
*
|
||||||
|
* @since 1.1.7
|
||||||
|
*
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
public static function instance() {
|
||||||
|
if ( is_null( self::$instance ) ) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the class
|
||||||
|
*
|
||||||
|
* @since 1.1.7
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
if ( defined( 'WPML_ST_VERSION' ) ) {
|
||||||
|
if ( class_exists( 'WPML_Elementor_Module_With_Items' ) ) {
|
||||||
|
$this->load_wpml_modules();
|
||||||
|
}
|
||||||
|
add_filter( 'wpml_elementor_widgets_to_translate', array( $this, 'add_elementor_translatable_nodes' ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* load_wpml_modules
|
||||||
|
*
|
||||||
|
* Integrations class for complex widgets.
|
||||||
|
*
|
||||||
|
* @since 1.1.7
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function load_wpml_modules() {
|
||||||
|
require_once AE_PATH . '/elementor/compatibility/widgets/heading-typewriter.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds additional translatable nodes to WPML
|
||||||
|
*
|
||||||
|
* @since 1.1.7
|
||||||
|
*
|
||||||
|
* @param array $widgets WPML nodes to translate
|
||||||
|
* @return array $widgets Updated nodes
|
||||||
|
*/
|
||||||
|
public function add_elementor_translatable_nodes( $widgets ) {
|
||||||
|
|
||||||
|
$widgets[ 'attesa-extra-alert-message' ] = array(
|
||||||
|
'conditions' => array( 'widgetType' => 'attesa-extra-alert-message' ),
|
||||||
|
'fields' => array(
|
||||||
|
array(
|
||||||
|
'field' => 'alert_title',
|
||||||
|
'type' => __( 'Alert Title', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'alert_content',
|
||||||
|
'type' => __( 'Alert Content', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'AREA'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$widgets[ 'attesa-heading-typewriter' ] = array(
|
||||||
|
'conditions' => array( 'widgetType' => 'attesa-heading-typewriter' ),
|
||||||
|
'fields' => array(
|
||||||
|
array(
|
||||||
|
'field' => 'before_text',
|
||||||
|
'type' => __( 'Heading typewriter before text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'after_text',
|
||||||
|
'type' => __( 'Heading typewriter after text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'integration-class' => array( 'Attesa_WPML_Heading_Typewriter', )
|
||||||
|
);
|
||||||
|
|
||||||
|
$widgets[ 'attesa-extra-navigation-menu' ] = array(
|
||||||
|
'conditions' => array( 'widgetType' => 'attesa-extra-navigation-menu' ),
|
||||||
|
'fields' => array(
|
||||||
|
array(
|
||||||
|
'field' => 'mobile_menu',
|
||||||
|
'type' => __( 'Menu Mobile Text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'close_mobile_menu',
|
||||||
|
'type' => __( 'Close Menu Mobile Text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$widgets[ 'attesa-extra-double-button' ] = array(
|
||||||
|
'conditions' => array( 'widgetType' => 'attesa-extra-double-button' ),
|
||||||
|
'fields' => array(
|
||||||
|
array(
|
||||||
|
'field' => 'section_double_first_button_text',
|
||||||
|
'type' => __( 'Double button first text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
'section_double_first_button_link' => array(
|
||||||
|
'field' => 'url',
|
||||||
|
'type' => __( 'Double button first link', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'section_double_second_button_text',
|
||||||
|
'type' => __( 'Double button second text', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
'section_double_second_button_link' => array(
|
||||||
|
'field' => 'url',
|
||||||
|
'type' => __( 'Double button second link', 'attesa-extra' ),
|
||||||
|
'editor_type' => 'LINE'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $widgets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
awpWPML::instance();
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
.attesa-extra-double-button-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.awp-double-main-button-container {
|
||||||
|
flex-direction: row;
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.awp-first-button-content {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.awp-double-main-button-container .awp-divider-button-content {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(50%, -50%);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.awp-first-button-link,
|
||||||
|
.awp-second-button-link {
|
||||||
|
display: block;
|
||||||
|
-webkit-transition: background-color 0.3s, color 0.3s;
|
||||||
|
transition: background-color 0.3s, color 0.3s;
|
||||||
|
}
|
||||||
1
wp-content/plugins/attesa-extra/elementor/css/double-button.min.css
vendored
Normal file
1
wp-content/plugins/attesa-extra/elementor/css/double-button.min.css
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.attesa-extra-double-button-wrap{display:flex;align-items:center}.awp-double-main-button-container{flex-direction:row;display:flex;position:relative}.awp-first-button-content{position:relative}.awp-double-main-button-container .awp-divider-button-content{position:absolute;right:0;top:50%;transform:translate(50%,-50%);line-height:1}.awp-first-button-link,.awp-second-button-link{display:block;-webkit-transition:background-color .3s,color .3s;transition:background-color .3s,color .3s}
|
||||||
20
wp-content/plugins/attesa-extra/elementor/css/editor.min.css
vendored
Normal file
20
wp-content/plugins/attesa-extra/elementor/css/editor.min.css
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
.awp-icon {
|
||||||
|
color: #00a8e8;
|
||||||
|
}
|
||||||
|
.elementor-element-wrapper.elementor-element--promotion .awp-icon {
|
||||||
|
color: #a4afb7;
|
||||||
|
}
|
||||||
|
.elementor-panel #elementor-panel-category-attesa-elements .elementor-element-wrapper .elementor-element {
|
||||||
|
border: 1px solid #00a8e8;
|
||||||
|
}
|
||||||
|
.awp-dialog-buttons-action {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.awp-dialog-buttons-action.elementor-button.elementor-button-success:not([disabled]) {
|
||||||
|
background-color: #00a8e8;
|
||||||
|
}
|
||||||
|
.dialog-widget.is-attesa-box button.dialog-buttons-action,
|
||||||
|
.dialog-widget:not(.is-attesa-box) .awp-dialog-buttons-action {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
3
wp-content/plugins/attesa-extra/elementor/css/fix-preview.min.css
vendored
Normal file
3
wp-content/plugins/attesa-extra/elementor/css/fix-preview.min.css
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body.withOverlayMenu header.site-header:not(.menuMinor) {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
14
wp-content/plugins/attesa-extra/elementor/js/alert.js
Normal file
14
wp-content/plugins/attesa-extra/elementor/js/alert.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
( function( $ ) {
|
||||||
|
var WidgetawpAlertMessageHandler = function( $scope, $ ) {
|
||||||
|
$scope.find( '.awp-alert-close-button' ).click( function() {
|
||||||
|
|
||||||
|
$( this ).parents( 'div[class^="awp-alert"]' ).fadeOut( 500 );
|
||||||
|
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Make sure we run this code under Elementor
|
||||||
|
$( window ).on( 'elementor/frontend/init', function() {
|
||||||
|
elementorFrontend.hooks.addAction( 'frontend/element_ready/attesa-extra-alert-message.default', WidgetawpAlertMessageHandler );
|
||||||
|
} );
|
||||||
|
} )( jQuery );
|
||||||
1
wp-content/plugins/attesa-extra/elementor/js/alert.min.js
vendored
Normal file
1
wp-content/plugins/attesa-extra/elementor/js/alert.min.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e){var n=function(e,n){e.find(".awp-alert-close-button").click(function(){n(this).parents('div[class^="awp-alert"]').fadeOut(500)})};e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/attesa-extra-alert-message.default",n)})}(jQuery);
|
||||||
56
wp-content/plugins/attesa-extra/elementor/js/promotion.js
Normal file
56
wp-content/plugins/attesa-extra/elementor/js/promotion.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
(function($) {
|
||||||
|
'use strict';
|
||||||
|
$(window).on("elementor/frontend/init", function() {
|
||||||
|
if (elementorFrontend.isEditMode()) {
|
||||||
|
|
||||||
|
parent.document.addEventListener("mousedown", function (e) {
|
||||||
|
|
||||||
|
var widgets = parent.document.querySelectorAll(".elementor-element--promotion");
|
||||||
|
|
||||||
|
if (widgets.length > 0) {
|
||||||
|
widgets.forEach(function(widget) {
|
||||||
|
if (widget.contains(e.target)) {
|
||||||
|
var dialog = parent.document.querySelector("#elementor-element--promotion__dialog");
|
||||||
|
var icon = widget.querySelector(".icon > i");
|
||||||
|
|
||||||
|
if (icon.classList.toString().indexOf("awp-pro-addons") >= 0) {
|
||||||
|
dialog.classList.add("is-attesa-box");
|
||||||
|
var intDialog = parent.document.querySelector(".is-attesa-box");
|
||||||
|
//intDialog.querySelector("button.dialog-buttons-action").style.display = "none";
|
||||||
|
|
||||||
|
if (intDialog.querySelector(".awp-dialog-buttons-action") === null) {
|
||||||
|
var button = document.createElement("a");
|
||||||
|
var buttonText = document.createTextNode(AttesaExtraElementorPromotion.conversionString);
|
||||||
|
|
||||||
|
button.setAttribute("href", "https://attesawp.com/attesa-pro/");
|
||||||
|
button.setAttribute("target", "_blank");
|
||||||
|
button.classList.add(
|
||||||
|
"dialog-button",
|
||||||
|
"dialog-action",
|
||||||
|
"dialog-buttons-action",
|
||||||
|
"elementor-button",
|
||||||
|
"elementor-button-success",
|
||||||
|
"awp-dialog-buttons-action"
|
||||||
|
);
|
||||||
|
button.appendChild(buttonText);
|
||||||
|
|
||||||
|
intDialog.querySelector(".dialog-buttons-action").insertAdjacentHTML("afterend", button.outerHTML);
|
||||||
|
} else {
|
||||||
|
intDialog.querySelector(".awp-dialog-buttons-action").style.display = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dialog.classList.remove("is-attesa-box");
|
||||||
|
/*
|
||||||
|
dialog.querySelector("button.dialog-buttons-action").style.display = "";
|
||||||
|
if (dialog.querySelector(".awp-dialog-buttons-action") !== null) {
|
||||||
|
dialog.querySelector(".awp-dialog-buttons-action").style.display = "none";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}(jQuery));
|
||||||
1
wp-content/plugins/attesa-extra/elementor/js/promotion.min.js
vendored
Normal file
1
wp-content/plugins/attesa-extra/elementor/js/promotion.min.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(t){"use strict";jQuery(window).on("elementor/frontend/init",function(){elementorFrontend.isEditMode()&&parent.document.addEventListener("mousedown",function(t){var e=parent.document.querySelectorAll(".elementor-element--promotion");e.length>0&&e.forEach(function(e){if(e.contains(t.target)){var o=parent.document.querySelector("#elementor-element--promotion__dialog");if(e.querySelector(".icon > i").classList.toString().indexOf("awp-pro-addons")>=0){o.classList.add("is-attesa-box");var n=parent.document.querySelector(".is-attesa-box");if(null===n.querySelector(".awp-dialog-buttons-action")){var a=document.createElement("a"),r=document.createTextNode(AttesaExtraElementorPromotion.conversionString);a.setAttribute("href","https://attesawp.com/attesa-pro/"),a.setAttribute("target","_blank"),a.classList.add("dialog-button","dialog-action","dialog-buttons-action","elementor-button","elementor-button-success","awp-dialog-buttons-action"),a.appendChild(r),n.querySelector(".dialog-buttons-action").insertAdjacentHTML("afterend",a.outerHTML)}else n.querySelector(".awp-dialog-buttons-action").style.display=""}else o.classList.remove("is-attesa-box")}})})})}();
|
||||||
1045
wp-content/plugins/attesa-extra/elementor/js/typed.js
Normal file
1045
wp-content/plugins/attesa-extra/elementor/js/typed.js
Normal file
File diff suppressed because it is too large
Load Diff
11
wp-content/plugins/attesa-extra/elementor/js/typed.min.js
vendored
Normal file
11
wp-content/plugins/attesa-extra/elementor/js/typed.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
256
wp-content/plugins/attesa-extra/elementor/widgets.php
Normal file
256
wp-content/plugins/attesa-extra/elementor/widgets.php
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
<?php
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
final class Attesa_Extra_Elementor_Extensions {
|
||||||
|
private static $_instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin instance
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @return Plugin
|
||||||
|
*/
|
||||||
|
public static function instance() {
|
||||||
|
|
||||||
|
if ( is_null( self::$_instance ) ) {
|
||||||
|
self::$_instance = new self();
|
||||||
|
}
|
||||||
|
return self::$_instance;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __clone() {
|
||||||
|
// Cloning instances of the class is forbidden
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'attesa-extra' ), '1.0.0' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __wakeup() {
|
||||||
|
// Unserializing instances of the class is forbidden
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'attesa-extra' ), '1.0.0' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Widget constructor.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_elementor_widgets' ) );
|
||||||
|
add_action( 'elementor/elements/categories_registered', array( $this, 'register_elementor_widget_categories' ) );
|
||||||
|
add_action( 'elementor/frontend/after_register_scripts', array( $this, 'widget_scripts' ) );
|
||||||
|
add_action( 'elementor/frontend/after_register_styles', array( $this, 'widget_styles' ) );
|
||||||
|
add_action( 'elementor/preview/enqueue_scripts', array( $this, 'widget_scripts_preview' ) );
|
||||||
|
add_action( 'elementor/preview/enqueue_styles', array( $this, 'widget_style_preview' ) );
|
||||||
|
add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'editor_style' ) );
|
||||||
|
if ( !class_exists( 'Attesa_pro' ) ) {
|
||||||
|
add_action( 'elementor/frontend/after_enqueue_scripts', array( $this, 'enqueue_editor_scripts_promotional' ) );
|
||||||
|
add_filter( 'elementor/editor/localize_settings', array( $this, 'promote_pro_addons' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers widgets in Elementor
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function register_elementor_widgets() {
|
||||||
|
require_once AE_PATH . '/elementor/widgets/navigation-menu.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Navigation_Menu() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/site-logo.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Site_Logo() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/site-social-buttons.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Site_Social_Buttons() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/posts-carousel.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Posts_Carousel() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/divider.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Divider() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/heading-typewriter.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Heading_Typewriter() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/alert-message.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Alert_Message() );
|
||||||
|
|
||||||
|
require_once AE_PATH . '/elementor/widgets/double-button.php';
|
||||||
|
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Attesa_Extra_Double_Button() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register_elementor_widget_categories() {
|
||||||
|
\Elementor\Plugin::instance()->elements_manager->add_category(
|
||||||
|
'attesa-elements',
|
||||||
|
array(
|
||||||
|
'title' => __( 'Attesa Theme Addons', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-plug',
|
||||||
|
),
|
||||||
|
1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function widget_scripts() {
|
||||||
|
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||||
|
wp_register_script('typed', plugins_url('elementor/js/typed'.$min.'.js',dirname(__FILE__)), array('jquery'),'1.1.4',true);
|
||||||
|
wp_register_script('awp-alert', plugins_url('elementor/js/alert'.$min.'.js',dirname(__FILE__)), array('jquery'),ATTESA_EXTRA_PLUGIN_VERSION,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function widget_scripts_preview() {
|
||||||
|
wp_enqueue_script( 'typed' );
|
||||||
|
wp_enqueue_script( 'awp-alert' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function widget_styles() {
|
||||||
|
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||||
|
wp_register_style( 'awp-double-button', plugins_url( '/elementor/css/double-button'.$min.'.css', dirname(__FILE__)), array(), ATTESA_EXTRA_PLUGIN_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function widget_style_preview() {
|
||||||
|
wp_enqueue_style( 'awp-elementor-editor', plugins_url( 'elementor/css/fix-preview.min.css',dirname(__FILE__)), array(), ATTESA_EXTRA_PLUGIN_VERSION );
|
||||||
|
wp_enqueue_style( 'awp-double-button' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editor_style() {
|
||||||
|
wp_enqueue_style( 'awp-elementor-editor', plugins_url( 'elementor/css/editor.min.css',dirname(__FILE__)), array(), ATTESA_EXTRA_PLUGIN_VERSION );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enqueue_editor_scripts_promotional() {
|
||||||
|
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
||||||
|
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||||
|
wp_enqueue_script( 'awp-promotion', plugins_url('elementor/js/promotion'.$min.'.js',dirname(__FILE__)), array('jquery'), ATTESA_EXTRA_PLUGIN_VERSION, true );
|
||||||
|
$attesa_extra_array_promotion = array(
|
||||||
|
'conversionString' => esc_html__( 'Upgrade to Attesa PRO', 'attesa-extra' ),
|
||||||
|
);
|
||||||
|
wp_localize_script( 'awp-promotion', 'AttesaExtraElementorPromotion', $attesa_extra_array_promotion );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function promote_pro_addons($config) {
|
||||||
|
$promotion_widgets = [];
|
||||||
|
|
||||||
|
if (isset($config['promotionWidgets'])) {
|
||||||
|
$promotion_widgets = $config['promotionWidgets'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$combine_array = array_merge($promotion_widgets, [
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-scroll-to-next-section',
|
||||||
|
'title' => __('Scroll to next section', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-arrow-down',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-tilt-effect',
|
||||||
|
'title' => __('Tilt Effect', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-clone',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-posts-carousel-pro',
|
||||||
|
'title' => __('Posts Carousel', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-post-slider',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-pricing-table',
|
||||||
|
'title' => __('Pricing Table', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-price-table',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-image-hotspots',
|
||||||
|
'title' => __('Image Hotspots', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-image-hotspot',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-onepage-navigation',
|
||||||
|
'title' => __('Onepage Navigation', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-navigation-vertical',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-stylize-every-word',
|
||||||
|
'title' => __('Stylize every word', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-text-area',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-price-list',
|
||||||
|
'title' => __('Price List', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-price-list',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-filterable-gallery',
|
||||||
|
'title' => __('Filterable Gallery', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-gallery-masonry',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-page-scroll-progress',
|
||||||
|
'title' => __('Page Scroll Progress', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-scroll',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-image-compare',
|
||||||
|
'title' => __('Image Compare', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-image-before-after',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-offcanvas',
|
||||||
|
'title' => __('Offcanvas', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-column',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-step-by-step',
|
||||||
|
'title' => __('Step by step', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-h-align-right',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-ajax-search',
|
||||||
|
'title' => __('Ajax Search', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-site-search',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-content-timeline',
|
||||||
|
'title' => __('Content Timeline', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-time-line',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-content-behind-background',
|
||||||
|
'title' => __('Content behind background', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-navigator',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'attesa-pro-switch',
|
||||||
|
'title' => __('Switch', 'attesa-extra'),
|
||||||
|
'icon' => 'awp-pro-addons awp-icon eicon-dual-button',
|
||||||
|
'categories' => '["attesa-elements"]',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$config['promotionWidgets'] = $combine_array;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function attesa_extra_elementor_widgets() {
|
||||||
|
return Attesa_Extra_Elementor_Extensions::instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
attesa_extra_elementor_widgets();
|
||||||
@ -0,0 +1,372 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Alert_Message extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-alert-message';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Alert Message', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-alert';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_script_depends() {
|
||||||
|
return [ 'awp-alert' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alert_query',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alert Message', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::ICON,
|
||||||
|
'default' => 'fa fa-bolt',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_title',
|
||||||
|
[
|
||||||
|
'label' => __( 'Title', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'default' => __( 'This is Alert Message', 'attesa-extra' ),
|
||||||
|
'label_block' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_content',
|
||||||
|
[
|
||||||
|
'label' => __( 'Content', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXTAREA,
|
||||||
|
'default' => __( 'Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel.', 'attesa-extra' ),
|
||||||
|
'separator' => 'after',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_show_dismiss',
|
||||||
|
[
|
||||||
|
'label' => __( 'Dismiss Button', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'Show', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Hide', 'attesa-extra' ),
|
||||||
|
'return_value' => 'yes',
|
||||||
|
'default' => 'no',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'label' => __( 'View', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::HIDDEN,
|
||||||
|
'default' => 'traditional',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
|
||||||
|
//Post titles styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alert_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alert style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_background_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#dff0d8',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_text_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#3cb37d',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'alert_padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 1,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 1,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 1,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 1,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 1,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 1,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'separator' => 'before',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'alert_border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Border Radius', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'separator' => 'before',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_border_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Border Style', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'solid',
|
||||||
|
'options' => [
|
||||||
|
'none' => __( 'None', 'attesa-extra' ),
|
||||||
|
'solid' => __( 'Solid', 'attesa-extra' ),
|
||||||
|
'double' => __( 'Double', 'attesa-extra' ),
|
||||||
|
'dotted' => __( 'Dotted', 'attesa-extra' ),
|
||||||
|
'dashed' => __( 'Dashed', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'border-style: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_border_width',
|
||||||
|
[
|
||||||
|
'label' => __( 'Border Width', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 2,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'ms' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 10,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'border-width: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'alert_border_style!' => 'none',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'alert_border_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Border Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#3cb37d',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap' => 'border-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'alert_border_style!' => 'none',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
|
||||||
|
//Post titles styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alert_style_title',
|
||||||
|
[
|
||||||
|
'label' => __( 'Title Typography', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_alert_style_title_typo',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap .attesa-alert-title',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
|
||||||
|
//Post titles styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alert_style_content',
|
||||||
|
[
|
||||||
|
'label' => __( 'Content Typography', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_alert_style_title_content',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap .attesa-alert-content',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
|
||||||
|
//Post titles styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alert_style_icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_alert_style_icon_size',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon size', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'size_units' => [ 'px' ],
|
||||||
|
'default' => [
|
||||||
|
'size' => 50,
|
||||||
|
'unit' => 'px',
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'ms' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-alert .attesa-extra-alert-wrap .attesa-alert-icon' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
$icon = $settings['alert_icon'];
|
||||||
|
$title = $settings['alert_title'];
|
||||||
|
$content = $settings['alert_content'];
|
||||||
|
$show_dismiss = $settings['alert_show_dismiss'];
|
||||||
|
if($icon) {
|
||||||
|
$iconExist = 'withIcon';
|
||||||
|
} else {
|
||||||
|
$iconExist = 'noIcon';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="awp-alert" role="alert">
|
||||||
|
<div class="attesa-extra-alert-wrap awp-alert-message">
|
||||||
|
<div class="attesa-extra-alert-container <?php echo esc_attr($iconExist); ?>">
|
||||||
|
<?php if($icon): ?>
|
||||||
|
<div class="attesa-alert-icon"><i class="<?php echo esc_attr($icon); ?>"></i></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($title): ?>
|
||||||
|
<div class="attesa-alert-title"><?php echo esc_html($title); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($content): ?>
|
||||||
|
<div class="attesa-alert-content"><?php echo wp_kses_post($content); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($show_dismiss == 'yes'): ?>
|
||||||
|
<div class="attesa-alert-dismiss awp-alert-close-button"><i class="fa fa-times"></i></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
}
|
||||||
231
wp-content/plugins/attesa-extra/elementor/widgets/divider.php
Normal file
231
wp-content/plugins/attesa-extra/elementor/widgets/divider.php
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Border;
|
||||||
|
use Elementor\Group_Control_Box_Shadow;
|
||||||
|
|
||||||
|
class Attesa_Extra_Divider extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-divider';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Icon Divider', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-divider-shape';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
protected function _register_controls() {
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_divider_query',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Divider', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Style', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'solid',
|
||||||
|
'options' => [
|
||||||
|
'solid' => __( 'Solid', 'attesa-extra' ),
|
||||||
|
'double' => __( 'Double', 'attesa-extra' ),
|
||||||
|
'dotted' => __( 'Dotted', 'attesa-extra' ),
|
||||||
|
'dashed' => __( 'Dashed', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-extra-divider' => 'border-top-style: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'weight',
|
||||||
|
[
|
||||||
|
'label' => __( 'Weight', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 2,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 1,
|
||||||
|
'max' => 50,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-extra-divider' => 'border-top-width: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-extra-divider' => 'border-top-color: {{VALUE}};',
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-divider-middle' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'icon_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'position_center',
|
||||||
|
'options' => [
|
||||||
|
'position_left' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'position_center' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'position_right' => __( 'Right', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'width',
|
||||||
|
[
|
||||||
|
'label' => __( 'Width', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'default' => [
|
||||||
|
'size' => 100,
|
||||||
|
'unit' => '%',
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 1000,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
'%' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'icon_align' => 'position_center',
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap' => 'width: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'gap',
|
||||||
|
[
|
||||||
|
'label' => __( 'Gap', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 15,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 50,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap' => 'padding: {{SIZE}}{{UNIT}} 0;',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::ICON,
|
||||||
|
'default' => 'fa fa-bolt',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'icon-size',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Size', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 20,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 5,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-divider-middle' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'icon-padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 10,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-divider-wrap .attesa-divider-middle' => 'padding: 0 {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'label' => __( 'View', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::HIDDEN,
|
||||||
|
'default' => 'traditional',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
$icon = $settings['icon'];
|
||||||
|
$align = $settings['icon_align'];
|
||||||
|
?>
|
||||||
|
<div class="attesa-extra-divider-wrap <?php echo esc_attr($align); ?>">
|
||||||
|
<div class="attesa-extra-divider attesa-divider-before"></div>
|
||||||
|
<?php if($icon): ?>
|
||||||
|
<div class="attesa-divider-middle"><i class="<?php echo esc_attr($icon); ?>"></i></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="attesa-extra-divider attesa-divider-after"></div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,734 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Border;
|
||||||
|
use Elementor\Group_Control_Box_Shadow;
|
||||||
|
use Elementor\Icons_Manager;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Double_Button extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-double-button';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Double Button', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-button';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
public function get_style_depends() {
|
||||||
|
return [ 'awp-double-button' ];
|
||||||
|
}
|
||||||
|
protected function _register_controls() {
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_double_first_button',
|
||||||
|
[
|
||||||
|
'label' => __( 'First Button', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Button Text', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'default' => __( 'First', 'attesa-extra' ),
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_link',
|
||||||
|
[
|
||||||
|
'label' => __( 'Link', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::URL,
|
||||||
|
'default' => [
|
||||||
|
'url' => '#',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::ICONS,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_icon_position',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Position', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'before',
|
||||||
|
'options' => [
|
||||||
|
'before' => __( 'Before', 'attesa-extra' ),
|
||||||
|
'after' => __( 'After', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_first_button_icon_spacing',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Spacing', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 0,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'max' => 50,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-icon.awp-position-before' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||||
|
'{{WRAPPER}} .awp-first-button-icon.awp-position-after' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->start_controls_tabs( 'section_double_first_button_tabs' );
|
||||||
|
|
||||||
|
$this->start_controls_tab(
|
||||||
|
'section_double_first_button_tab_normal',
|
||||||
|
[
|
||||||
|
'label' => __( 'Normal', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#404040',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_background',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_tab();
|
||||||
|
|
||||||
|
$this->start_controls_tab(
|
||||||
|
'section_double_first_button_tab_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Hover', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_color_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#404040',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link:hover' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_first_button_background_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link:hover' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_tab();
|
||||||
|
|
||||||
|
$this->end_controls_tabs();
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_double_second_button',
|
||||||
|
[
|
||||||
|
'label' => __( 'Second Button', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Button Text', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'default' => __( 'Second', 'attesa-extra' ),
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_link',
|
||||||
|
[
|
||||||
|
'label' => __( 'Link', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::URL,
|
||||||
|
'default' => [
|
||||||
|
'url' => '#',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::ICONS,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_icon_position',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Position', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'before',
|
||||||
|
'options' => [
|
||||||
|
'before' => __( 'Before', 'attesa-extra' ),
|
||||||
|
'after' => __( 'After', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_second_button_icon_spacing',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Spacing', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 0,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'max' => 50,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-second-button-icon.awp-position-before' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||||
|
'{{WRAPPER}} .awp-second-button-icon.awp-position-after' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->start_controls_tabs( 'section_double_second_button_tabs' );
|
||||||
|
|
||||||
|
$this->start_controls_tab(
|
||||||
|
'section_double_second_button_tab_normal',
|
||||||
|
[
|
||||||
|
'label' => __( 'Normal', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-second-button-link' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_background',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#404040',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-second-button-link' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_tab();
|
||||||
|
|
||||||
|
$this->start_controls_tab(
|
||||||
|
'section_double_second_button_tab_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Hover', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_color_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-second-button-link:hover' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_second_button_background_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#404040',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-second-button-link:hover' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_tabs();
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_double_divider',
|
||||||
|
[
|
||||||
|
'label' => __( 'Divider', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_show',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show divider', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'default' => 'yes',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_choose',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'icon',
|
||||||
|
'options' => [
|
||||||
|
'icon' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'text' => __( 'Text', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_icon',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::ICONS,
|
||||||
|
'default' => [
|
||||||
|
'value' => 'far fa-lemon',
|
||||||
|
'library' => 'regular',
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'section_double_divider_choose' => 'icon',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_divider_icon_size',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon size', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 20,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'max' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-divider-button-content' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'section_double_divider_choose' => 'icon',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'section_double_divider_choose' => 'text',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_double_divider_text_typo',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-divider-button-text',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_1,
|
||||||
|
'condition' => [
|
||||||
|
'section_double_divider_choose' => 'text',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#ffffff',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-divider-button-content' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'section_double_divider_background',
|
||||||
|
[
|
||||||
|
'label' => __( 'Background', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#bebebe',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-divider-button-content' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_double_button_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Box Style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
'show_label' => false,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_button_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'flex-start' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'flex-end' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'flex-start',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-double-button-wrap' => 'justify-content: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_button_padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 15,
|
||||||
|
'right' => 35,
|
||||||
|
'bottom' => 15,
|
||||||
|
'left' => 35,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 15,
|
||||||
|
'right' => 35,
|
||||||
|
'bottom' => 15,
|
||||||
|
'left' => 35,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 15,
|
||||||
|
'right' => 35,
|
||||||
|
'bottom' => 15,
|
||||||
|
'left' => 35,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
'{{WRAPPER}} .awp-second-button-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_button_border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Buttons Border Radius', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-first-button-link' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-bottom-left-radius: {{BOTTOM}}{{UNIT}} ;',
|
||||||
|
'{{WRAPPER}} .awp-second-button-link' => 'border-top-right-radius: {{LEFT}}{{UNIT}}; border-bottom-right-radius: {{RIGHT}}{{UNIT}} ;',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_double_button_typo',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-first-button-link, {{WRAPPER}} .awp-second-button-link',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Box_Shadow::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_double_button_box_shadow',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-first-button-link, {{WRAPPER}} .awp-second-button-link',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_double_button_divider_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Divider Style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
'show_label' => false,
|
||||||
|
'condition' => [
|
||||||
|
'section_double_divider_show' => 'yes',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_button_divider_padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-divider-button-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'section_double_button_divider_border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Divider Border Radius', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 50,
|
||||||
|
'right' => 50,
|
||||||
|
'bottom' => 50,
|
||||||
|
'left' => 50,
|
||||||
|
'unit' => '%',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 50,
|
||||||
|
'right' => 50,
|
||||||
|
'bottom' => 50,
|
||||||
|
'left' => 50,
|
||||||
|
'unit' => '%',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 50,
|
||||||
|
'right' => 50,
|
||||||
|
'bottom' => 50,
|
||||||
|
'left' => 50,
|
||||||
|
'unit' => '%',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-divider-button-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Box_Shadow::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'section_double_button_divider_box_shadow',
|
||||||
|
'selector' => '{{WRAPPER}} .awp-divider-button-content',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings_for_display();
|
||||||
|
$first_text = $settings['section_double_first_button_text'];
|
||||||
|
$first_link = $settings['section_double_first_button_link'];
|
||||||
|
$second_text = $settings['section_double_second_button_text'];
|
||||||
|
$second_link = $settings['section_double_second_button_link'];
|
||||||
|
$show_divider = $settings['section_double_divider_show'];
|
||||||
|
?>
|
||||||
|
<div id="awp-double-button" class="attesa-extra-double-button-wrap">
|
||||||
|
<div class="awp-double-main-button-container">
|
||||||
|
<div class="awp-first-button-content">
|
||||||
|
<?php if ($first_link['url']): ?>
|
||||||
|
<?php
|
||||||
|
$target = $first_link['is_external'] ? ' target="_blank"' : '';
|
||||||
|
$nofollow = $first_link['nofollow'] ? ' rel="nofollow"' : '';
|
||||||
|
?>
|
||||||
|
<a class="awp-first-button-link" <?php echo $target . $nofollow ; ?> href="<?php echo esc_url($first_link['url']); ?>">
|
||||||
|
<span class="awp-double-button-container">
|
||||||
|
<?php if($settings['section_double_first_button_icon'] && $settings['section_double_first_button_icon_position'] == 'before'): ?>
|
||||||
|
<span class="awp-first-button-icon awp-position-before">
|
||||||
|
<?php Icons_Manager::render_icon( $settings['section_double_first_button_icon'], [ 'aria-hidden' => 'true' ] ); ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="awp-double-button-text"><?php echo esc_html($first_text); ?></span>
|
||||||
|
<?php if($settings['section_double_first_button_icon'] && $settings['section_double_first_button_icon_position'] == 'after'): ?>
|
||||||
|
<span class="awp-first-button-icon awp-position-after">
|
||||||
|
<?php Icons_Manager::render_icon( $settings['section_double_first_button_icon'], [ 'aria-hidden' => 'true' ] ); ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<?php if ($show_divider == 'yes') : ?>
|
||||||
|
<div class="awp-divider-button-content">
|
||||||
|
<?php if($settings['section_double_divider_choose'] == 'text'): ?>
|
||||||
|
<span class="awp-divider-button-text"><?php echo esc_html($settings['section_double_divider_text']); ?></span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="awp-divider-button-icon"><?php Icons_Manager::render_icon( $settings['section_double_divider_icon'], [ 'aria-hidden' => 'true' ] ); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="awp-second-button-content">
|
||||||
|
<?php if ($second_link['url']): ?>
|
||||||
|
<?php
|
||||||
|
$target = $second_link['is_external'] ? ' target="_blank"' : '';
|
||||||
|
$nofollow = $second_link['nofollow'] ? ' rel="nofollow"' : '';
|
||||||
|
?>
|
||||||
|
<a class="awp-second-button-link" <?php echo $target . $nofollow ; ?> href="<?php echo esc_url($second_link['url']); ?>">
|
||||||
|
<span class="awp-double-button-container">
|
||||||
|
<?php if($settings['section_double_second_button_icon'] && $settings['section_double_second_button_icon_position'] == 'before'): ?>
|
||||||
|
<span class="awp-second-button-icon awp-position-before">
|
||||||
|
<?php Icons_Manager::render_icon( $settings['section_double_second_button_icon'], [ 'aria-hidden' => 'true' ] ); ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="awp-double-button-text"><?php echo esc_html($second_text); ?></span>
|
||||||
|
<?php if($settings['section_double_second_button_icon'] && $settings['section_double_second_button_icon_position'] == 'after'): ?>
|
||||||
|
<span class="awp-second-button-icon awp-position-after">
|
||||||
|
<?php Icons_Manager::render_icon( $settings['section_double_second_button_icon'], [ 'aria-hidden' => 'true' ] ); ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,366 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Heading_Typewriter extends Widget_Base {
|
||||||
|
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-heading-typewriter';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Heading Typewriter', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-heading';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_script_depends() {
|
||||||
|
return [ 'typed' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_title_heading',
|
||||||
|
[
|
||||||
|
'label' => __( 'Titles Typewriter', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_CONTENT,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'before_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Before', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'default' => __( 'Text before', 'attesa-extra' ),
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repeater = new \Elementor\Repeater();
|
||||||
|
|
||||||
|
$repeater->add_control(
|
||||||
|
'title_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Title', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'placeholder' => __( 'Heading Text', 'attesa-extra' ),
|
||||||
|
'default' => __( 'Heading Text', 'attesa-extra' ),
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'type_list',
|
||||||
|
[
|
||||||
|
'label' => '',
|
||||||
|
'type' => Controls_Manager::REPEATER,
|
||||||
|
'fields' => $repeater->get_controls(),
|
||||||
|
'default' => [
|
||||||
|
[
|
||||||
|
'title_text' => __( 'Heading Text #1', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title_text' => __( 'Heading Text #2', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'title_field' => '{{{ title_text }}}',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'after_text',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text After', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'label_block' => true,
|
||||||
|
'default' => __( 'Text after', 'attesa-extra' ),
|
||||||
|
'dynamic' => [
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
'separator' => 'after',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'type_speed',
|
||||||
|
[
|
||||||
|
'label' => __( 'Type Speed', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::NUMBER,
|
||||||
|
'default' => 70,
|
||||||
|
'min' => 10,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 5,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'start_delay',
|
||||||
|
[
|
||||||
|
'label' => __( 'Start Delay', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::NUMBER,
|
||||||
|
'default' => 1,
|
||||||
|
'min' => 1,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'back_speed',
|
||||||
|
[
|
||||||
|
'label' => __( 'Back Speed', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::NUMBER,
|
||||||
|
'default' => 30,
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 2,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'back_delay',
|
||||||
|
[
|
||||||
|
'label' => __( 'Back Delay', 'attesa-extra' ) . ' (ms)',
|
||||||
|
'type' => Controls_Manager::NUMBER,
|
||||||
|
'default' => 1500,
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 3000,
|
||||||
|
'step' => 50,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'loop',
|
||||||
|
[
|
||||||
|
'label' => __( 'Loop writing effect', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'default' => 'yes',
|
||||||
|
'off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'separator' => 'after',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'html_tag',
|
||||||
|
[
|
||||||
|
'label' => __( 'HTML Tag', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'h2',
|
||||||
|
'options' => [
|
||||||
|
'h1' => __( 'H1', 'attesa-extra' ),
|
||||||
|
'h2' => __( 'H2', 'attesa-extra' ),
|
||||||
|
'h3' => __( 'H3', 'attesa-extra' ),
|
||||||
|
'h4' => __( 'H4', 'attesa-extra' ),
|
||||||
|
'h5' => __( 'H5', 'attesa-extra' ),
|
||||||
|
'h6' => __( 'H6', 'attesa-extra' ),
|
||||||
|
'div' => __( 'div', 'attesa-extra' ),
|
||||||
|
'span' => __( 'span', 'attesa-extra' ),
|
||||||
|
'p' => __( 'p', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'text-align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'left' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'right' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
'justify' => [
|
||||||
|
'title' => __( 'Justify', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-justify',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'center',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-heading-typewriter-wrap .attesa-extra-headline-typewriter' => 'text-align: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'label' => __( 'View', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::HIDDEN,
|
||||||
|
'default' => 'traditional',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
//General text styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_typohrapy_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Typohrapy text', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'typewriter_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .attesa-extra-heading-typewriter-wrap .attesa-extra-headline-typewriter' ,
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
//Typewriter text styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_typewriter_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Typewriter text', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'typewriter_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-heading-typewriter-wrap .attesa-extra-heading-typewriter, {{WRAPPER}} .attesa-extra-heading-typewriter-wrap .typed-cursor' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
//Before text styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_typewriter_style_before',
|
||||||
|
[
|
||||||
|
'label' => __( 'Before text', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'typewriter_color_before',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-heading-typewriter-wrap .attesa-extra-heading-typewriter-before' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
//After text styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_typewriter_style_after',
|
||||||
|
[
|
||||||
|
'label' => __( 'After text', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'typewriter_color_after',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-heading-typewriter-wrap .attesa-extra-heading-typewriter-after' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$id = $this->get_id();
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
$before = $settings['before_text'];
|
||||||
|
$after = $settings['after_text'];
|
||||||
|
$tag = $settings['html_tag'];
|
||||||
|
$writeText = '';
|
||||||
|
$copy = $settings['type_list'];
|
||||||
|
foreach ( $settings['type_list'] as $index => $item ) {
|
||||||
|
$singleText[] = $item['title_text'];
|
||||||
|
}
|
||||||
|
$writeText = implode( '#next#', $singleText);
|
||||||
|
$writeText = explode( '#next#', $writeText );
|
||||||
|
|
||||||
|
$this->add_render_attribute( 'headline',
|
||||||
|
[
|
||||||
|
'class' => 'attesa-extra-headline-typewriter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<div class="attesa-extra-heading-typewriter-wrap" id="extra-heading-id-<?php echo esc_attr( $id ); ?>">
|
||||||
|
<<?php echo esc_attr($tag); ?> <?php echo $this->get_render_attribute_string( 'headline' ); ?>>
|
||||||
|
<?php if($before): ?>
|
||||||
|
<span class="attesa-extra-heading-typewriter-before"><?php echo wp_kses_post($before); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($writeText): ?>
|
||||||
|
<span class="attesa-extra-heading-typewriter"></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($after): ?>
|
||||||
|
<span class="attesa-extra-heading-typewriter-after"><?php echo wp_kses_post($after); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</<?php echo esc_attr($tag); ?>>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery( document ).ready( function( $ ) {
|
||||||
|
"use strict";
|
||||||
|
var typed = new Typed( '#extra-heading-id-<?php echo esc_attr( $id ); ?> .attesa-extra-heading-typewriter', {
|
||||||
|
strings : <?php echo json_encode( $writeText ); ?>,
|
||||||
|
typeSpeed : <?php echo esc_attr( $settings['type_speed'] ); ?>,
|
||||||
|
startDelay : <?php echo esc_attr( $settings['start_delay'] ); ?>,
|
||||||
|
backSpeed : <?php echo esc_attr( $settings['back_speed'] ); ?>,
|
||||||
|
backDelay : <?php echo esc_attr( $settings['back_delay'] ); ?>,
|
||||||
|
loop : <?php echo ( 'yes' == $settings['loop'] ) ? 'true' : 'false'; ?>,
|
||||||
|
smartBackspace: false,
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,398 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Navigation_Menu extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-navigation-menu';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Navigation Menus', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-navigation-horizontal';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_navigation_menus',
|
||||||
|
[
|
||||||
|
'label' => __( 'Navigations menus', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'select_menu',
|
||||||
|
[
|
||||||
|
'label' => __( 'Select Menu', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => '0',
|
||||||
|
'options' => $this->get_available_menus(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'mobile_menu',
|
||||||
|
[
|
||||||
|
'label' => __( 'Menu Mobile Text', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'default' => __( 'Menu', 'attesa-extra' ),
|
||||||
|
'label_block' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'close_mobile_menu',
|
||||||
|
[
|
||||||
|
'label' => __( 'Close Menu Mobile Text', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::TEXT,
|
||||||
|
'default' => __( 'Close Menu', 'attesa-extra' ),
|
||||||
|
'label_block' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'menu_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'left' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'right' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'left',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-custom-menu' => 'text-align: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'items_padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Items Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 0.6,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 0.6,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => false,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 0.6,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 0.6,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => false,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 1,
|
||||||
|
'right' => 0.6,
|
||||||
|
'bottom' => 1,
|
||||||
|
'left' => 0.6,
|
||||||
|
'unit' => 'em',
|
||||||
|
'isLinked' => false,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .mainHead .main-navigation > div > ul > li > a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'items_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .main-navigation li',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_nav_menu_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Items Style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'menu_back_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Menu Background Color Mobile', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#ffffff',
|
||||||
|
'selectors' => [
|
||||||
|
'(tablet){{WRAPPER}} .attesa-main-menu-container' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'text_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .main-navigation >div >ul >li >a' => 'color: {{VALUE}};',
|
||||||
|
'(tablet){{WRAPPER}} .main-navigation ul ul a, {{WRAPPER}} .main-navigation ul li .indicator:before' => 'color: {{VALUE}} !important',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'sub_menu_back_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Sub Menu Background Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .main-navigation ul ul a' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'sub_menu_text_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Sub Menu Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#ffffff',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .main-navigation ul ul a' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'menu_mobile_border_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Menu Mobile Border Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#ececec',
|
||||||
|
'selectors' => [
|
||||||
|
'(tablet){{WRAPPER}} .main-navigation li, {{WRAPPER}} .main-navigation ul li .indicator, {{WRAPPER}} .main-navigation ul li .indicator, {{WRAPPER}} .main-navigation >div >ul >li >ul.sub-menu, {{WRAPPER}} .attesa-main-menu-container' => 'border-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_nav_menu_style_featured',
|
||||||
|
[
|
||||||
|
'label' => __( 'Featured button Style (if used)', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'feat_button_text_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Featured Button Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#ffffff',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .main-navigation >div >ul >li.attesaMenuButton >a' => 'color: {{VALUE}};',
|
||||||
|
'(tablet){{WRAPPER}} .main-navigation >div ul li.attesaMenuButton a, {{WRAPPER}} .main-navigation >div ul li.attesaMenuButton a:hover, {{WRAPPER}} .main-navigation >div ul li.attesaMenuButton a:focus, {{WRAPPER}} .main-navigation >div ul li.attesaMenuButton a:active, {{WRAPPER}} .main-navigation ul li.attesaMenuButton .indicator:before' => 'color: {{VALUE}} !important',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'feat_button_back_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Featured Button Background Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesaMenuButton' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_nav_menu_close_menu_button',
|
||||||
|
[
|
||||||
|
'label' => __( 'Close menu mobile button Style', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'close_button_text_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Close Menu Button Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-main-menu-container.open_pushmenu .attesa-close-pushmenu' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'close_button_back_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Close Menu Button Background Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#fbfbfb',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-main-menu-container.open_pushmenu .attesa-close-pushmenu' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'close_button_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'left' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'right' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'left',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-main-menu-container.open_pushmenu .attesa-close-pushmenu' => 'text-align: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_hamburger_menu',
|
||||||
|
[
|
||||||
|
'label' => __( 'Hamburger Menu button Style (if used)', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'hamburger_menu_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Hamburger Menu Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .hamburger-menu .menu__line' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get_available_menus() {
|
||||||
|
$menus = wp_get_nav_menus();
|
||||||
|
|
||||||
|
$options = array (__( '-- Select --', 'attesa-extra' ));
|
||||||
|
|
||||||
|
foreach ( $menus as $menu ) {
|
||||||
|
$options[ $menu->slug ] = $menu->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
$menu_selected = $settings['select_menu'];
|
||||||
|
$menu = $settings['mobile_menu'];
|
||||||
|
$close_menu = $settings['close_mobile_menu'];
|
||||||
|
$menuLinksStyle = attesa_options('_menu_links_style', 'minimal');
|
||||||
|
$mobileMenuIcon = attesa_options('_mobile_menu_icon', 'fas fa fa-bars');
|
||||||
|
?>
|
||||||
|
<?php if ($menu_selected != '0'):?>
|
||||||
|
<div class="attesa-custom-menu">
|
||||||
|
<div class="mainHead">
|
||||||
|
<div class="subHead attesa-elementor-menu">
|
||||||
|
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false" aria-label="<?php echo esc_attr($menu); ?>"><?php echo esc_html($menu); ?><i class="spaceLeft <?php echo esc_attr($mobileMenuIcon); ?>" aria-hidden="true"></i></button>
|
||||||
|
<div class="attesa-main-menu-container open_pushmenu">
|
||||||
|
<div class="attesa-close-pushmenu"><i class="fa fa-times-circle-o spaceRight" aria-hidden="true"></i><?php echo esc_html($close_menu); ?></div>
|
||||||
|
<nav id="site-navigation" class="main-navigation menustyle_<?php echo esc_attr($menuLinksStyle); ?>" <?php attesa_schema_markup('site-navigation'); ?>>
|
||||||
|
<?php
|
||||||
|
wp_nav_menu( array(
|
||||||
|
'menu' => $menu_selected,
|
||||||
|
'theme_location' => 'main',
|
||||||
|
'menu_id' => 'primary-menu',
|
||||||
|
) );
|
||||||
|
?>
|
||||||
|
</nav><!-- #site-navigation -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainHead -->
|
||||||
|
<?php if ( is_active_sidebar( attesa_get_push_sidebar() ) && attesa_check_bar('push') ) : ?>
|
||||||
|
<div class="mainFunc">
|
||||||
|
<div class="subFunc attesa-elementor-menu">
|
||||||
|
<?php if(attesa_options('_pushsidebar_icon','three_lines_icon') == 'three_lines_icon') : ?>
|
||||||
|
<div class="hamburger-menu">
|
||||||
|
<div class="menu__line menu_line1"></div>
|
||||||
|
<div class="menu__line menu_line2"></div>
|
||||||
|
<div class="menu__line menu_line3"></div>
|
||||||
|
<div class="menu__line menu_line4"></div>
|
||||||
|
<div class="menu__line menu_line5"></div>
|
||||||
|
</div>
|
||||||
|
<?php elseif(attesa_options('_pushsidebar_icon','three_lines_icon') == 'plus_icon'): ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__plus menu_plus1"></div>
|
||||||
|
<div class="menu__plus menu_plus2"></div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="hamburger-menu noOw">
|
||||||
|
<div class="menu__circle"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainFunc -->
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,623 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Posts_Carousel extends Widget_Base {
|
||||||
|
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-posts';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Blog Posts Grid', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-posts-grid';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_query_blog',
|
||||||
|
[
|
||||||
|
'label' => __( 'Query', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'number',
|
||||||
|
[
|
||||||
|
'label' => __( 'Number of posts', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::NUMBER,
|
||||||
|
'default' => 4,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'ignore_sticky_posts',
|
||||||
|
[
|
||||||
|
'label' => __( 'Ignore sticky posts', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'return_value' => 'true',
|
||||||
|
'default' => 'false',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'per_row',
|
||||||
|
[
|
||||||
|
'label' => __( 'Columns', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => '3',
|
||||||
|
'options' => [
|
||||||
|
'1' => __( '1', 'attesa-extra' ),
|
||||||
|
'2' => __( '2', 'attesa-extra' ),
|
||||||
|
'3' => __( '3', 'attesa-extra' ),
|
||||||
|
'4' => __( '4', 'attesa-extra' ),
|
||||||
|
'5' => __( '5', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'order_by',
|
||||||
|
[
|
||||||
|
'label' => __( 'Order by', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'date',
|
||||||
|
'options' => [
|
||||||
|
'date' => __( 'Date', 'attesa-extra' ),
|
||||||
|
'rand' => __( 'Random', 'attesa-extra' ),
|
||||||
|
'comment_count' => __( 'Number of comments', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'category',
|
||||||
|
[
|
||||||
|
'label' => __( 'Categories', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'options' => $this->get_cats(),
|
||||||
|
'default' => 'all',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'show_images',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show featured images (if exists)', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'return_value' => 'yes',
|
||||||
|
'default' => 'yes',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'show_meta',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show Meta', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'return_value' => 'yes',
|
||||||
|
'default' => 'no',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'author',
|
||||||
|
[
|
||||||
|
'label' => __( 'Author Meta', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'true',
|
||||||
|
'options' => [
|
||||||
|
'true' => __( 'Show', 'attesa-extra' ),
|
||||||
|
'false' => __( 'Hide', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'show_meta' => 'yes',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'date',
|
||||||
|
[
|
||||||
|
'label' => __( 'Date Meta', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'true',
|
||||||
|
'options' => [
|
||||||
|
'true' => __( 'Show', 'attesa-extra' ),
|
||||||
|
'false' => __( 'Hide', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'show_meta' => 'yes',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'comments',
|
||||||
|
[
|
||||||
|
'label' => __( 'Comments Meta', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'true',
|
||||||
|
'options' => [
|
||||||
|
'true' => __( 'Show', 'attesa-extra' ),
|
||||||
|
'false' => __( 'Hide', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'show_meta' => 'yes',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'show_categories',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show Categories', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'return_value' => 'yes',
|
||||||
|
'default' => 'no',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'show_limit',
|
||||||
|
[
|
||||||
|
'label' => __( 'Show Excerpt', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SWITCHER,
|
||||||
|
'label_on' => __( 'On', 'attesa-extra' ),
|
||||||
|
'label_off' => __( 'Off', 'attesa-extra' ),
|
||||||
|
'return_value' => 'yes',
|
||||||
|
'default' => 'no',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'limit',
|
||||||
|
[
|
||||||
|
'label' => __( 'Excerpt length', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 20,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'ms' => [
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 100,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'condition' => [
|
||||||
|
'show_limit' => 'yes',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'image_size',
|
||||||
|
[
|
||||||
|
'label' => __( 'Image Size', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'attesa-small',
|
||||||
|
'options' => [
|
||||||
|
'medium_large' => __( 'Medium Large (768 x infinite height)', 'attesa-extra' ),
|
||||||
|
'large' => __( 'Large (1024 x 1024px)', 'attesa-extra' ),
|
||||||
|
'attesa-small' => __( 'Medium Small (500 x 270px)', 'attesa-extra' ),
|
||||||
|
'thumbnail' => __( 'Thumbnail (150 x 150px)', 'attesa-extra' ),
|
||||||
|
'full' => __( 'Original image size', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'label' => __( 'View', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::HIDDEN,
|
||||||
|
'default' => 'traditional',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
|
||||||
|
//Post titles styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_post_title_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Post title', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_control(
|
||||||
|
'name_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .latest-news-wrapper article .attesa-extra-elementor-blog-title a' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'post_title_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .latest-news-wrapper article .attesa-extra-elementor-blog-title',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'html_tag',
|
||||||
|
[
|
||||||
|
'label' => __( 'HTML Tag', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SELECT,
|
||||||
|
'default' => 'h4',
|
||||||
|
'options' => [
|
||||||
|
'h2' => __( 'H2', 'attesa-extra' ),
|
||||||
|
'h3' => __( 'H3', 'attesa-extra' ),
|
||||||
|
'h4' => __( 'H4', 'attesa-extra' ),
|
||||||
|
'h5' => __( 'H5', 'attesa-extra' ),
|
||||||
|
'h6' => __( 'H6', 'attesa-extra' ),
|
||||||
|
'div' => __( 'div', 'attesa-extra' ),
|
||||||
|
'span' => __( 'span', 'attesa-extra' ),
|
||||||
|
'p' => __( 'p', 'attesa-extra' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post titles styles
|
||||||
|
|
||||||
|
//Content styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_content_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Post content', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_control(
|
||||||
|
'content_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .latest-news-wrapper article .post-excerpt,{{WRAPPER}} .latest-news-wrapper article .elementor-cat-links' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'content_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .latest-news-wrapper article .post-excerpt',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End content styles
|
||||||
|
|
||||||
|
//Categories styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_categories_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Categories content', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_control(
|
||||||
|
'categories_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .latest-news-wrapper article .elementor-cat-links a' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'categories_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .latest-news-wrapper article .elementor-cat-links',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End categories styles
|
||||||
|
|
||||||
|
//Meta styles
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_meta_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Meta content', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_control(
|
||||||
|
'meta_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-blog-grid-meta a, .awp-blog-grid-meta' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'meta_typography',
|
||||||
|
'selector' => '.awp-blog-grid-meta',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End meta styles
|
||||||
|
|
||||||
|
//Post spacing
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_post_spacing',
|
||||||
|
[
|
||||||
|
'label' => __( 'Post spacing', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'post_spacing',
|
||||||
|
[
|
||||||
|
'label' => __( 'Spacing', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 15,
|
||||||
|
'right' => 15,
|
||||||
|
'bottom' => 15,
|
||||||
|
'left' => 15,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 15,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 15,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => false,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 0,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 0,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => false,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-blog-posts-elementor article' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post spacing
|
||||||
|
|
||||||
|
//Post spacing
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_image_border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Images Border Radius', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Border Radius', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-blog-posts-elementor article .entry-thumb img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End post spacing
|
||||||
|
|
||||||
|
//Alignment
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_alignment',
|
||||||
|
[
|
||||||
|
'label' => __( 'Text Alignment', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'text-align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'left' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'right' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
'justify' => [
|
||||||
|
'title' => __( 'Justify', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-justify',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'center',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-extra-blog-posts-elementor article' => 'text-align: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
//End alignment
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_cats() {
|
||||||
|
$all = array(
|
||||||
|
'all' => 'All Categories'
|
||||||
|
);
|
||||||
|
$args = array( 'hide_empty' => false );
|
||||||
|
$terms = get_terms('category',$args);
|
||||||
|
foreach ( $terms as $term => $key ) {
|
||||||
|
$all[$key->term_id] = $key->name;
|
||||||
|
}
|
||||||
|
return $all;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
$show_images = $settings['show_images'];
|
||||||
|
$show_categories = $settings['show_categories'];
|
||||||
|
$show_meta = $settings['show_meta'];
|
||||||
|
$show_limit = $settings['show_limit'];
|
||||||
|
$limit = $settings['limit']['size'];
|
||||||
|
$per_row = $settings['per_row'];
|
||||||
|
$image_size = $settings['image_size'];
|
||||||
|
$tag = $settings['html_tag'];
|
||||||
|
if ($settings['category'] == 'all') {
|
||||||
|
$r = new \WP_Query( array(
|
||||||
|
'no_found_rows' => true,
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'orderby' => $settings['order_by'],
|
||||||
|
'posts_per_page' => $settings['number'],
|
||||||
|
'ignore_sticky_posts' => $settings['ignore_sticky_posts']
|
||||||
|
) );
|
||||||
|
} else {
|
||||||
|
$r = new \WP_Query( array(
|
||||||
|
'no_found_rows' => true,
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'cat' => $settings['category'],
|
||||||
|
'orderby' => $settings['order_by'],
|
||||||
|
'posts_per_page' => $settings['number'],
|
||||||
|
'ignore_sticky_posts' => $settings['ignore_sticky_posts']
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $r->have_posts() ) :
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="attesa-extra-blog-posts-elementor number-columns-<?php echo absint( $per_row ); ?>">
|
||||||
|
<div class="latest-news-wrapper">
|
||||||
|
<?php while ( $r->have_posts() ) : $r->the_post(); ?>
|
||||||
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
|
<?php if ( '' != get_the_post_thumbnail() && $show_images == 'yes' ) : ?>
|
||||||
|
<div class="entry-thumb"><a href="<?php echo esc_url(get_permalink()); ?>">
|
||||||
|
<?php echo get_the_post_thumbnail(get_the_ID() ,esc_attr($image_size)); ?>
|
||||||
|
</a></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($show_meta == 'yes'): ?>
|
||||||
|
<div class="awp-blog-grid-meta">
|
||||||
|
|
||||||
|
<?php if ( 'true' == $settings['author'] ) { ?>
|
||||||
|
<span class="meta-author"><i class="fa fas fa-user spaceLeftRight"></i><?php echo the_author_posts_link(); ?></span>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( 'true' == $settings['date'] ) { ?>
|
||||||
|
<span class="meta-date"><i class="fa fas fa-clock spaceLeftRight"></i><?php echo get_the_date(); ?></span>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( 'true' == $settings['comments'] && comments_open() && ! post_password_required() ) { ?>
|
||||||
|
<span class="meta-comments"><i class="fa fas fa-comments spaceLeftRight"></i><?php comments_popup_link( esc_html__( '0 Comments', 'attesa-extra' ), esc_html__( '1 Comment', 'attesa-extra' ), esc_html__( '% Comments', 'attesa-extra' ), 'comments-link' ); ?></span>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($show_categories == 'yes'):
|
||||||
|
$categories_list = get_the_category_list( ' • ' );
|
||||||
|
if ( $categories_list ) {
|
||||||
|
echo '<span class="elementor-cat-links">' . $categories_list . '</span>';
|
||||||
|
}
|
||||||
|
endif; ?>
|
||||||
|
<?php the_title( sprintf( '<'.esc_attr($tag).' class="entry-title attesa-extra-elementor-blog-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></'.esc_attr($tag).'>' ); ?>
|
||||||
|
<?php if($show_limit == 'yes'): ?>
|
||||||
|
<div class="post-excerpt">
|
||||||
|
<?php echo wp_trim_words( wp_strip_all_tags( get_the_excerpt() ), $limit ); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</article>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
wp_reset_postdata();
|
||||||
|
endif;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _content_template() {
|
||||||
|
}
|
||||||
|
}
|
||||||
199
wp-content/plugins/attesa-extra/elementor/widgets/site-logo.php
Normal file
199
wp-content/plugins/attesa-extra/elementor/widgets/site-logo.php
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Site_Logo extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-logo';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Site Logo', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-site-logo';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_site_logo',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site Logo', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'important_note',
|
||||||
|
[
|
||||||
|
'label' => __( 'Note', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::RAW_HTML,
|
||||||
|
'raw' => __( 'You can customize your settings (choose the logo, change the site title or tagline) from your WordPress Dashboard in "Appearance-> Customize-> Site Identity".', 'attesa-extra' ),
|
||||||
|
'content_classes' => 'elementor-descriptor',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'site_logo_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'flex-start' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'flex-end' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'flex-start',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-custom-logo .attesa-text-logo' => 'align-items: {{VALUE}};',
|
||||||
|
'{{WRAPPER}} .attesa-custom-logo .attesa-logo' => 'justify-content: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'max_height',
|
||||||
|
[
|
||||||
|
'label' => __( 'Logo Max Height', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 60,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 50,
|
||||||
|
'max' => 500,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-custom-logo .attesa-logo img' => 'max-height: {{SIZE}}{{UNIT}};width: auto;',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'site_title_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site title style (if used)', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'site_title_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site Title Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-custom-logo .site-title a' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'title_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .attesa-custom-logo .site-title a',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'site_tagline_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site tagline style (if used)', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'site_tagline_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site Tagline Text Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .attesa-custom-logo .site-description' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_group_control(
|
||||||
|
Group_Control_Typography::get_type(),
|
||||||
|
[
|
||||||
|
'name' => 'tagline_typography',
|
||||||
|
'selector' => '{{WRAPPER}} .attesa-custom-logo .site-description',
|
||||||
|
'scheme' => Scheme_Typography::TYPOGRAPHY_3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
?>
|
||||||
|
<div class="attesa-custom-logo">
|
||||||
|
<div class="mainLogo">
|
||||||
|
<div class="subLogo">
|
||||||
|
<div class="site-branding" <?php attesa_schema_markup('site-title'); ?>>
|
||||||
|
<?php
|
||||||
|
if ( function_exists( 'the_custom_logo' ) ) : ?>
|
||||||
|
<div class="attesa-logo">
|
||||||
|
<?php the_custom_logo(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="attesa-text-logo">
|
||||||
|
<?php
|
||||||
|
if ( is_front_page() && is_home() ) :
|
||||||
|
?>
|
||||||
|
<h1 class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||||
|
<?php
|
||||||
|
else :
|
||||||
|
?>
|
||||||
|
<p class="site-title" <?php attesa_schema_markup('name'); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php attesa_schema_markup('url'); ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
$removeSiteDescription = attesa_options('_hide_description', '');
|
||||||
|
if (empty($removeSiteDescription)) :
|
||||||
|
$attesa_description = get_bloginfo( 'description', 'display' );
|
||||||
|
if ( $attesa_description || is_customize_preview() ) :
|
||||||
|
?>
|
||||||
|
<p class="site-description smallText"><?php echo $attesa_description; /* WPCS: xss ok. */ ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- .mainLogo -->
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
use Elementor\Controls_Manager;
|
||||||
|
use Elementor\Scheme_Color;
|
||||||
|
use Elementor\Widget_Base;
|
||||||
|
use Elementor\Group_Control_Typography;
|
||||||
|
use Elementor\Scheme_Typography;
|
||||||
|
|
||||||
|
class Attesa_Extra_Site_Social_Buttons extends Widget_Base {
|
||||||
|
public function get_name() {
|
||||||
|
return 'attesa-extra-social-buttons';
|
||||||
|
}
|
||||||
|
public function get_title() {
|
||||||
|
return __( 'Site Social Buttons', 'attesa-extra' );
|
||||||
|
}
|
||||||
|
public function get_icon() {
|
||||||
|
return 'awp-icon eicon-social-icons';
|
||||||
|
}
|
||||||
|
public function get_categories() {
|
||||||
|
return [ 'attesa-elements' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _register_controls() {
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'section_social_buttons',
|
||||||
|
[
|
||||||
|
'label' => __( 'Site Social Buttons', 'attesa-extra' ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'important_note',
|
||||||
|
[
|
||||||
|
'label' => __( 'Note', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::RAW_HTML,
|
||||||
|
'raw' => __( 'You can insert your social media links from your WordPress Dashboard under "Appearance-> Customize-> Attesa Theme Options-> Social Buttons".', 'attesa-extra' ),
|
||||||
|
'content_classes' => 'elementor-descriptor',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'social_buttons_align',
|
||||||
|
[
|
||||||
|
'label' => __( 'Alignment', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::CHOOSE,
|
||||||
|
'options' => [
|
||||||
|
'left' => [
|
||||||
|
'title' => __( 'Left', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-left',
|
||||||
|
],
|
||||||
|
'center' => [
|
||||||
|
'title' => __( 'Center', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-center',
|
||||||
|
],
|
||||||
|
'right' => [
|
||||||
|
'title' => __( 'Right', 'attesa-extra' ),
|
||||||
|
'icon' => 'fa fa-align-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'default' => 'left',
|
||||||
|
'toggle' => true,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor' => 'text-align: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'icons_padding',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icons Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 10,
|
||||||
|
'right' => 10,
|
||||||
|
'bottom' => 10,
|
||||||
|
'left' => 10,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'icons_margin',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icons Padding', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', 'em' ],
|
||||||
|
'desktop_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'tablet_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'mobile_default' => [
|
||||||
|
'top' => 5,
|
||||||
|
'right' => 5,
|
||||||
|
'bottom' => 5,
|
||||||
|
'left' => 5,
|
||||||
|
'unit' => 'px',
|
||||||
|
'isLinked' => true,
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
|
||||||
|
$this->start_controls_section(
|
||||||
|
'social_buttons_style',
|
||||||
|
[
|
||||||
|
'label' => __( 'Social Buttons', 'attesa-extra' ),
|
||||||
|
'tab' => Controls_Manager::TAB_STYLE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'icons_size',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icons Size', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::SLIDER,
|
||||||
|
'default' => [
|
||||||
|
'size' => 15,
|
||||||
|
],
|
||||||
|
'range' => [
|
||||||
|
'px' => [
|
||||||
|
'min' => 5,
|
||||||
|
'max' => 50,
|
||||||
|
'step' => 1,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'social_buttons_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#f06292',
|
||||||
|
'separator' => 'before',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'social_buttons_back_color',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Background Color', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'social_buttons_color_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Color Hover', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'default' => '#000000',
|
||||||
|
'separator' => 'before',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a:hover, {{WRAPPER}} .awp-social-buttons .site-social-elementor a:focus, {{WRAPPER}} .awp-social-buttons .site-social-elementor a:active' => 'color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_control(
|
||||||
|
'social_buttons_back_color_hover',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icon Background Color Hover', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::COLOR,
|
||||||
|
'separator' => 'after',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a:hover, {{WRAPPER}} .awp-social-buttons .site-social-elementor a:focus, {{WRAPPER}} .awp-social-buttons .site-social-elementor a:active' => 'background-color: {{VALUE}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->add_responsive_control(
|
||||||
|
'icons_border_radius',
|
||||||
|
[
|
||||||
|
'label' => __( 'Icons Border Radius', 'attesa-extra' ),
|
||||||
|
'type' => Controls_Manager::DIMENSIONS,
|
||||||
|
'size_units' => [ 'px', '%' ],
|
||||||
|
'separator' => 'before',
|
||||||
|
'selectors' => [
|
||||||
|
'{{WRAPPER}} .awp-social-buttons .site-social-elementor a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->end_controls_section();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function render() {
|
||||||
|
$settings = $this->get_settings();
|
||||||
|
?>
|
||||||
|
<div class="awp-social-buttons">
|
||||||
|
<?php echo attesa_show_social_network('elementor'); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
1
wp-content/plugins/attesa-extra/index.php
Normal file
1
wp-content/plugins/attesa-extra/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php // Silence is golden
|
||||||
2604
wp-content/plugins/attesa-extra/languages/attesa-extra.pot
Normal file
2604
wp-content/plugins/attesa-extra/languages/attesa-extra.pot
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Plugin Name: ButterBean
|
||||||
|
* Plugin URI: https://github.com/justintadlock/butterbean
|
||||||
|
* Description: A little post meta framework.
|
||||||
|
* Version: 1.0.0
|
||||||
|
* Author: Justin Tadlock
|
||||||
|
* Author URI: http://themehybrid.com
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
// For each version release, the priority needs to decrement by 1. This is so that
|
||||||
|
// we can load newer versions earlier than older versions when there's a conflict.
|
||||||
|
add_action( 'init', 'butterbean_loader_100', 9999 );
|
||||||
|
|
||||||
|
if ( ! function_exists( 'butterbean_loader_100' ) ) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader function. Note to change the name of this function to use the
|
||||||
|
* current version number of the plugin. `1.0.0` is `100`, `1.3.4` = `134`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_loader_100() {
|
||||||
|
|
||||||
|
// If not in the admin, bail.
|
||||||
|
if ( ! is_admin() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If ButterBean hasn't been loaded, let's load it.
|
||||||
|
if ( ! defined( 'BUTTERBEAN_LOADED' ) ) {
|
||||||
|
define( 'BUTTERBEAN_LOADED', true );
|
||||||
|
|
||||||
|
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-butterbean.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
## [1.0.0] - 2016-08-29
|
||||||
|
|
||||||
|
* Plugin launch. Everything's new!
|
||||||
@ -0,0 +1,869 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Primary plugin class. This sets up and runs the show.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'ButterBean' ) ) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main ButterBean class. Runs the show.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
final class ButterBean {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory path to the plugin folder.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $dir_path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory URI to the plugin folder.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $dir_uri = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory path to the template folder.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $tmpl_path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of managers.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $managers = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of manager types.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $manager_types = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of section types.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $section_types = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of control types.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $control_types = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of setting types.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $setting_types = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this is a new post. Once the post is saved and we're
|
||||||
|
* no longer on the `post-new.php` screen, this is going to be
|
||||||
|
* `false`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $is_new_post = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the instance.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
|
||||||
|
static $instance = null;
|
||||||
|
|
||||||
|
if ( is_null( $instance ) ) {
|
||||||
|
$instance = new self;
|
||||||
|
$instance->setup();
|
||||||
|
$instance->includes();
|
||||||
|
$instance->setup_actions();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor method.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function __construct() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initial plugin setup.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function setup() {
|
||||||
|
|
||||||
|
$this->dir_path = apply_filters( 'butterbean_dir_path', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
||||||
|
$this->dir_uri = apply_filters( 'butterbean_dir_uri', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
||||||
|
|
||||||
|
$this->tmpl_path = trailingslashit( $this->dir_path . 'tmpl' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads include and admin files for the plugin.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function includes() {
|
||||||
|
|
||||||
|
// If not in the admin, bail.
|
||||||
|
if ( ! is_admin() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Load base classes.
|
||||||
|
require_once( $this->dir_path . 'inc/class-manager.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/class-section.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/class-control.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/class-setting.php' );
|
||||||
|
|
||||||
|
// Load control sub-classes.
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-checkboxes.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-color.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-datetime.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-image.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-palette.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-radio.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-radio-image.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-select-group.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-textarea.php' );
|
||||||
|
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-excerpt.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-multi-avatars.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/controls/class-control-parent.php' );
|
||||||
|
|
||||||
|
// Load setting sub-classes.
|
||||||
|
require_once( $this->dir_path . 'inc/settings/class-setting-multiple.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/settings/class-setting-datetime.php' );
|
||||||
|
require_once( $this->dir_path . 'inc/settings/class-setting-array.php' );
|
||||||
|
|
||||||
|
// Load functions.
|
||||||
|
require_once( $this->dir_path . 'inc/functions-core.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up initial actions.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function setup_actions() {
|
||||||
|
|
||||||
|
// Call the register function.
|
||||||
|
add_action( 'load-post.php', array( $this, 'register' ), 95 );
|
||||||
|
add_action( 'load-post-new.php', array( $this, 'register' ), 95 );
|
||||||
|
|
||||||
|
// Register default types.
|
||||||
|
add_action( 'butterbean_register', array( $this, 'register_manager_types' ), -95 );
|
||||||
|
add_action( 'butterbean_register', array( $this, 'register_section_types' ), -95 );
|
||||||
|
add_action( 'butterbean_register', array( $this, 'register_control_types' ), -95 );
|
||||||
|
add_action( 'butterbean_register', array( $this, 'register_setting_types' ), -95 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registration callback. Fires the `butterbean_register` action hook to
|
||||||
|
* allow plugins to register their managers.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register() {
|
||||||
|
|
||||||
|
// If this is a new post, set the new post boolean.
|
||||||
|
if ( 'load-post-new.php' === current_action() )
|
||||||
|
$this->is_new_post = true;
|
||||||
|
|
||||||
|
// Get the current post type.
|
||||||
|
$post_type = get_current_screen()->post_type;
|
||||||
|
|
||||||
|
// Action hook for registering managers.
|
||||||
|
do_action( 'butterbean_register', $this, $post_type );
|
||||||
|
|
||||||
|
// Loop through the managers to see if we're using on on this screen.
|
||||||
|
foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
// If we found a matching post type, add our actions/filters.
|
||||||
|
if ( ! in_array( $post_type, (array) $manager->post_type ) ) {
|
||||||
|
$this->unregister_manager( $manager->name );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort controls and sections by priority.
|
||||||
|
uasort( $manager->controls, array( $this, 'priority_sort' ) );
|
||||||
|
uasort( $manager->sections, array( $this, 'priority_sort' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no managers registered, bail.
|
||||||
|
if ( ! $this->managers )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Add meta boxes.
|
||||||
|
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 5 );
|
||||||
|
|
||||||
|
// Save settings.
|
||||||
|
add_action( 'save_post', array( $this, 'update' ) );
|
||||||
|
|
||||||
|
// Load scripts and styles.
|
||||||
|
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||||
|
add_action( 'butterbean_enqueue_scripts', array( $this, 'enqueue' ) );
|
||||||
|
|
||||||
|
// Localize scripts and Undescore templates.
|
||||||
|
add_action( 'admin_footer', array( $this, 'localize_scripts' ) );
|
||||||
|
add_action( 'admin_footer', array( $this, 'print_templates' ) );
|
||||||
|
|
||||||
|
// Renders our Backbone views.
|
||||||
|
add_action( 'admin_print_footer_scripts', array( $this, 'render_views' ), 95 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object|string $manager
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_manager( $manager, $args = array() ) {
|
||||||
|
|
||||||
|
if ( ! is_object( $manager ) ) {
|
||||||
|
|
||||||
|
$type = isset( $args['type'] ) ? $this->get_manager_type( $args['type'] ) : $this->get_manager_type( 'default' );
|
||||||
|
|
||||||
|
$manager = new $type( $manager, $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $this->manager_exists( $manager->name ) )
|
||||||
|
$this->managers[ $manager->name ] = $manager;
|
||||||
|
|
||||||
|
return $manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a manager object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_manager( $name ) {
|
||||||
|
|
||||||
|
if ( $this->manager_exists( $name ) )
|
||||||
|
unset( $this->managers[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a manager object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_manager( $name ) {
|
||||||
|
|
||||||
|
return $this->manager_exists( $name ) ? $this->managers[ $name ] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a manager exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function manager_exists( $name ) {
|
||||||
|
|
||||||
|
return isset( $this->managers[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a manager type. This is just a method of telling ButterBean
|
||||||
|
* the class of your custom manager type. It allows the manager to be
|
||||||
|
* called without having to pass an object to `register_manager()`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param string $class
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_manager_type( $type, $class ) {
|
||||||
|
|
||||||
|
if ( ! $this->manager_type_exists( $type ) )
|
||||||
|
$this->manager_types[ $type ] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a manager type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_manager_type( $type ) {
|
||||||
|
|
||||||
|
if ( $this->manager_type_exists( $type ) )
|
||||||
|
unset( $this->manager_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class name for the manager type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_manager_type( $type ) {
|
||||||
|
|
||||||
|
return $this->manager_type_exists( $type ) ? $this->manager_types[ $type ] : $this->manager_types[ 'default' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a manager type exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function manager_type_exists( $type ) {
|
||||||
|
|
||||||
|
return isset( $this->manager_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a section type. This is just a method of telling ButterBean
|
||||||
|
* the class of your custom section type. It allows the section to be
|
||||||
|
* called without having to pass an object to `register_section()`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param string $class
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_section_type( $type, $class ) {
|
||||||
|
|
||||||
|
if ( ! $this->section_type_exists( $type ) )
|
||||||
|
$this->section_types[ $type ] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a section type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_section_type( $type ) {
|
||||||
|
|
||||||
|
if ( $this->section_type_exists( $type ) )
|
||||||
|
unset( $this->section_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class name for the section type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_section_type( $type ) {
|
||||||
|
|
||||||
|
return $this->section_type_exists( $type ) ? $this->section_types[ $type ] : $this->section_types[ 'default' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a section type exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function section_type_exists( $type ) {
|
||||||
|
|
||||||
|
return isset( $this->section_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a control type. This is just a method of telling ButterBean
|
||||||
|
* the class of your custom control type. It allows the control to be
|
||||||
|
* called without having to pass an object to `register_control()`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param string $class
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_control_type( $type, $class ) {
|
||||||
|
|
||||||
|
if ( ! $this->control_type_exists( $type ) )
|
||||||
|
$this->control_types[ $type ] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a control type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_control_type( $type ) {
|
||||||
|
|
||||||
|
if ( $this->control_type_exists( $type ) )
|
||||||
|
unset( $this->control_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class name for the control type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_control_type( $type ) {
|
||||||
|
|
||||||
|
return $this->control_type_exists( $type ) ? $this->control_types[ $type ] : $this->control_types[ 'default' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a control type exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function control_type_exists( $type ) {
|
||||||
|
|
||||||
|
return isset( $this->control_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a setting type. This is just a method of telling ButterBean
|
||||||
|
* the class of your custom setting type. It allows the setting to be
|
||||||
|
* called without having to pass an object to `register_setting()`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param string $class
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_setting_type( $type, $class ) {
|
||||||
|
|
||||||
|
if ( ! $this->setting_type_exists( $type ) )
|
||||||
|
$this->setting_types[ $type ] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a setting type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_setting_type( $type ) {
|
||||||
|
|
||||||
|
if ( $this->setting_type_exists( $type ) )
|
||||||
|
unset( $this->setting_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class name for the setting type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_setting_type( $type ) {
|
||||||
|
|
||||||
|
return $this->setting_type_exists( $type ) ? $this->setting_types[ $type ] : $this->setting_types[ 'default' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a setting type exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setting_type_exists( $type ) {
|
||||||
|
|
||||||
|
return isset( $this->setting_types[ $type ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers our manager types so that devs don't have to directly instantiate
|
||||||
|
* the class each time they register a manager. Instead, they can use the
|
||||||
|
* `type` argument.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_manager_types() {
|
||||||
|
|
||||||
|
$this->register_manager_type( 'default', 'ButterBean_Manager' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers our section types so that devs don't have to directly instantiate
|
||||||
|
* the class each time they register a section. Instead, they can use the
|
||||||
|
* `type` argument.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_section_types() {
|
||||||
|
|
||||||
|
$this->register_section_type( 'default', 'ButterBean_Section' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers our control types so that devs don't have to directly instantiate
|
||||||
|
* the class each time they register a control. Instead, they can use the
|
||||||
|
* `type` argument.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_control_types() {
|
||||||
|
|
||||||
|
$this->register_control_type( 'default', 'ButterBean_Control' );
|
||||||
|
$this->register_control_type( 'checkboxes', 'ButterBean_Control_Checkboxes' );
|
||||||
|
$this->register_control_type( 'color', 'ButterBean_Control_Color' );
|
||||||
|
$this->register_control_type( 'datetime', 'ButterBean_Control_Datetime' );
|
||||||
|
$this->register_control_type( 'excerpt', 'ButterBean_Control_Excerpt' );
|
||||||
|
$this->register_control_type( 'image', 'ButterBean_Control_Image' );
|
||||||
|
$this->register_control_type( 'palette', 'ButterBean_Control_Palette' );
|
||||||
|
$this->register_control_type( 'radio', 'ButterBean_Control_Radio' );
|
||||||
|
$this->register_control_type( 'radio-image', 'ButterBean_Control_Radio_Image' );
|
||||||
|
$this->register_control_type( 'select-group', 'ButterBean_Control_Select_Group' );
|
||||||
|
$this->register_control_type( 'textarea', 'ButterBean_Control_Textarea' );
|
||||||
|
$this->register_control_type( 'multi-avatars', 'ButterBean_Control_Multi_Avatars' );
|
||||||
|
$this->register_control_type( 'parent', 'ButterBean_Control_Parent' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers our setting types so that devs don't have to directly instantiate
|
||||||
|
* the class each time they register a setting. Instead, they can use the
|
||||||
|
* `type` argument.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_setting_types() {
|
||||||
|
|
||||||
|
$this->register_setting_type( 'default', 'ButterBean_Setting' );
|
||||||
|
$this->register_setting_type( 'single', 'ButterBean_Setting' );
|
||||||
|
$this->register_setting_type( 'multiple', 'ButterBean_Setting_Multiple' );
|
||||||
|
$this->register_setting_type( 'array', 'ButterBean_Setting_Array' );
|
||||||
|
$this->register_setting_type( 'datetime', 'ButterBean_Setting_Datetime' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires an action hook to register/enqueue scripts/styles.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue_scripts() {
|
||||||
|
|
||||||
|
do_action( 'butterbean_enqueue_scripts' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads scripts and styles.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {
|
||||||
|
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||||
|
|
||||||
|
// Enqueue the main plugin script.
|
||||||
|
wp_enqueue_script( 'butterbean', $this->dir_uri . "js/butterbean{$min}.js", array( 'backbone', 'wp-util' ), '', true );
|
||||||
|
|
||||||
|
// Enqueue the main plugin style.
|
||||||
|
wp_enqueue_style( 'butterbean', $this->dir_uri . "css/butterbean{$min}.css" );
|
||||||
|
|
||||||
|
// Loop through the manager and its controls and call each control's `enqueue()` method.
|
||||||
|
foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
$manager->enqueue();
|
||||||
|
|
||||||
|
foreach ( $manager->sections as $section )
|
||||||
|
$section->enqueue();
|
||||||
|
|
||||||
|
foreach ( $manager->controls as $control )
|
||||||
|
$control->enqueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback function for adding meta boxes. This function adds a meta box
|
||||||
|
* for each of the managers.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $post_type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_meta_boxes( $post_type ) {
|
||||||
|
|
||||||
|
foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
// If the manager is registered for the current post type, add a meta box.
|
||||||
|
if ( in_array( $post_type, (array) $manager->post_type ) && $manager->check_capabilities() ) {
|
||||||
|
|
||||||
|
add_meta_box(
|
||||||
|
"butterbean-ui-{$manager->name}",
|
||||||
|
$manager->label,
|
||||||
|
array( $this, 'meta_box' ),
|
||||||
|
$post_type,
|
||||||
|
$manager->context,
|
||||||
|
$manager->priority,
|
||||||
|
array( 'manager' => $manager )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the meta box. Note that the actual content of the meta box is
|
||||||
|
* handled via Underscore.js templates. The only thing we're outputting here
|
||||||
|
* is the nonce field.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object $post
|
||||||
|
* @param array $metabox
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function meta_box( $post, $metabox ) {
|
||||||
|
|
||||||
|
$manager = $metabox['args']['manager'];
|
||||||
|
|
||||||
|
$manager->post_id = $this->post_id = $post->ID;
|
||||||
|
|
||||||
|
// Nonce field to validate on save.
|
||||||
|
wp_nonce_field( "butterbean_{$manager->name}_nonce", "butterbean_{$manager->name}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passes the appropriate section and control json data to the JS file.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function localize_scripts() {
|
||||||
|
|
||||||
|
$json = array( 'managers' => array() );
|
||||||
|
|
||||||
|
foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
if ( $manager->check_capabilities() )
|
||||||
|
$json['managers'][] = $manager->get_json();
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_localize_script( 'butterbean', 'butterbean_data', $json );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the Underscore.js templates.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function print_templates() {
|
||||||
|
|
||||||
|
$m_templates = array();
|
||||||
|
$s_templates = array();
|
||||||
|
$c_templates = array(); ?>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-butterbean-nav">
|
||||||
|
<?php butterbean_get_nav_template(); ?>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
if ( ! $manager->check_capabilities() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( ! in_array( $manager->type, $m_templates ) ) {
|
||||||
|
$m_templates[] = $manager->type;
|
||||||
|
|
||||||
|
$manager->print_template();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $manager->sections as $section ) {
|
||||||
|
|
||||||
|
if ( ! in_array( $section->type, $s_templates ) ) {
|
||||||
|
$s_templates[] = $section->type;
|
||||||
|
|
||||||
|
$section->print_template();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $manager->controls as $control ) {
|
||||||
|
|
||||||
|
if ( ! in_array( $control->type, $c_templates ) ) {
|
||||||
|
$c_templates[] = $control->type;
|
||||||
|
|
||||||
|
$control->print_template();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders our Backbone views. We're calling this late in the page load so
|
||||||
|
* that other scripts have an opportunity to extend with their own, custom
|
||||||
|
* views for custom controls and such.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function render_views() { ?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
if (typeof butterbean !== 'undefined') {
|
||||||
|
( function( api ) {
|
||||||
|
if ( _.isObject( api ) && _.isFunction( api.render ) ) {
|
||||||
|
api.render();
|
||||||
|
}
|
||||||
|
}( butterbean ) );
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the settings.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update( $post_id ) {
|
||||||
|
|
||||||
|
$do_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
|
||||||
|
$is_autosave = wp_is_post_autosave( $post_id );
|
||||||
|
$is_revision = wp_is_post_revision( $post_id );
|
||||||
|
|
||||||
|
if ( $do_autosave || $is_autosave || $is_revision )
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach ( $this->managers as $manager ) {
|
||||||
|
|
||||||
|
if ( $manager->check_capabilities() )
|
||||||
|
$manager->save( $post_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for sorting sections and controls by priority.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access protected
|
||||||
|
* @param object $a
|
||||||
|
* @param object $b
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function priority_sort( $a, $b ) {
|
||||||
|
|
||||||
|
if ( $a->priority === $b->priority )
|
||||||
|
return $a->instance_number - $b->instance_number;
|
||||||
|
|
||||||
|
return $a->priority - $b->priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the instance of the `ButterBean` class. This function is useful for quickly grabbing data
|
||||||
|
* used throughout the plugin.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function butterbean() {
|
||||||
|
return ButterBean::get_instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's do this thang!
|
||||||
|
butterbean();
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
The code for the project is handled via its [GitHub Repository](https://github.com/justintadlock/butterbean). You can open tickets, create patches, and send pull requests there.
|
||||||
|
|
||||||
|
## Pull requests
|
||||||
|
|
||||||
|
Problem first. Solution second.
|
||||||
|
|
||||||
|
Pull requests should have a ticket open for discussion first. I rarely accept pull requests that aren't for a specific issue for various reasons. It's far better to post an issue and let me or the community provide feedback prior to creating a pull request.
|
||||||
|
|
||||||
|
Please don't make pull requests against the `master` branch. This is the latest, stable code. You can make a pull request against one of the point branches or the `dev` (future release) branch.
|
||||||
|
|
||||||
|
## Coding standards
|
||||||
|
|
||||||
|
In general, the project follows all WordPress [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards). There are instances where it doesn't, opting for personal choices of my own, but in terms of contributing, following the WordPress standards is best practice.
|
||||||
|
|
||||||
|
## Script and style files
|
||||||
|
|
||||||
|
The project consists of several script and style files. When making patches or pull requests with changes to these files, only do so to the primary file. Don't create patches for the minified (`.min`) versions of the files. Those will be minified after a patch is merged into the code base.
|
||||||
|
|
||||||
|
## Language
|
||||||
|
|
||||||
|
All text strings follow U.S. English by default. While such guides are generally unneeded, in cases where style considerations are necessary, these will typically follow conventions laid out in *Elements of Style* or the *AP Stylebook*.
|
||||||
|
|
||||||
|
## Licensing
|
||||||
|
|
||||||
|
Any code contributed to the project via patches, pull requests, or other means will be licensed under the [GPL version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or later. By contributing code to the project, you provide consent to use such code under this license. The exception to this rule is when bringing in third-party code with an alternate open source license.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
The project uses [semantic versioning](http://semver.org). Version numbers will look like `3.2.1` where `3` is the "major" release, `2` is the minor release, and `1` is the patch release.
|
||||||
@ -0,0 +1,330 @@
|
|||||||
|
|
||||||
|
/* Wrapper box */
|
||||||
|
|
||||||
|
.butterbean-ui { }
|
||||||
|
|
||||||
|
.butterbean-ui > .hndle {
|
||||||
|
padding: 10px !important;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-ui .inside {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tabs wrapper. */
|
||||||
|
|
||||||
|
.butterbean-manager-default {
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
background: linear-gradient( 90deg, #fafafa 0%, #fafafa 180px, #fff 180px, #fff 100% );
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default {
|
||||||
|
background: linear-gradient( 90deg, #fafafa 0%, #fafafa 48px, #fff 48px, #fff 100% );
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and ( max-width: 782px ), ( max-width: 980px ) and ( min-width: 851px ) {
|
||||||
|
|
||||||
|
.butterbean-manager-default {
|
||||||
|
background: linear-gradient( 90deg, #fafafa 0%, #fafafa 48px, #fff 48px, #fff 100% );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tab nav. */
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
list-style: none;
|
||||||
|
width: 180px;/*20%;*/
|
||||||
|
line-height: 1em;
|
||||||
|
margin: 0 0 -1px 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #fafafa;
|
||||||
|
border-right: 1px solid #eee;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav li {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav li a {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
line-height: 20px !important;
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav .dashicons {
|
||||||
|
line-height: 20px;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav li[aria-selected="true"] a {
|
||||||
|
position: relative;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #555;
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and ( max-width: 782px ), ( max-width: 980px ) and ( min-width: 851px ) {
|
||||||
|
.butterbean-manager-default .butterbean-nav { width: 48px; }
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav .dashicons {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav .dashicons::before {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-nav .label {
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: -1000em;
|
||||||
|
left: -1000em;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tab content wrapper */
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-content {
|
||||||
|
float: left;
|
||||||
|
width: calc( 100% - 180px );
|
||||||
|
margin-left: -1px;
|
||||||
|
border-left: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and ( max-width: 782px ), ( max-width: 980px ) and ( min-width: 851px ) {
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-content {
|
||||||
|
width: calc( 100% - 48px );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Manager when in the side meta box. === */
|
||||||
|
|
||||||
|
@media only screen and ( min-width: 850px ) {
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default { background: #fff; }
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-content { width: 100%; }
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav {
|
||||||
|
display: table;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav li {
|
||||||
|
display: table-cell;
|
||||||
|
text-align: center;
|
||||||
|
border-right: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav li:last-of-type { border-right: none; }
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav li a {
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav .dashicons {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav .dashicons::before {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-manager-default .butterbean-nav .label {
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: -1000em;
|
||||||
|
left: -1000em;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* === Content === */
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-section {
|
||||||
|
padding: 12px 12px 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-section[aria-hidden="true"] { display: none; }
|
||||||
|
.butterbean-manager-default .butterbean-section[aria-hidden="false"] { display: block; }
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-control {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-label {
|
||||||
|
display : block !important; /* this is getting overwritten somewhere */
|
||||||
|
font-weight : bold;
|
||||||
|
display : inline-block;
|
||||||
|
margin-bottom : 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-control-checkbox .butterbean-label {
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-description {
|
||||||
|
display : block;
|
||||||
|
font-style : italic;
|
||||||
|
margin-top : 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-manager-default .butterbean-label + .butterbean-description {
|
||||||
|
margin-top : 0;
|
||||||
|
margin-bottom : 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Media === */
|
||||||
|
|
||||||
|
.butterbean-control-image .butterbean-img {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 300px;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-placeholder {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
padding: 9px 0;
|
||||||
|
line-height: 20px;
|
||||||
|
border: 1px dashed rgb(180, 185, 190);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Textarea Control === */
|
||||||
|
|
||||||
|
.butterbean-control-textarea textarea,
|
||||||
|
.butterbean-control-excerpt textarea {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 105px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Date Control === */
|
||||||
|
|
||||||
|
.butterbean-control-datetime select {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Palette Control === */
|
||||||
|
|
||||||
|
.butterbean-control-palette label {
|
||||||
|
display: block;
|
||||||
|
padding: 0 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-control-palette label[aria-selected="true"] {
|
||||||
|
padding-top: 5px;
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-palette-label {
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-palette-block {
|
||||||
|
display: table;
|
||||||
|
width: 100%;
|
||||||
|
height: 45px;
|
||||||
|
border: 1px solid rgb(238, 238, 238);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-palette-color {
|
||||||
|
display: table-cell;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Radio Image Control === */
|
||||||
|
|
||||||
|
.butterbean-control-radio-image input[type="radio"] {
|
||||||
|
clip: rect(1px, 1px, 1px, 1px);
|
||||||
|
height: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-control-radio-image img {
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
padding: 1px;
|
||||||
|
border: 4px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-control-radio-image img:hover,
|
||||||
|
.butterbean-control-radio-image img:focus {
|
||||||
|
border-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-control-radio-image input:checked + span + img {
|
||||||
|
border-color: #00a0d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Multi-avatars Control === */
|
||||||
|
|
||||||
|
.butterbean-multi-avatars-wrap label {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-multi-avatars-wrap input[type="checkbox"] {
|
||||||
|
clip: rect( 1px, 1px, 1px, 1px );
|
||||||
|
height: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-multi-avatars-wrap .avatar {
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
padding: 1px;
|
||||||
|
border: 4px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-sortables .butterbean-multi-avatars-wrap .avatar {
|
||||||
|
max-width: 60px;
|
||||||
|
max-height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-multi-avatars-wrap img:hover,
|
||||||
|
.butterbean-multi-avatars-wrap img:focus {
|
||||||
|
border-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.butterbean-multi-avatars-wrap input:checked + span + img {
|
||||||
|
border-color: #00a0d2;
|
||||||
|
}
|
||||||
1
wp-content/plugins/attesa-extra/metabox/butterbean/css/butterbean.min.css
vendored
Normal file
1
wp-content/plugins/attesa-extra/metabox/butterbean/css/butterbean.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,399 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Base class for handling controls. Controls are the form fields for the manager. Each
|
||||||
|
* control should be tied to a section.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the manager object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
public $manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name/ID of the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $label = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the section the control is for.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $section = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setting key for the specific setting the control is tied to.
|
||||||
|
* Controls can have multiple settings attached to them. The default
|
||||||
|
* setting is `default`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $setting = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of settings if the control has multiple settings.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $settings = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'text';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form field attributes.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $attr = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Choices for fields with multiple choices.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $choices = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priority (order) the control should be output.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $priority = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of instances created.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access protected
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected static $instance_count = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance of the current control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $instance_number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback function for deciding if a control is active.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var callable
|
||||||
|
*/
|
||||||
|
public $active_callback = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user role capability required to show the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $capability = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current post type must support to show the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $post_type_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current theme must support to show the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $theme_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the JSON data for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array()
|
||||||
|
*/
|
||||||
|
public $json = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new control object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object $manager
|
||||||
|
* @param string $name
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $name, $args = array() ) {
|
||||||
|
|
||||||
|
foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
|
||||||
|
|
||||||
|
if ( isset( $args[ $key ] ) )
|
||||||
|
$this->$key = $args[ $key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->manager = $manager;
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
if ( empty( $args['settings'] ) || ! is_array( $args['settings'] ) )
|
||||||
|
$this->settings['default'] = $name;
|
||||||
|
|
||||||
|
// Increment the instance count and set the instance number.
|
||||||
|
self::$instance_count += 1;
|
||||||
|
$this->instance_number = self::$instance_count;
|
||||||
|
|
||||||
|
// Set the active callback function if not set.
|
||||||
|
if ( ! $this->active_callback )
|
||||||
|
$this->active_callback = array( $this, 'active_callback' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts/styles for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
$setting = $this->get_setting( $setting );
|
||||||
|
|
||||||
|
return $setting ? $setting->get_value() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the setting object associated with this control. If no setting is
|
||||||
|
* found, `false` is returned.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_setting( $setting = 'default' ) {
|
||||||
|
|
||||||
|
return $this->manager->get_setting( $this->settings[ $setting ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attributes for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_attr() {
|
||||||
|
|
||||||
|
$defaults = array();
|
||||||
|
|
||||||
|
if ( isset( $this->settings[ $this->setting ] ) )
|
||||||
|
$defaults['name'] = $this->get_field_name( $this->setting );
|
||||||
|
|
||||||
|
return wp_parse_args( $this->attr, $defaults );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the HTML field name for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_field_name( $setting = 'default' ) {
|
||||||
|
|
||||||
|
return "butterbean_{$this->manager->name}_setting_{$this->settings[ $setting ]}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the json array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_json() {
|
||||||
|
$this->to_json();
|
||||||
|
|
||||||
|
return $this->json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
|
||||||
|
$this->json['manager'] = $this->manager->name;
|
||||||
|
$this->json['section'] = $this->section;
|
||||||
|
$this->json['setting'] = $this->setting;
|
||||||
|
$this->json['settings'] = $this->settings;
|
||||||
|
$this->json['name'] = $this->name;
|
||||||
|
$this->json['label'] = $this->label;
|
||||||
|
$this->json['type'] = $this->type;
|
||||||
|
$this->json['description'] = $this->description;
|
||||||
|
$this->json['choices'] = $this->choices;
|
||||||
|
$this->json['active'] = $this->is_active();
|
||||||
|
|
||||||
|
$this->json['value'] = isset( $this->settings[ $this->setting ] ) ? $this->get_value( $this->setting ) : '';
|
||||||
|
$this->json['field_name'] = isset( $this->settings[ $this->setting ] ) ? $this->get_field_name( $this->setting ) : '';
|
||||||
|
|
||||||
|
$this->json['attr'] = '';
|
||||||
|
|
||||||
|
foreach ( $this->get_attr() as $attr => $value ) {
|
||||||
|
$this->json['attr'] .= sprintf( '%s="%s" ', esc_html( $attr ), esc_attr( $value ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the control is active.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_active() {
|
||||||
|
|
||||||
|
$is_active = call_user_func( $this->active_callback, $this );
|
||||||
|
|
||||||
|
return apply_filters( 'butterbean_is_control_active', $is_active, $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default active callback.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function active_callback() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the control should be allowed at all.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function check_capabilities() {
|
||||||
|
|
||||||
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->post_type_supports && ! call_user_func_array( 'post_type_supports', array( get_post_type( $this->manager->post_id ), $this->post_type_supports ) ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->theme_supports && ! call_user_func_array( 'theme_supports', (array) $this->theme_supports ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function print_template() { ?>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-butterbean-control-<?php echo esc_attr( $this->type ); ?>">
|
||||||
|
<?php $this->get_template(); ?>
|
||||||
|
</script>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_template() {
|
||||||
|
butterbean_get_control_template( $this->type );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,550 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Base class for handling managers. Managers are groups of sections, which are groups of
|
||||||
|
* controls + settings. Managers are output as a metabox. This essentially allows
|
||||||
|
* developers to output multiple post meta fields within a single metabox.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base manager class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Manager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of this instance of the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label for the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $label = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post type this manager is used on.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $post_type = 'post';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of the meta box. Accepted values: 'normal', 'advanced', 'side'.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/reference/functions/add_meta_box/
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $context = 'advanced';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priority of the meta box. Accepted values: 'high', 'core', 'default', 'low'.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/reference/functions/add_meta_box/
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $priority = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of sections.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $sections = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of controls.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $controls = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of settings.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $settings = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user role capability required to show the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $capability = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current post type must support to show the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $post_type_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current theme must support to show the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $theme_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the JSON data for the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array()
|
||||||
|
*/
|
||||||
|
public $json = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the post that's being edited.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $post_id = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $name, $args = array() ) {
|
||||||
|
|
||||||
|
foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
|
||||||
|
|
||||||
|
if ( isset( $args[ $key ] ) )
|
||||||
|
$this->$key = $args[ $key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the post type is an array.
|
||||||
|
$this->post_type = (array) $this->post_type;
|
||||||
|
|
||||||
|
// Set the manager name.
|
||||||
|
$this->name = sanitize_key( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts/styles for the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object|string $section
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_section( $section, $args = array() ) {
|
||||||
|
|
||||||
|
if ( ! is_object( $section ) ) {
|
||||||
|
|
||||||
|
$type = isset( $args['type'] ) ? butterbean()->get_section_type( $args['type'] ) : butterbean()->get_section_type( 'default' );
|
||||||
|
|
||||||
|
$section = new $type( $this, $section, $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $this->section_exists( $section->name ) )
|
||||||
|
$this->sections[ $section->name ] = $section;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object|string $control
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_control( $control, $args = array() ) {
|
||||||
|
|
||||||
|
if ( ! is_object( $control ) ) {
|
||||||
|
|
||||||
|
$type = isset( $args['type'] ) ? butterbean()->get_control_type( $args['type'] ) : butterbean()->get_control_type( 'default' );
|
||||||
|
|
||||||
|
$control = new $type( $this, $control, $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $this->control_exists( $control->name ) )
|
||||||
|
$this->controls[ $control->name ] = $control;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object|string $setting
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_setting( $setting, $args = array() ) {
|
||||||
|
|
||||||
|
if ( ! is_object( $setting ) ) {
|
||||||
|
|
||||||
|
$type = isset( $args['type'] ) ? butterbean()->get_setting_type( $args['type'] ) : butterbean()->get_setting_type( 'default' );
|
||||||
|
|
||||||
|
$setting = new $type( $this, $setting, $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $this->setting_exists( $setting->name ) )
|
||||||
|
$this->settings[ $setting->name ] = $setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a control and setting object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @param object|array $control Control object or array of control arguments.
|
||||||
|
* @param object|array $setting Setting object or array of setting arguments.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_field( $name, $control, $setting ) {
|
||||||
|
|
||||||
|
is_object( $control ) ? $this->register_control( $control ) : $this->register_control( $name, $control );
|
||||||
|
is_object( $setting ) ? $this->register_setting( $setting ) : $this->register_setting( $name, $setting );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a section object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_section( $name ) {
|
||||||
|
|
||||||
|
if ( $this->section_exists( $name ) )
|
||||||
|
unset( $this->sections[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a control object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_control( $name ) {
|
||||||
|
|
||||||
|
if ( $this->control_exists( $name ) )
|
||||||
|
unset( $this->controls[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a setting object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_setting( $name ) {
|
||||||
|
|
||||||
|
if ( $this->setting_exists( $name ) )
|
||||||
|
unset( $this->settings[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a control and setting object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister_field( $name ) {
|
||||||
|
|
||||||
|
$this->unregister_control( $name );
|
||||||
|
$this->unregister_setting( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a section object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_section( $name ) {
|
||||||
|
|
||||||
|
return $this->section_exists( $name ) ? $this->sections[ $name ] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a control object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_control( $name ) {
|
||||||
|
|
||||||
|
return $this->control_exists( $name ) ? $this->controls[ $name ] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a setting object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_setting( $name ) {
|
||||||
|
|
||||||
|
return $this->setting_exists( $name ) ? $this->settings[ $name ] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that contains both the control and setting objects.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return object|bool
|
||||||
|
*/
|
||||||
|
public function get_field( $name ) {
|
||||||
|
|
||||||
|
$control = $this->get_control( $name );
|
||||||
|
$setting = $this->get_setting( $name );
|
||||||
|
|
||||||
|
$field = array( 'name' => $name, 'control' => $control, 'setting' => $setting );
|
||||||
|
|
||||||
|
return $control && $setting ? (object) $field : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a section exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function section_exists( $name ) {
|
||||||
|
|
||||||
|
return isset( $this->sections[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a control exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function control_exists( $name ) {
|
||||||
|
|
||||||
|
return isset( $this->controls[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a setting exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setting_exists( $name ) {
|
||||||
|
|
||||||
|
return isset( $this->settings[ $name ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a both a control and setting exist.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function field_exists( $name ) {
|
||||||
|
|
||||||
|
return $this->control_exists( $name ) && $this->setting_exists( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the json array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_json() {
|
||||||
|
$this->to_json();
|
||||||
|
|
||||||
|
return $this->json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the JSON array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
|
||||||
|
$sections_with_controls = array();
|
||||||
|
$blocked_sections = array();
|
||||||
|
|
||||||
|
$this->json['name'] = $this->name;
|
||||||
|
$this->json['type'] = $this->type;
|
||||||
|
|
||||||
|
// Get all sections that have controls.
|
||||||
|
foreach ( $this->controls as $control )
|
||||||
|
$sections_with_controls[] = $control->section;
|
||||||
|
|
||||||
|
$sections_with_controls = array_unique( $sections_with_controls );
|
||||||
|
|
||||||
|
// Get the JSON data for each section.
|
||||||
|
foreach ( $this->sections as $section ) {
|
||||||
|
|
||||||
|
$caps = $section->check_capabilities();
|
||||||
|
|
||||||
|
if ( $caps && in_array( $section->name, $sections_with_controls ) )
|
||||||
|
$this->json['sections'][] = $section->get_json();
|
||||||
|
|
||||||
|
if ( ! $caps )
|
||||||
|
$blocked_sections[] = $section->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the JSON data for each control.
|
||||||
|
foreach ( $this->controls as $control ) {
|
||||||
|
|
||||||
|
if ( $control->check_capabilities() && ! in_array( $control->section, $blocked_sections ) )
|
||||||
|
$this->json['controls'][] = $control->get_json();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves each of the settings for the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function save( $post_id ) {
|
||||||
|
|
||||||
|
if ( ! $this->post_id )
|
||||||
|
$this->post_id = $post_id;
|
||||||
|
|
||||||
|
// Verify the nonce for this manager.
|
||||||
|
if ( ! isset( $_POST["butterbean_{$this->name}"] ) || ! wp_verify_nonce( sanitize_key( wp_unslash($_POST["butterbean_{$this->name}"] ) ), "butterbean_{$this->name}_nonce" ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Loop through each setting and save it.
|
||||||
|
foreach ( $this->settings as $setting )
|
||||||
|
$setting->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the control should be allowed at all.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function check_capabilities() {
|
||||||
|
|
||||||
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->post_type_supports && ! call_user_func_array( 'post_type_supports', array( get_post_type( $this->manager->post_id ), $this->post_type_supports ) ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->theme_supports && ! call_user_func_array( 'theme_supports', (array) $this->theme_supports ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function print_template() { ?>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-butterbean-manager-<?php echo esc_attr( $this->type ); ?>">
|
||||||
|
<?php $this->get_template(); ?>
|
||||||
|
</script>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_template() {
|
||||||
|
butterbean_get_manager_template( $this->type );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,291 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Base class for handling sections. Sections house groups of controls. Multiple sections can
|
||||||
|
* be added to a manager.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base section class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Section {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the project details manager object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
public $manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name/ID of the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dashicons icon for the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $icon = 'dashicons-admin-generic';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label for the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $label = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description for the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $description = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priority (order) the section should be output.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $priority = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of instances created.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access protected
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected static $instance_count = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance of the current section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $instance_number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback function for deciding if a section is active.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var callable
|
||||||
|
*/
|
||||||
|
public $active_callback = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user role capability required to show the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $capability = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current post type must support to show the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $post_type_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current theme must support to show the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $theme_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the JSON data for the manager.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array()
|
||||||
|
*/
|
||||||
|
public $json = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new section object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object $manager
|
||||||
|
* @param string $section
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $name, $args = array() ) {
|
||||||
|
|
||||||
|
foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
|
||||||
|
|
||||||
|
if ( isset( $args[ $key ] ) )
|
||||||
|
$this->$key = $args[ $key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->manager = $manager;
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
// Increment the instance count and set the instance number.
|
||||||
|
self::$instance_count += 1;
|
||||||
|
$this->instance_number = self::$instance_count;
|
||||||
|
|
||||||
|
// Set the active callback function if not set.
|
||||||
|
if ( ! $this->active_callback )
|
||||||
|
$this->active_callback = array( $this, 'active_callback' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts/styles for the section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the json array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_json() {
|
||||||
|
$this->to_json();
|
||||||
|
|
||||||
|
return $this->json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
|
||||||
|
$this->json['manager'] = $this->manager->name;
|
||||||
|
$this->json['name'] = $this->name;
|
||||||
|
$this->json['type'] = $this->type;
|
||||||
|
$this->json['icon'] = preg_match( '/dashicons-/', $this->icon ) ? sprintf( 'dashicons %s', sanitize_html_class( $this->icon ) ) : esc_attr( $this->icon );
|
||||||
|
$this->json['label'] = $this->label;
|
||||||
|
$this->json['description'] = $this->description;
|
||||||
|
$this->json['active'] = $this->is_active();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the section is active.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_active() {
|
||||||
|
|
||||||
|
$is_active = call_user_func( $this->active_callback, $this );
|
||||||
|
|
||||||
|
if ( $is_active )
|
||||||
|
$is_active = $this->check_capabilities();
|
||||||
|
|
||||||
|
return apply_filters( 'butterbean_is_section_active', $is_active, $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default active callback.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function active_callback() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the section should be allowed at all.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function check_capabilities() {
|
||||||
|
|
||||||
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->post_type_supports && ! call_user_func_array( 'post_type_supports', array( get_post_type( $this->manager->post_id ), $this->post_type_supports ) ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->theme_supports && ! call_user_func_array( 'theme_supports', (array) $this->theme_supports ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function print_template() { ?>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-butterbean-section-<?php echo esc_attr( $this->type ); ?>">
|
||||||
|
<?php $this->get_template(); ?>
|
||||||
|
</script>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_template() {
|
||||||
|
butterbean_get_section_template( $this->type );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Base setting class for the fields manager.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base setting class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Setting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the manager object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
public $manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name/ID of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $value = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $default = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitization/Validation callback function.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $sanitize_callback = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user role capability required to save the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $capability = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current post type must support to save the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $post_type_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature that the current theme must support to save the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string|array
|
||||||
|
*/
|
||||||
|
public $theme_supports = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new setting object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object $manager
|
||||||
|
* @param string $cap
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $name, $args = array() ) {
|
||||||
|
|
||||||
|
foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
|
||||||
|
|
||||||
|
if ( isset( $args[ $key ] ) )
|
||||||
|
$this->$key = $args[ $key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->manager = $manager;
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
if ( $this->sanitize_callback )
|
||||||
|
add_filter( "butterbean_{$this->manager->name}_sanitize_{$this->name}", $this->sanitize_callback, 10, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value() {
|
||||||
|
|
||||||
|
$value = get_post_meta( $this->manager->post_id, $this->name, true );
|
||||||
|
|
||||||
|
return ! $value && butterbean()->is_new_post ? $this->default : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the posted value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_posted_value() {
|
||||||
|
|
||||||
|
$value = '';
|
||||||
|
|
||||||
|
if ( isset( $_POST[ $this->get_field_name() ] ) )
|
||||||
|
$value = $_POST[ $this->get_field_name() ];
|
||||||
|
|
||||||
|
return $this->sanitize( $value );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retuns the correct field name for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_field_name() {
|
||||||
|
|
||||||
|
return "butterbean_{$this->manager->name}_setting_{$this->name}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function sanitize( $value ) {
|
||||||
|
|
||||||
|
return apply_filters( "butterbean_{$this->manager->name}_sanitize_{$this->name}", $value, $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function save() {
|
||||||
|
|
||||||
|
if ( ! $this->check_capabilities() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$old_value = $this->get_value();
|
||||||
|
$new_value = $this->get_posted_value();
|
||||||
|
|
||||||
|
// If we have don't have a new value but do have an old one, delete it.
|
||||||
|
if ( ! $new_value && $old_value )
|
||||||
|
delete_post_meta( $this->manager->post_id, $this->name );
|
||||||
|
|
||||||
|
// If the new value doesn't match the old value, set it.
|
||||||
|
else if ( $new_value !== $old_value )
|
||||||
|
update_post_meta( $this->manager->post_id, $this->name, $new_value );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the setting should be saved at all.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function check_capabilities() {
|
||||||
|
|
||||||
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->post_type_supports && ! call_user_func_array( 'post_type_supports', array( get_post_type( $this->manager->post_id ), $this->post_type_supports ) ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->theme_supports && ! call_user_func_array( 'theme_supports', (array) $this->theme_supports ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Multiple checkbox control class. This is for array-type settings, so you'll need
|
||||||
|
* to utilize a setting type that handles arrays. Both the `array` and `multiple`
|
||||||
|
* setting types will do this.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple checkboxes control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_CheckBoxes extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'checkboxes';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['value'] = (array) $this->get_value();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Color control class. This class uses the core WordPress color picker. Expected
|
||||||
|
* values are hex colors. This class also attempts to strip `#` from the hex color.
|
||||||
|
* By design, it's recommended to add the `#` on output.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Color extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'color';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom options to pass to the color picker. Mostly, this is a wrapper for
|
||||||
|
* `iris()`, which is bundled with core WP. However, if they change pickers
|
||||||
|
* in the future, it may correspond to a different script.
|
||||||
|
*
|
||||||
|
* @link http://automattic.github.io/Iris/#options
|
||||||
|
* @link https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $options = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts/styles for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {
|
||||||
|
|
||||||
|
wp_enqueue_script( 'wp-color-picker' );
|
||||||
|
wp_enqueue_style( 'wp-color-picker' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attributes for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_attr() {
|
||||||
|
$attr = parent::get_attr();
|
||||||
|
|
||||||
|
$setting = $this->get_setting();
|
||||||
|
|
||||||
|
$attr['class'] = 'butterbean-color-picker';
|
||||||
|
$attr['type'] = 'text';
|
||||||
|
$attr['maxlength'] = 7;
|
||||||
|
$attr['data-default-color'] = $setting ? $setting->default : '';
|
||||||
|
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
$value = parent::get_value( $setting );
|
||||||
|
|
||||||
|
return ltrim( $value, '#' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['options'] = $this->options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Datetime control class. This class is meant for storing a datetime in the format
|
||||||
|
* of `YYYY-MM-DD HH:MM:SS` or `0000-00-00 00:00:00`. You can set the `$show_time`
|
||||||
|
* property to `false`.
|
||||||
|
*
|
||||||
|
* Note that this control should be used in conjunction with the `datetime` setting
|
||||||
|
* type or another custom class that can handle the datetime.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Datetime control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Datetime extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'datetime';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the time. Note that settings, particularly the
|
||||||
|
* `ButterBean_Setting_Date` class will store the time as `00:00:00` if
|
||||||
|
* no time is provided.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $show_time = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @globl object $wp_locale
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
global $wp_locale;
|
||||||
|
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['show_time'] = $this->show_time;
|
||||||
|
|
||||||
|
$field_name = $this->get_field_name();
|
||||||
|
|
||||||
|
// Get project start/end dates.
|
||||||
|
$date = $this->get_value();
|
||||||
|
|
||||||
|
// Get the year, month, and day.
|
||||||
|
$year = $date ? mysql2date( 'Y', $date, false ) : '';
|
||||||
|
$month = $date ? mysql2date( 'm', $date, false ) : '';
|
||||||
|
$day = $date ? mysql2date( 'd', $date, false ) : '';
|
||||||
|
|
||||||
|
// Get the hour, minute, and second.
|
||||||
|
$hour = $date ? mysql2date( 'H', $date, false ) : '';
|
||||||
|
$minute = $date ? mysql2date( 'i', $date, false ) : '';
|
||||||
|
$second = $date ? mysql2date( 's', $date, false ) : '';
|
||||||
|
|
||||||
|
// Year
|
||||||
|
$this->json['year'] = array(
|
||||||
|
'value' => esc_attr( $year ),
|
||||||
|
'label' => esc_html__( 'Year', 'butterbean' ),
|
||||||
|
'name' => esc_attr( "{$field_name}_year" ),
|
||||||
|
'attr' => sprintf( 'placeholder="%s" size="4" maxlength="4" autocomplete="off"', esc_attr( date_i18n( 'Y' ) ) )
|
||||||
|
);
|
||||||
|
|
||||||
|
// Month
|
||||||
|
$this->json['month'] = array(
|
||||||
|
'value' => esc_attr( $month ),
|
||||||
|
'name' => esc_attr( "{$field_name}_month" ),
|
||||||
|
'label' => esc_html__( 'Month', 'butterbean' ),
|
||||||
|
'choices' => array(
|
||||||
|
array(
|
||||||
|
'num' => '',
|
||||||
|
'label' => ''
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for ( $i = 1; $i < 13; $i = $i +1 ) {
|
||||||
|
|
||||||
|
$monthnum = zeroise( $i, 2 );
|
||||||
|
$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
|
||||||
|
|
||||||
|
$this->json['month']['choices'][] = array(
|
||||||
|
'num' => $monthnum,
|
||||||
|
'label' => $monthtext
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Day
|
||||||
|
$this->json['day'] = array(
|
||||||
|
'value' => esc_attr( $day ),
|
||||||
|
'name' => esc_attr( "{$field_name}_day" ),
|
||||||
|
'label' => esc_html__( 'Day', 'butterbean' ),
|
||||||
|
'attr' => sprintf( 'placeholder="%s" size="2" maxlength="2" autocomplete="off"', esc_attr( date_i18n( 'd' ) ) )
|
||||||
|
);
|
||||||
|
|
||||||
|
// Hour
|
||||||
|
$this->json['hour'] = array(
|
||||||
|
'value' => esc_attr( $hour ),
|
||||||
|
'name' => esc_attr( "{$field_name}_hour" ),
|
||||||
|
'label' => esc_html__( 'Hour', 'butterbean' ),
|
||||||
|
'attr' => 'placeholder="00" size="2" maxlength="2" autocomplete="off"'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Minute
|
||||||
|
$this->json['minute'] = array(
|
||||||
|
'value' => esc_attr( $minute ),
|
||||||
|
'name' => esc_attr( "{$field_name}_minute" ),
|
||||||
|
'label' => esc_html__( 'Minute', 'butterbean' ),
|
||||||
|
'attr' => 'placeholder="00" size="2" maxlength="2" autocomplete="off"'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Second
|
||||||
|
$this->json['second'] = array(
|
||||||
|
'value' => esc_attr( $second ),
|
||||||
|
'name' => esc_attr( "{$field_name}_second" ),
|
||||||
|
'label' => esc_html__( 'Second', 'butterbean' ),
|
||||||
|
'attr' => 'placeholder="00" size="2" maxlength="2" autocomplete="off"'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Excerpt control class. Note that this control isn't meant to be tied to a setting. Core
|
||||||
|
* WP will save the excerpt. Also, make sure to disable the core excerpt metabox if using
|
||||||
|
* this control.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excerpt control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Excerpt extends ButterBean_Control_Textarea {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'excerpt';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attributes for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_attr() {
|
||||||
|
$attr = parent::get_attr();
|
||||||
|
|
||||||
|
$attr['id'] = 'post_excerpt';
|
||||||
|
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the HTML field name for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_field_name( $setting = 'default' ) {
|
||||||
|
return 'post_excerpt';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
return get_post( $this->manager->post_id )->post_excerpt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Underscore.js template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_template() {
|
||||||
|
butterbean_get_control_template( 'textarea' );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Image control class. This control allows users to set an image. It passes the attachment
|
||||||
|
* ID the setting, so you'll need a custom control class if you want to store anything else,
|
||||||
|
* such as the URL or other data.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Image extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'image';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of text labels to use for the media upload frame.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $l10n = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image size to display. If the size isn't found for the image,
|
||||||
|
* the full size of the image will be output.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $size = 'large';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new control object.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param object $manager
|
||||||
|
* @param string $name
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $name, $args = array() ) {
|
||||||
|
parent::__construct( $manager, $name, $args );
|
||||||
|
|
||||||
|
$this->l10n = wp_parse_args(
|
||||||
|
$this->l10n,
|
||||||
|
array(
|
||||||
|
'upload' => esc_html__( 'Add image', 'butterbean' ),
|
||||||
|
'set' => esc_html__( 'Set as image', 'butterbean' ),
|
||||||
|
'choose' => esc_html__( 'Choose image', 'butterbean' ),
|
||||||
|
'change' => esc_html__( 'Change image', 'butterbean' ),
|
||||||
|
'remove' => esc_html__( 'Remove image', 'butterbean' ),
|
||||||
|
'placeholder' => esc_html__( 'No image selected', 'butterbean' )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts/styles for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function enqueue() {
|
||||||
|
|
||||||
|
wp_enqueue_script( 'media-views' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['l10n'] = $this->l10n;
|
||||||
|
$this->json['size'] = $this->size;
|
||||||
|
|
||||||
|
$value = $this->get_value();
|
||||||
|
$image = $alt = '';
|
||||||
|
|
||||||
|
if ( $value ) {
|
||||||
|
$image = wp_get_attachment_image_src( absint( $value ), $this->size );
|
||||||
|
$alt = get_post_meta( absint( $value ), '_wp_attachment_image_alt', true );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->json['src'] = $image ? esc_url( $image[0] ) : '';
|
||||||
|
$this->json['alt'] = $alt ? esc_attr( $alt ) : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Multi-avatars control. This control is for outputting multiple users who can create,
|
||||||
|
* edit, or publish posts of the given post type. Multiple users can be selected. The
|
||||||
|
* data is expected to be an array. This control should be used with a setting type that
|
||||||
|
* handles arrays, such as the built-in `array` or `multiple` types.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multi-avatars control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Multi_Avatars extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'multi-avatars';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['value'] = is_array( $this->get_value() ) ? array_map( 'absint', $this->get_value() ) : array();
|
||||||
|
$this->json['choices'] = array();
|
||||||
|
|
||||||
|
$users = get_users( array( 'role__in' => $this->get_roles() ) );
|
||||||
|
|
||||||
|
foreach ( $users as $user ) {
|
||||||
|
$this->json['choices'][] = array(
|
||||||
|
'id' => $user->ID,
|
||||||
|
'name' => $user->display_name,
|
||||||
|
'avatar' => get_avatar( $user->ID, 70 )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of user roles that are allowed to edit, publish, or create
|
||||||
|
* posts of the given post type.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @global object $wp_roles
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_roles() {
|
||||||
|
global $wp_roles;
|
||||||
|
|
||||||
|
$roles = array();
|
||||||
|
$type = get_post_type_object( get_post_type( $this->manager->post_id ) );
|
||||||
|
|
||||||
|
// Get the post type object caps.
|
||||||
|
$caps = array( $type->cap->edit_posts, $type->cap->publish_posts, $type->cap->create_posts );
|
||||||
|
$caps = array_unique( $caps );
|
||||||
|
|
||||||
|
// Loop through the available roles.
|
||||||
|
foreach ( $wp_roles->roles as $name => $role ) {
|
||||||
|
|
||||||
|
foreach ( $caps as $cap ) {
|
||||||
|
|
||||||
|
// If the role is granted the cap, add it.
|
||||||
|
if ( isset( $role['capabilities'][ $cap ] ) && true === $role['capabilities'][ $cap ] ) {
|
||||||
|
$roles[] = $name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $roles;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Color palette control class. The purpose of this class is to give users a choice
|
||||||
|
* of color palettes. The actual data that is stored is a key of your choosing.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color palette control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Palette extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'palette';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$value = $this->get_value();
|
||||||
|
|
||||||
|
// Make sure the colors have a hash.
|
||||||
|
foreach ( $this->choices as $choice => $palette ) {
|
||||||
|
$this->choices[ $choice ]['colors'] = array_map( 'butterbean_maybe_hash_hex_color', $palette['colors'] );
|
||||||
|
|
||||||
|
$this->choices[ $choice ]['selected'] = $value && $choice === $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->json['choices'] = $this->choices;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Post parent control class. This class is a specialty class meant for use in unique
|
||||||
|
* scenarios where you're not using the core post parent drop-down. This is often the
|
||||||
|
* case with flat post types that have a parent post. This control is not meant to be
|
||||||
|
* used with a setting. Core WP will store the data in the `post.post_parent` field.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post parent control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Parent extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'parent';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The post type to select posts from.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $post_type = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the HTML field name for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_field_name( $setting = 'default' ) {
|
||||||
|
|
||||||
|
return 'post_parent';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
return get_post( $this->manager->post_id )->post_parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$_post = get_post( $this->manager->post_id );
|
||||||
|
|
||||||
|
$posts = get_posts(
|
||||||
|
array(
|
||||||
|
'post_type' => $this->post_type ? $this->post_type : get_post_type( $this->manager->post_id ),
|
||||||
|
'post_status' => 'any',
|
||||||
|
'post__not_in' => array( $this->manager->post_id ),
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'post_parent' => 0,
|
||||||
|
'orderby' => 'title',
|
||||||
|
'order' => 'ASC',
|
||||||
|
'fields' => array( 'ID', 'post_title' )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->json['choices'] = array( array( 'value' => 0, 'label' => '' ) );
|
||||||
|
|
||||||
|
foreach ( $posts as $post )
|
||||||
|
$this->json['choices'][] = array( 'value' => $post->ID, 'label' => $post->post_title );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Radio image control class extends the built-in radio control. This control is
|
||||||
|
* meant for displaying an image instead of the radio fields.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio image control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Radio_Image extends ButterBean_Control_Radio {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'radio-image';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
foreach ( $this->choices as $value => $args )
|
||||||
|
$this->choices[ $value ]['url'] = esc_url( sprintf( $args['url'], get_template_directory_uri(), get_stylesheet_directory_uri() ) );
|
||||||
|
|
||||||
|
$this->json['choices'] = $this->choices;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Radio control class that creates a list of radio inputs to choose from.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Radio extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'radio';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio controls imply that a value should be set. Therefore, we will return
|
||||||
|
* the default if there is no value.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
$value = parent::get_value( $setting );
|
||||||
|
$object = $this->get_setting( $setting );
|
||||||
|
|
||||||
|
return ! $value && $object ? $object->default : $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Select group control class. This works just like a normal select. However, it
|
||||||
|
* allows for `<optgroup>` to be added.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select group control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Select_Group extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'select-group';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$choices = $group = array();
|
||||||
|
|
||||||
|
foreach ( $this->choices as $choice => $maybe_group ) {
|
||||||
|
|
||||||
|
if ( is_array( $maybe_group ) )
|
||||||
|
$group[ $choice ] = $maybe_group;
|
||||||
|
else
|
||||||
|
$choices[ $choice ] = $maybe_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->json['choices'] = $choices;
|
||||||
|
$this->json['group'] = $group;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Textarea control class.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Textarea control class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Control_Textarea extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'textarea';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['value'] = esc_textarea( $this->get_value() );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Helper functions.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for validating booleans before saving them as metadata. If the value is
|
||||||
|
* `true`, we'll return a `1` to be stored as the meta value. Else, we return `false`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param mixed
|
||||||
|
* @return bool|int
|
||||||
|
*/
|
||||||
|
function butterbean_validate_boolean( $value ) {
|
||||||
|
|
||||||
|
return wp_validate_boolean( $value ) ? 1 : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-WP 4.6 function for sanitizing hex colors.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $color
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function butterbean_sanitize_hex_color( $color ) {
|
||||||
|
|
||||||
|
if ( function_exists( 'sanitize_hex_color' ) )
|
||||||
|
return sanitize_hex_color( $color );
|
||||||
|
|
||||||
|
return $color && preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ? $color : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-WP 4.6 function for sanitizing hex colors without a hash.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $color
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function butterbean_sanitize_hex_color_no_hash( $color ) {
|
||||||
|
|
||||||
|
if ( function_exists( 'sanitize_hex_color_no_hash' ) )
|
||||||
|
return sanitize_hex_color_no_hash( $color );
|
||||||
|
|
||||||
|
$color = ltrim( $color, '#' );
|
||||||
|
|
||||||
|
if ( '' === $color )
|
||||||
|
return '';
|
||||||
|
|
||||||
|
return butterbean_sanitize_hex_color( '#' . $color ) ? $color : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-WP 4.6 function for sanitizing a color and adding a hash.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $color
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function butterbean_maybe_hash_hex_color( $color ) {
|
||||||
|
|
||||||
|
if ( function_exists( 'maybe_hash_hex_color' ) )
|
||||||
|
return maybe_hash_hex_color( $color );
|
||||||
|
|
||||||
|
if ( $unhashed = butterbean_sanitize_hex_color_no_hash( $color ) )
|
||||||
|
return '#' . $unhashed;
|
||||||
|
|
||||||
|
return $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Underscore.js templates for managers.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param string $slug
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_get_manager_template( $slug = '' ) {
|
||||||
|
butterbean_get_template( 'manager', $slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Underscore.js templates for navs.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param string $slug
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_get_nav_template( $slug = '' ) {
|
||||||
|
butterbean_get_template( 'nav', $slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Underscore.js templates for sections.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param string $slug
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_get_section_template( $slug = '' ) {
|
||||||
|
butterbean_get_template( 'section', $slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Underscore.js templates for controls.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param string $slug
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_get_control_template( $slug = '' ) {
|
||||||
|
butterbean_get_template( 'control', $slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for getting Underscore.js templates.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param string $name
|
||||||
|
* @param string $slug
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function butterbean_get_template( $name, $slug = '' ) {
|
||||||
|
|
||||||
|
// Allow devs to hook in early to bypass template checking.
|
||||||
|
$located = apply_filters( "butterbean_pre_{$name}_template", '', $slug );
|
||||||
|
|
||||||
|
// If there's no template, let's try to find one.
|
||||||
|
if ( ! $located ) {
|
||||||
|
|
||||||
|
$templates = array();
|
||||||
|
|
||||||
|
if ( $slug )
|
||||||
|
$templates[] = "{$name}-{$slug}.php";
|
||||||
|
|
||||||
|
$templates[] = "{$name}.php";
|
||||||
|
|
||||||
|
// Allow devs to filter the template hierarchy.
|
||||||
|
$templates = apply_filters( "butterbean_{$name}_template_hierarchy", $templates, $slug );
|
||||||
|
|
||||||
|
// Loop through the templates and locate one.
|
||||||
|
foreach ( $templates as $template ) {
|
||||||
|
|
||||||
|
if ( file_exists( butterbean()->tmpl_path . $template ) ) {
|
||||||
|
$located = butterbean()->tmpl_path . $template;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow devs to filter the final template.
|
||||||
|
$located = apply_filters( "butterbean_{$name}_template", $located, $slug );
|
||||||
|
|
||||||
|
// Load the template.
|
||||||
|
if ( $located )
|
||||||
|
require( $located );
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Setting class for storing a single meta value as an array.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array setting class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Setting_Array extends ButterBean_Setting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'array';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param array $value
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sanitize( $values ) {
|
||||||
|
|
||||||
|
$multi_values = $values && ! is_array( $values ) ? explode( ',', $values ) : $values;
|
||||||
|
|
||||||
|
return $multi_values ? array_map( array( $this, 'map' ), $multi_values ) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for sanitizing each value of the array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param mixed $value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function map( $value ) {
|
||||||
|
|
||||||
|
return apply_filters( "butterbean_{$this->manager->name}_sanitize_{$this->name}", $value, $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function save() {
|
||||||
|
|
||||||
|
if ( ! $this->check_capabilities() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$old_values = $this->get_value();
|
||||||
|
$new_values = $this->get_posted_value();
|
||||||
|
|
||||||
|
// If there's an array of posted values, set them.
|
||||||
|
if ( $new_values && is_array( $new_values ) && $new_values !== $old_values )
|
||||||
|
return update_post_meta( $this->manager->post_id, $this->name, $new_values );
|
||||||
|
|
||||||
|
// If no array of posted values but we have old values, delete them.
|
||||||
|
else if ( $old_values && ! $new_values )
|
||||||
|
return delete_post_meta( $this->manager->post_id, $this->name );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Datetime setting class. This is meant to be used in conjunction with the built-in
|
||||||
|
* `ButterBean_Datetime_Control` or a sub-class that passes the appropriate values.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @subpackage Admin
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date setting class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Setting_Datetime extends ButterBean_Setting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'datetime';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the posted value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_posted_value() {
|
||||||
|
|
||||||
|
$field_name = $this->get_field_name();
|
||||||
|
|
||||||
|
// Get the posted date.
|
||||||
|
$year = ! empty( $_POST[ "{$field_name}_year" ] ) ? zeroise( absint( $_POST[ "{$field_name}_year" ] ), 4 ) : '';
|
||||||
|
$month = ! empty( $_POST[ "{$field_name}_month" ] ) ? zeroise( absint( $_POST[ "{$field_name}_month" ] ), 2 ) : '';
|
||||||
|
$day = ! empty( $_POST[ "{$field_name}_day" ] ) ? zeroise( absint( $_POST[ "{$field_name}_day" ] ), 2 ) : '';
|
||||||
|
|
||||||
|
// Get the posted time.
|
||||||
|
$hour = ! empty( $_POST[ "{$field_name}_hour" ] ) ? $this->validate_hour( $_POST[ "{$field_name}_hour" ] ) : '00';
|
||||||
|
$minute = ! empty( $_POST[ "{$field_name}_minute" ] ) ? $this->validate_minute( $_POST[ "{$field_name}_minute" ] ) : '00';
|
||||||
|
$second = ! empty( $_POST[ "{$field_name}_second" ] ) ? $this->validate_second( $_POST[ "{$field_name}_second" ] ) : '00';
|
||||||
|
|
||||||
|
$date = "{$year}-{$month}-{$day}";
|
||||||
|
$time = "{$hour}:{$minute}:{$second}";
|
||||||
|
|
||||||
|
if ( $year && $month && $day && wp_checkdate( absint( $month ), absint( $day ), absint( $year ), $date ) )
|
||||||
|
return "{$date} {$time}";
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the hour.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param int|string $hour
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function validate_hour( $hour ) {
|
||||||
|
|
||||||
|
$hour = absint( $hour );
|
||||||
|
|
||||||
|
return $hour < 0 || $hour > 23 ? zeroise( $hour, 2 ) : '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the minute.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param int|string $minute
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function validate_minute( $minute ) {
|
||||||
|
|
||||||
|
$minute = absint( $minute );
|
||||||
|
|
||||||
|
return $minute < 0 || $minute > 59 ? zeroise( $minute, 2 ) : '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the second.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param int|string $second
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function validate_second( $second ) {
|
||||||
|
|
||||||
|
$second = absint( $second );
|
||||||
|
|
||||||
|
return $second < 0 || $second > 59 ? zeroise( $second, 2 ) : '00';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Setting class for storing multiple post meta values for a single key.
|
||||||
|
*
|
||||||
|
* @package ButterBean
|
||||||
|
* @author Justin Tadlock <justin@justintadlock.com>
|
||||||
|
* @copyright Copyright (c) 2015-2016, Justin Tadlock
|
||||||
|
* @link https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple setting class.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class ButterBean_Setting_Multiple extends ButterBean_Setting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'multiple';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value() {
|
||||||
|
|
||||||
|
return get_post_meta( $this->manager->post_id, $this->name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param array $value
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sanitize( $values ) {
|
||||||
|
|
||||||
|
$multi_values = $values && ! is_array( $values ) ? explode( ',', $values ) : $values;
|
||||||
|
|
||||||
|
return $multi_values ? array_map( array( $this, 'map' ), $multi_values ) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for sanitizing each value of the array.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param mixed $value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function map( $value ) {
|
||||||
|
|
||||||
|
return apply_filters( "butterbean_{$this->manager->name}_sanitize_{$this->name}", $value, $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the value of the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function save() {
|
||||||
|
|
||||||
|
if ( ! $this->check_capabilities() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$old_values = $this->get_value();
|
||||||
|
$new_values = $this->get_posted_value();
|
||||||
|
|
||||||
|
// If there's an array of posted values, set them.
|
||||||
|
if ( is_array( $new_values ) )
|
||||||
|
$this->set_values( $new_values, $old_values );
|
||||||
|
|
||||||
|
// If no array of posted values but we have old values, delete them.
|
||||||
|
else if ( $old_values )
|
||||||
|
$this->delete_values();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loops through new and old meta values and updates.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param array $new_values
|
||||||
|
* @param array $old_values
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set_values( $new_values, $old_values ) {
|
||||||
|
|
||||||
|
foreach ( $new_values as $new ) {
|
||||||
|
|
||||||
|
if ( ! in_array( $new, $old_values ) )
|
||||||
|
$this->add_value( $new );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $old_values as $old ) {
|
||||||
|
|
||||||
|
if ( ! in_array( $old, $new_values ) )
|
||||||
|
$this->remove_value( $old );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes old meta values.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete_values() {
|
||||||
|
|
||||||
|
return delete_post_meta( $this->manager->post_id, $this->name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a single meta value.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param mixed $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function add_value( $value ) {
|
||||||
|
|
||||||
|
return add_post_meta( $this->manager->post_id, $this->name, $value, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a single meta value.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param mixed $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function remove_value( $value ) {
|
||||||
|
|
||||||
|
return delete_post_meta( $this->manager->post_id, $this->name, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,875 @@
|
|||||||
|
window.butterbean = window.butterbean || {};
|
||||||
|
|
||||||
|
( function() {
|
||||||
|
|
||||||
|
// Bail if we don't have the JSON, which is passed in via `wp_localize_script()`.
|
||||||
|
if ( _.isUndefined( butterbean_data ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our global object. The `butterbean` object is just a wrapper to house everything
|
||||||
|
* in a single namespace.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var api = butterbean = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Houses the manager, section, and control views based on the `type`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
views : { managers : {}, sections : {}, controls : {} },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Houses the manager, section, and control templates based on the `type`.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
templates : { managers : {}, sections : {}, controls : {} }
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new manager view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.register_manager = function( type, args ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type )
|
||||||
|
this.managers[ type ] = this.managers.default.extend( args );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a manager view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
api.views.get_manager = function( type ) {
|
||||||
|
|
||||||
|
if ( this.manager_exists( type ) )
|
||||||
|
return this.managers[ type ];
|
||||||
|
|
||||||
|
return this.managers.default;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a manager view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.unregister_manager = function( type ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type && this.manager_exists( type ) )
|
||||||
|
delete this.managers[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a manager view exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.views.manager_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.managers.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new section view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.register_section = function( type, args ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type )
|
||||||
|
this.sections[ type ] = this.sections.default.extend( args );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a section view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
api.views.get_section = function( type ) {
|
||||||
|
|
||||||
|
if ( this.section_exists( type ) )
|
||||||
|
return this.sections[ type ];
|
||||||
|
|
||||||
|
return this.sections.default;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a section view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.unregister_section = function( type ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type && this.section_exists( type ) )
|
||||||
|
delete this.sections[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a section view exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.views.section_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.sections.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new control view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.register_control = function( type, args ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type )
|
||||||
|
this.controls[ type ] = this.controls.default.extend( args );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a control view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
api.views.get_control = function( type ) {
|
||||||
|
|
||||||
|
if ( this.control_exists( type ) )
|
||||||
|
return this.controls[ type ];
|
||||||
|
|
||||||
|
return this.controls.default;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a control view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.views.unregister_control = function( type ) {
|
||||||
|
|
||||||
|
if ( 'default' !== type && this.control_exists( type ) )
|
||||||
|
delete this.controls[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a control view exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.views.control_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.controls.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new manager template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.register_manager = function( type ) {
|
||||||
|
|
||||||
|
this.managers[ type ] = wp.template( 'butterbean-manager-' + type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a manager template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return function
|
||||||
|
*/
|
||||||
|
api.templates.get_manager = function( type ) {
|
||||||
|
|
||||||
|
return this.manager_exists( type ) ? this.managers[ type ] : false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a manager template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.unregister_manager = function( type ) {
|
||||||
|
|
||||||
|
if ( this.manager_exists( type ) )
|
||||||
|
delete this.managers[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a manager template exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.templates.manager_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.managers.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new section template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.register_section = function( type ) {
|
||||||
|
|
||||||
|
this.sections[ type ] = wp.template( 'butterbean-section-' + type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a section template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return function
|
||||||
|
*/
|
||||||
|
api.templates.get_section = function( type ) {
|
||||||
|
|
||||||
|
return this.section_exists( type ) ? this.sections[ type ] : false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a section template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.unregister_section = function( type ) {
|
||||||
|
|
||||||
|
if ( this.section_exists( type ) )
|
||||||
|
delete this.sections[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a section template exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.templates.section_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.sections.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new control template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @param object $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.register_control = function( type ) {
|
||||||
|
|
||||||
|
this.controls[ type ] = wp.template( 'butterbean-control-' + type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a control template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return function
|
||||||
|
*/
|
||||||
|
api.templates.get_control = function( type ) {
|
||||||
|
|
||||||
|
return this.control_exists( type ) ? this.controls[ type ] : false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a control template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.templates.unregister_control = function( type ) {
|
||||||
|
|
||||||
|
if ( this.control_exists( type ) )
|
||||||
|
delete this.controls[ type ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a control template exists.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
api.templates.control_exists = function( type ) {
|
||||||
|
|
||||||
|
return this.controls.hasOwnProperty( type );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders our managers, sections, and controls.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
api.render = function() {
|
||||||
|
|
||||||
|
// Loop through each of the managers and render their api.views.
|
||||||
|
_.each( butterbean_data.managers, function( data ) {
|
||||||
|
|
||||||
|
// Create a new manager model with the JSON data for the manager.
|
||||||
|
var manager = new Manager( data );
|
||||||
|
|
||||||
|
// Get the manager view callback.
|
||||||
|
var callback = api.views.get_manager( data.type );
|
||||||
|
|
||||||
|
// Create a new manager view.
|
||||||
|
var view = new callback( { model : manager } );
|
||||||
|
|
||||||
|
// Get the meta box element.
|
||||||
|
var metabox = document.getElementById( 'butterbean-ui-' + manager.get( 'name' ) );
|
||||||
|
|
||||||
|
// Add the `.butterbean-ui` class to the meta box.
|
||||||
|
metabox.className += ' butterbean-ui';
|
||||||
|
|
||||||
|
// Render the manager view.
|
||||||
|
metabox.querySelector( '.inside' ).appendChild( view.render().el );
|
||||||
|
|
||||||
|
// Render the manager subviews.
|
||||||
|
view.subview_render();
|
||||||
|
|
||||||
|
// Call the view's ready method.
|
||||||
|
view.ready();
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
/* === Templates === */
|
||||||
|
|
||||||
|
// Nav template.
|
||||||
|
var nav_template = wp.template( 'butterbean-nav' );
|
||||||
|
|
||||||
|
/* === Models === */
|
||||||
|
|
||||||
|
// Manager model (each manager is housed within a meta box).
|
||||||
|
var Manager = Backbone.Model.extend( {
|
||||||
|
defaults : {
|
||||||
|
name : '',
|
||||||
|
type : '',
|
||||||
|
sections : {},
|
||||||
|
controls : {}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Section model (each section belongs to a manager).
|
||||||
|
var Section = Backbone.Model.extend( {
|
||||||
|
defaults : {
|
||||||
|
name : '',
|
||||||
|
type : '',
|
||||||
|
label : '',
|
||||||
|
description : '',
|
||||||
|
icon : '',
|
||||||
|
manager : '',
|
||||||
|
active : '',
|
||||||
|
selected : false
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Control model (each control belongs to a manager and section).
|
||||||
|
var Control = Backbone.Model.extend( {
|
||||||
|
defaults : {
|
||||||
|
name : '',
|
||||||
|
type : '',
|
||||||
|
label : '',
|
||||||
|
description : '',
|
||||||
|
icon : '',
|
||||||
|
value : '',
|
||||||
|
choices : {},
|
||||||
|
attr : '',
|
||||||
|
active : '',
|
||||||
|
manager : '',
|
||||||
|
section : '',
|
||||||
|
setting : ''
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* === Collections === */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores our collection of section models.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access private
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var Sections = Backbone.Collection.extend( {
|
||||||
|
model : Section
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* === Views === */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default manager view. Other views can extend this using the
|
||||||
|
* `butterbean.views.register_manager()` function.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
api.views.managers[ 'default' ] = Backbone.View.extend( {
|
||||||
|
|
||||||
|
// Wrapper element for the manager view.
|
||||||
|
tagName : 'div',
|
||||||
|
|
||||||
|
// Adds some custom attributes to the wrapper.
|
||||||
|
attributes : function() {
|
||||||
|
return {
|
||||||
|
'id' : 'butterbean-manager-' + this.model.get( 'name' ),
|
||||||
|
'class' : 'butterbean-manager butterbean-manager-' + this.model.get( 'type' )
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Initializes the view.
|
||||||
|
initialize : function() {
|
||||||
|
|
||||||
|
var type = this.model.get( 'type' );
|
||||||
|
|
||||||
|
// If there's not yet a template for this manager type, create it.
|
||||||
|
if ( ! api.templates.manager_exists( type ) )
|
||||||
|
api.templates.register_manager( type );
|
||||||
|
|
||||||
|
// Get the manager template.
|
||||||
|
this.template = api.templates.get_manager( type );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Renders the manager.
|
||||||
|
render : function() {
|
||||||
|
this.el.innerHTML = this.template( this.model.toJSON() );
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Renders the manager's sections and controls.
|
||||||
|
// Important! This may change drastically in the future, possibly even
|
||||||
|
// taken out of the manager view altogether. It's for this reason that
|
||||||
|
// it's not recommended to create custom views for managers right now.
|
||||||
|
subview_render : function() {
|
||||||
|
|
||||||
|
// Create a new section collection.
|
||||||
|
var sections = new Sections();
|
||||||
|
|
||||||
|
// Loop through each section and add it to the collection.
|
||||||
|
_.each( this.model.get( 'sections' ), function( data ) {
|
||||||
|
|
||||||
|
sections.add( new Section( data ) );
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Loop through each section in the collection and render its view.
|
||||||
|
sections.forEach( function( section, i ) {
|
||||||
|
|
||||||
|
// Create a new nav item view for the section.
|
||||||
|
var nav_view = new Nav_View( { model : section } );
|
||||||
|
|
||||||
|
// Render the nav item view.
|
||||||
|
document.querySelector( '#butterbean-ui-' + section.get( 'manager' ) + ' .butterbean-nav' ).appendChild( nav_view.render().el );
|
||||||
|
|
||||||
|
// Get the section view callback.
|
||||||
|
var callback = api.views.get_section( section.attributes.type );
|
||||||
|
|
||||||
|
// Create a new section view.
|
||||||
|
var view = new callback( { model : section } );
|
||||||
|
|
||||||
|
// Render the section view.
|
||||||
|
document.querySelector( '#butterbean-ui-' + section.get( 'manager' ) + ' .butterbean-content' ).appendChild( view.render().el );
|
||||||
|
|
||||||
|
// Call the section view's ready method.
|
||||||
|
view.ready();
|
||||||
|
|
||||||
|
// If the first model, set it to selected.
|
||||||
|
section.set( 'selected', 0 === i );
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
// Loop through each control for the manager and render its view.
|
||||||
|
_.each( this.model.get( 'controls' ), function( data ) {
|
||||||
|
|
||||||
|
// Create a new control model.
|
||||||
|
var control = new Control( data );
|
||||||
|
|
||||||
|
// Get the control view callback.
|
||||||
|
var callback = api.views.get_control( data.type );
|
||||||
|
|
||||||
|
// Create a new control view.
|
||||||
|
var view = new callback( { model : control } );
|
||||||
|
|
||||||
|
// Render the view.
|
||||||
|
document.getElementById( 'butterbean-' + control.get( 'manager' ) + '-section-' + control.get( 'section' ) ).appendChild( view.render().el );
|
||||||
|
|
||||||
|
// Call the view's ready method.
|
||||||
|
view.ready();
|
||||||
|
} );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Function that is executed *after* the view has been rendered.
|
||||||
|
// This is meant to be overwritten in sub-views.
|
||||||
|
ready : function() {}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default section view. Other views can extend this using the
|
||||||
|
* `butterbean.views.register_section()` function.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
api.views.sections[ 'default' ] = Backbone.View.extend( {
|
||||||
|
|
||||||
|
// Wrapper element for the section.
|
||||||
|
tagName : 'div',
|
||||||
|
|
||||||
|
// Adds custom attributes for the section wrapper.
|
||||||
|
attributes : function() {
|
||||||
|
return {
|
||||||
|
'id' : 'butterbean-' + this.model.get( 'manager' ) + '-section-' + this.model.get( 'name' ),
|
||||||
|
'class' : 'butterbean-section butterbean-section-' + this.model.get( 'type' ),
|
||||||
|
'aria-hidden' : ! this.model.get( 'selected' )
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Initializes the view.
|
||||||
|
initialize : function() {
|
||||||
|
|
||||||
|
// Add an event for when the model changes.
|
||||||
|
this.model.on( 'change', this.onchange, this );
|
||||||
|
|
||||||
|
// Get the section type.
|
||||||
|
var type = this.model.get( 'type' );
|
||||||
|
|
||||||
|
// If there's no template for this section type, create it.
|
||||||
|
if ( ! api.templates.section_exists( type ) )
|
||||||
|
api.templates.register_section( type );
|
||||||
|
|
||||||
|
// Gets the section template.
|
||||||
|
this.template = api.templates.get_section( type );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Renders the section.
|
||||||
|
render : function() {
|
||||||
|
|
||||||
|
// Only render template if model is active.
|
||||||
|
if ( this.model.get( 'active' ) )
|
||||||
|
this.el.innerHTML = this.template( this.model.toJSON() );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when the model changes.
|
||||||
|
onchange : function() {
|
||||||
|
|
||||||
|
// Set the view's `aria-hidden` attribute based on whether the model is selected.
|
||||||
|
this.el.setAttribute( 'aria-hidden', ! this.model.get( 'selected' ) );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Function that is executed *after* the view has been rendered.
|
||||||
|
// This is meant to be overwritten in sub-views.
|
||||||
|
ready : function() {}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The nav item view for each section.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var Nav_View = Backbone.View.extend( {
|
||||||
|
|
||||||
|
// Sets the template used.
|
||||||
|
template : nav_template,
|
||||||
|
|
||||||
|
// Wrapper element for the nav item.
|
||||||
|
tagName : 'li',
|
||||||
|
|
||||||
|
// Sets some custom attributes for the nav item wrapper.
|
||||||
|
attributes : function() {
|
||||||
|
return {
|
||||||
|
'aria-selected' : this.model.get( 'selected' )
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Initializes the nav item view.
|
||||||
|
initialize : function() {
|
||||||
|
this.model.on( 'change', this.render, this );
|
||||||
|
this.model.on( 'change', this.onchange, this );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Renders the nav item.
|
||||||
|
render : function() {
|
||||||
|
|
||||||
|
// Only render template if model is active.
|
||||||
|
if ( this.model.get( 'active' ) )
|
||||||
|
this.el.innerHTML = this.template( this.model.toJSON() );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Custom events.
|
||||||
|
events : {
|
||||||
|
'click a' : 'onselect'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when the section model changes.
|
||||||
|
onchange : function() {
|
||||||
|
|
||||||
|
// Set the `aria-selected` attibute based on the model selected state.
|
||||||
|
this.el.setAttribute( 'aria-selected', this.model.get( 'selected' ) );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when the link for the nav item is clicked.
|
||||||
|
onselect : function( event ) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Loop through each of the models in the collection and set them to inactive.
|
||||||
|
_.each( this.model.collection.models, function( m ) {
|
||||||
|
|
||||||
|
m.set( 'selected', false );
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
// Set this view's model to selected.
|
||||||
|
this.model.set( 'selected', true );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default control view. Other views can extend this using the
|
||||||
|
* `butterbean.views.register_control()` function.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
api.views.controls[ 'default' ] = Backbone.View.extend( {
|
||||||
|
|
||||||
|
// Wrapper element for the control.
|
||||||
|
tagName : 'div',
|
||||||
|
|
||||||
|
// Custom attributes for the control wrapper.
|
||||||
|
attributes : function() {
|
||||||
|
return {
|
||||||
|
'id' : 'butterbean-control-' + this.model.get( 'name' ),
|
||||||
|
'class' : 'butterbean-control butterbean-control-' + this.model.get( 'type' )
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Initiazlies the control view.
|
||||||
|
initialize : function() {
|
||||||
|
var type = this.model.get( 'type' );
|
||||||
|
|
||||||
|
// Only add a new control template if we have a different control type.
|
||||||
|
if ( ! api.templates.control_exists( type ) )
|
||||||
|
api.templates.register_control( type );
|
||||||
|
|
||||||
|
// Get the control template.
|
||||||
|
this.template = api.templates.get_control( type );
|
||||||
|
|
||||||
|
// Bind changes so that the view is re-rendered when the model changes.
|
||||||
|
_.bindAll( this, 'render' );
|
||||||
|
this.model.bind( 'change', this.render );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Renders the control template.
|
||||||
|
render : function() {
|
||||||
|
|
||||||
|
// Only render template if model is active.
|
||||||
|
if ( this.model.get( 'active' ) )
|
||||||
|
this.el.innerHTML = this.template( this.model.toJSON() );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Function that is executed *after* the view has been rendered.
|
||||||
|
// This is meant to be overwritten in sub-views.
|
||||||
|
ready : function() {}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the color control view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
api.views.register_control( 'color', {
|
||||||
|
|
||||||
|
// Calls the core WP color picker for the control's input.
|
||||||
|
ready : function() {
|
||||||
|
|
||||||
|
var options = this.model.attributes.options;
|
||||||
|
|
||||||
|
jQuery( this.$el ).find( '.butterbean-color-picker' ).wpColorPicker( options );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the color palette view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
api.views.register_control( 'palette', {
|
||||||
|
|
||||||
|
// Adds custom events.
|
||||||
|
events : {
|
||||||
|
'change input' : 'onselect'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when one of the color palette's value has changed.
|
||||||
|
// These are radio inputs.
|
||||||
|
onselect : function() {
|
||||||
|
|
||||||
|
// Get the value of the input.
|
||||||
|
var value = document.querySelector( '#' + this.el.id + ' input:checked' ).getAttribute( 'value' );
|
||||||
|
|
||||||
|
// Get all choices.
|
||||||
|
var choices = this.model.get( 'choices' );
|
||||||
|
|
||||||
|
// Loop through choices and change the selected value.
|
||||||
|
_.each( choices, function( choice, key ) {
|
||||||
|
choice.selected = key === value;
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Because `choices` is an array, it's not recognized as a change. So, we
|
||||||
|
// have to manually trigger a change here so that the view gets re-rendered.
|
||||||
|
this.model.set( 'choices', choices ).trigger( 'change', this.model );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the image control view.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
api.views.register_control( 'image', {
|
||||||
|
|
||||||
|
// Adds custom events.
|
||||||
|
events : {
|
||||||
|
'click .butterbean-add-media' : 'showmodal',
|
||||||
|
'click .butterbean-change-media' : 'showmodal',
|
||||||
|
'click .butterbean-remove-media' : 'removemedia'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when the show modal button is clicked.
|
||||||
|
showmodal : function() {
|
||||||
|
|
||||||
|
|
||||||
|
// If we already have a media modal, open it.
|
||||||
|
if ( ! _.isUndefined( this.media_modal ) ) {
|
||||||
|
|
||||||
|
this.media_modal.open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new media modal.
|
||||||
|
this.media_modal = wp.media( {
|
||||||
|
frame : 'select',
|
||||||
|
multiple : false,
|
||||||
|
editing : true,
|
||||||
|
title : this.model.get( 'l10n' ).choose,
|
||||||
|
library : { type : 'image' },
|
||||||
|
button : { text: this.model.get( 'l10n' ).set }
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Runs when an image is selected in the media modal.
|
||||||
|
this.media_modal.on( 'select', function() {
|
||||||
|
|
||||||
|
// Gets the JSON data for the first selection.
|
||||||
|
var media = this.media_modal.state().get( 'selection' ).first().toJSON();
|
||||||
|
|
||||||
|
// Size of image to display.
|
||||||
|
var size = this.model.attributes.size;
|
||||||
|
|
||||||
|
// Updates the model for the view.
|
||||||
|
this.model.set( {
|
||||||
|
src : media.sizes[ size ] ? media.sizes[ size ]['url'] : media.url,
|
||||||
|
alt : media.alt,
|
||||||
|
value : media.id
|
||||||
|
} );
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
// Opens the media modal.
|
||||||
|
this.media_modal.open();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Executed when the remove media button is clicked.
|
||||||
|
removemedia : function() {
|
||||||
|
|
||||||
|
// Updates the model for the view.
|
||||||
|
this.model.set( { src : '', alt : '', value : '' } );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
}() );
|
||||||
1
wp-content/plugins/attesa-extra/metabox/butterbean/js/butterbean.min.js
vendored
Normal file
1
wp-content/plugins/attesa-extra/metabox/butterbean/js/butterbean.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,11 @@
|
|||||||
|
( function() {
|
||||||
|
butterbean.views.register_control( 'rgba-color', {
|
||||||
|
|
||||||
|
ready : function() {
|
||||||
|
|
||||||
|
var options = this.model.attributes.options;
|
||||||
|
|
||||||
|
jQuery( this.$el ).find( '.butterbean-color-picker-alpha' ).wpColorPicker( options );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}() );
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
/* global Color */
|
||||||
|
( function() {
|
||||||
|
|
||||||
|
// Variable for some backgrounds
|
||||||
|
var alphaImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite Color to enable support for rbga colors.
|
||||||
|
*/
|
||||||
|
Color.fn.toString = function() {
|
||||||
|
var hex,
|
||||||
|
i;
|
||||||
|
|
||||||
|
if ( this._alpha < 1 ) {
|
||||||
|
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
|
||||||
|
}
|
||||||
|
|
||||||
|
hex = parseInt( this._color, 10 ).toString( 16 );
|
||||||
|
|
||||||
|
if ( this.error ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hex.length < 6 ) {
|
||||||
|
for ( i = 6 - hex.length - 1; i >= 0; i-- ) {
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '#' + hex;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite iris
|
||||||
|
*/
|
||||||
|
jQuery.widget( 'a8c.iris', jQuery.a8c.iris, {
|
||||||
|
_create: function() {
|
||||||
|
this._super();
|
||||||
|
|
||||||
|
// Global option for check is mode rbga is enabled
|
||||||
|
this.options.alpha = this.element.data( 'alpha' ) || false;
|
||||||
|
|
||||||
|
// Is not input disabled
|
||||||
|
if ( ! this.element.is( ':input' ) ) {
|
||||||
|
this.options.alpha = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
|
||||||
|
var self = this,
|
||||||
|
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
|
||||||
|
aContainer = jQuery( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
|
||||||
|
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
|
||||||
|
controls = {
|
||||||
|
aContainer: aContainer,
|
||||||
|
aSlider: aSlider
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery( self.picker ).parents( '.wp-picker-container' ).addClass( 'wp-picker-alpha-container' );
|
||||||
|
|
||||||
|
self.options.customWidth = 100;
|
||||||
|
if ( 'undefined' !== typeof self.element.data( 'custom-width' ) ) {
|
||||||
|
self.options.customWidth = parseInt( self.element.data( 'custom-width' ), 10 ) || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default width for input reset
|
||||||
|
self.options.defaultWidth = self.element.width();
|
||||||
|
|
||||||
|
// Update width for input
|
||||||
|
if ( self._color._alpha < 1 || self._color.toString().indexOf( 'rgb' ) !== 1 ) {
|
||||||
|
self.element.width( parseInt( self.options.defaultWidth + self.options.customWidth, 10 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push new controls
|
||||||
|
jQuery.each( controls, function( k, v ) {
|
||||||
|
self.controls[ k ] = v;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Change size strip and add margin for sliders
|
||||||
|
self.controls.square.css({ 'margin-right': '0' });
|
||||||
|
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
|
||||||
|
stripsMargin = emptyWidth / 6,
|
||||||
|
stripsWidth = ( emptyWidth / 2 ) - stripsMargin;
|
||||||
|
|
||||||
|
jQuery.each( [ 'aContainer', 'strip' ], function( k, v ) {
|
||||||
|
self.controls[ v ].width( stripsWidth ).css({ 'margin-left': stripsMargin + 'px' });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add new slider
|
||||||
|
self._initControls();
|
||||||
|
|
||||||
|
// For updated widget
|
||||||
|
self._change();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_initControls: function() {
|
||||||
|
this._super();
|
||||||
|
|
||||||
|
if ( this.options.alpha ) {
|
||||||
|
var self = this,
|
||||||
|
controls = self.controls;
|
||||||
|
|
||||||
|
controls.aSlider.slider({
|
||||||
|
orientation: 'vertical',
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
step: 1,
|
||||||
|
value: parseInt( self._color._alpha * 100, 10 ),
|
||||||
|
slide: function( event, ui ) {
|
||||||
|
|
||||||
|
// Update alpha value
|
||||||
|
self._color._alpha = parseFloat( ui.value / 100 );
|
||||||
|
self._change.apply( self, arguments );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_change: function() {
|
||||||
|
this._super();
|
||||||
|
var self = this,
|
||||||
|
reset;
|
||||||
|
|
||||||
|
if ( this.options.alpha ) {
|
||||||
|
var controls = self.controls,
|
||||||
|
alpha = parseInt( self._color._alpha * 100, 10 ),
|
||||||
|
color = self._color.toRgb(),
|
||||||
|
defaultWidth = self.options.defaultWidth,
|
||||||
|
customWidth = self.options.customWidth,
|
||||||
|
target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' ),
|
||||||
|
gradient = [
|
||||||
|
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
|
||||||
|
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate background slider alpha, only for CSS3 old browser fuck!! :)
|
||||||
|
controls.aContainer.css({ 'background': 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + alphaImage + ')' });
|
||||||
|
|
||||||
|
if ( target.hasClass( 'wp-picker-open' ) ) {
|
||||||
|
// Update alpha value
|
||||||
|
controls.aSlider.slider( 'value', alpha );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
|
||||||
|
* and change input width for view all value
|
||||||
|
*/
|
||||||
|
if ( self._color._alpha < 1 ) {
|
||||||
|
var style = controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' );
|
||||||
|
|
||||||
|
controls.strip.attr( 'style', style );
|
||||||
|
|
||||||
|
self.element.width( parseInt( defaultWidth + customWidth, 10 ) );
|
||||||
|
} else {
|
||||||
|
self.element.width( defaultWidth );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reset = self.element.data( 'reset-alpha' ) || false;
|
||||||
|
if ( reset ) {
|
||||||
|
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
|
||||||
|
self._color._alpha = 1;
|
||||||
|
self.active = 'external';
|
||||||
|
self._change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_addInputListeners: function( input ) {
|
||||||
|
var self = this,
|
||||||
|
debounceTimeout = 100,
|
||||||
|
callback;
|
||||||
|
|
||||||
|
callback = function( event ) {
|
||||||
|
var color = new Color( input.val() ),
|
||||||
|
val = input.val();
|
||||||
|
|
||||||
|
input.removeClass( 'iris-error' );
|
||||||
|
|
||||||
|
// We gave a bad color.
|
||||||
|
if ( color.error ) {
|
||||||
|
|
||||||
|
// Don't error on an empty input.
|
||||||
|
if ( '' !== val ) {
|
||||||
|
input.addClass( 'iris-error' );
|
||||||
|
}
|
||||||
|
} else if ( color.toString() !== self._color.toString() ) {
|
||||||
|
|
||||||
|
// Let's not do this on keyup for hex shortcodes.
|
||||||
|
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) ) {
|
||||||
|
self._setOption( 'color', color.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
|
||||||
|
|
||||||
|
// If we initialized hidden, show on first focus. The rest is up to you.
|
||||||
|
if ( self.options.hide ) {
|
||||||
|
input.one( 'focus', function() {
|
||||||
|
self.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_addPalettes: function() {
|
||||||
|
var container = jQuery( '<div class="iris-palette-container" />' ),
|
||||||
|
palette = jQuery( '<a class="iris-palette" tabindex="0" />' ),
|
||||||
|
colors = ['#000000', '#ffffff', '#f44336', '#E91E63', '#03A9F4', '#00BCD4', '#8BC34A', '#FFEB3B'];
|
||||||
|
|
||||||
|
// Do we have an existing container? Empty and reuse it.
|
||||||
|
if ( this.picker.find( '.iris-palette-container' ).length ) {
|
||||||
|
container = this.picker.find( '.iris-palette-container' ).detach().html( '' );
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery.each( colors, function( index, val ) {
|
||||||
|
palette.clone().data( 'color', val )
|
||||||
|
.css( 'backgroundColor', val ).appendTo( container )
|
||||||
|
.height( 10 ).width( 10 );
|
||||||
|
});
|
||||||
|
|
||||||
|
this.picker.append( container );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}( jQuery ) );
|
||||||
|
|
||||||
|
jQuery( document ).ready( function( $ ) {
|
||||||
|
|
||||||
|
// Fix Safari issue on input click
|
||||||
|
$( '.butterbean-color-picker-alpha, .wp-picker-clear, .iris-picker' ).on( 'click', function( e ) {
|
||||||
|
e.preventDefault();
|
||||||
|
} );
|
||||||
|
|
||||||
|
});
|
||||||
339
wp-content/plugins/attesa-extra/metabox/butterbean/license.md
Normal file
339
wp-content/plugins/attesa-extra/metabox/butterbean/license.md
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
152
wp-content/plugins/attesa-extra/metabox/butterbean/readme.md
Normal file
152
wp-content/plugins/attesa-extra/metabox/butterbean/readme.md
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
# ButterBean
|
||||||
|
|
||||||
|
ButterBean is a neat little post meta box framework built on [Backbone.js](http://backbonejs.org) and [Underscore.js](http://underscorejs.org). You can run it as a standalone plugin or drop it into your own plugins.
|
||||||
|
|
||||||
|
The idea behind ButterBean came about because I often build custom post types that need quite a bit of custom metadata attached to the posts. Separating this into multiple meta boxes wasn't fun or user friendly. So, I decided to go with a single tabbed meta box instead.
|
||||||
|
|
||||||
|
And, that's what ButterBean is. It's essentially a meta box with tabs for lots of content.
|
||||||
|
|
||||||
|
## Just the interface
|
||||||
|
|
||||||
|
A lot of meta box frameworks try to do everything. They handle backend output, frontend output, and everything else you can think of. ButterBean is meant to be an interface only. Because every project's needs are vastly different, it doesn't make sense to stick you with a bunch of things you don't need. This means that the code can stay relatively lean and flexible, which makes it perfect for bundling in your plugins.
|
||||||
|
|
||||||
|
So, don't go looking for functions for outputting metadata on the front end from ButterBean. It doesn't have any. Use the core WordPress functionality or build your own wrapper functions.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
This is a quick guide. If you're familiar with the WordPress Customization API, you should probably pick this up fairly quickly. A lot of the same concepts are used here.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
Drop the `butterbean` folder into your plugin. That's the simple part.
|
||||||
|
|
||||||
|
The script will auto-load itself on the correct admin hooks. You just need to load it like so:
|
||||||
|
|
||||||
|
```
|
||||||
|
add_action( 'plugins_loaded', 'th_load' );
|
||||||
|
|
||||||
|
function th_load() {
|
||||||
|
|
||||||
|
require_once( 'path/to/butterbean/butterbean.php' );
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Registration
|
||||||
|
|
||||||
|
There's a built-in action hook called `butterbean_register`. You're going to use that to register everything. So, you need to set up a callback function for that.
|
||||||
|
|
||||||
|
```
|
||||||
|
add_action( 'butterbean_register', 'th_register', 10, 2 );
|
||||||
|
|
||||||
|
function th_register( $butterbean, $post_type ) {
|
||||||
|
|
||||||
|
// Register managers, sections, controls, and settings here.
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Registering a manager
|
||||||
|
|
||||||
|
A **manager** is a group of sections, controls, and settings. It's displayed as a single meta box. There can be multiple managers per screen (don't try multiples yet).
|
||||||
|
|
||||||
|
```
|
||||||
|
$butterbean->register_manager(
|
||||||
|
'example',
|
||||||
|
array(
|
||||||
|
'label' => esc_html__( 'Example', 'your-textdomain' ),
|
||||||
|
'post_type' => 'your_post_type',
|
||||||
|
'context' => 'normal',
|
||||||
|
'priority' => 'high'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$manager = $butterbean->get_manager( 'example' );
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Registering a section
|
||||||
|
|
||||||
|
A **section** is a group of controls within a manager. They are presented as "tabbed" sections in the UI.
|
||||||
|
|
||||||
|
```
|
||||||
|
$manager->register_section(
|
||||||
|
'section_1',
|
||||||
|
array(
|
||||||
|
'label' => esc_html__( 'Section 1', 'your-textdomain' ),
|
||||||
|
'icon' => 'dashicons-admin-generic'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Registering a control
|
||||||
|
|
||||||
|
A **control** is essentially a form field. It's the field(s) that a user enters data into. Each control belongs to a section. Each control should also be tied to a setting (below).
|
||||||
|
|
||||||
|
```
|
||||||
|
$manager->register_control(
|
||||||
|
'abc_xyz', // Same as setting name.
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'section' => 'section_1',
|
||||||
|
'label' => esc_html__( 'Control ABC', 'your-textdomain' ),
|
||||||
|
'attr' => array( 'class' => 'widefat' )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Registering a setting
|
||||||
|
|
||||||
|
A **setting** is nothing more than some post metadata and how it gets stored. A setting belongs to a specific control.
|
||||||
|
|
||||||
|
```
|
||||||
|
$manager->register_setting(
|
||||||
|
'abc_xyz', // Same as control name.
|
||||||
|
array(
|
||||||
|
'sanitize_callback' => 'wp_filter_nohtml_kses'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
### JavaScript API
|
||||||
|
|
||||||
|
ButterBean was built using [Backbone](http://backbonejs.org) for handling models, collections, and views. It uses [Underscore](http://underscorejs.org) for rendering templates for the views. All output is handled via JavaScript rather than PHP so that we can do cool stuff on the fly without having to reload the page. This is particularly useful when you start building more complex controls.
|
||||||
|
|
||||||
|
You'll never need to touch JavaScript until you need to build a control that relies on JavaScript.
|
||||||
|
|
||||||
|
#### The butterbean object
|
||||||
|
|
||||||
|
`butterbean` is the global object that houses everything you ever want to touch on the JavaScript side of things. It's located in the `js/butterbean.js` file. This file is well-documented, so you'll want to dive into it for doing more advanced stuff.
|
||||||
|
|
||||||
|
`butterbean.views.register_control()` is what most people will end up using. It's a function for registering a custom control view. New views can be created for each `type` of control.
|
||||||
|
|
||||||
|
Here's a quick example of registering a view for a color control where we need to call the core WordPress `wpColorPicker()` function. It uses the `ready()` function, which is fired after the HTML has been rendered for the view.
|
||||||
|
|
||||||
|
```
|
||||||
|
( function() {
|
||||||
|
|
||||||
|
butterbean.views.register_control( 'color', {
|
||||||
|
|
||||||
|
// Calls the core WP color picker for the control's input.
|
||||||
|
ready : function() {
|
||||||
|
|
||||||
|
var options = this.model.attributes.options;
|
||||||
|
|
||||||
|
jQuery( this.$el ).find( '.butterbean-color-picker' ).wpColorPicker( options );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}() );
|
||||||
|
```
|
||||||
|
|
||||||
|
## Professional Support
|
||||||
|
|
||||||
|
If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/board/topics), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 70,000+ users (and growing).
|
||||||
|
|
||||||
|
## Copyright and License
|
||||||
|
|
||||||
|
Various ideas from different projects have made their way into ButterBean. A few of the projects that had an important impact on the direction of this project are:
|
||||||
|
|
||||||
|
* Architecturally, the PHP code was modeled after the core WordPress Customization API. - [GPL 2+](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
|
||||||
|
* The design concept of the default tabbed interface was taken from [WooCommerce](http://www.woothemes.com/woocommerce/). © WooThemes - [GPL 3+](http://www.gnu.org/licenses/gpl.html)
|
||||||
|
* Code ideas for the media frame were borrowed from [WP Term Images](https://wordpress.org/plugins/wp-term-images/). © John James Jacoby - [GPL 2+](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
|
||||||
|
|
||||||
|
This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later.
|
||||||
|
|
||||||
|
2015-2016 © [Justin Tadlock](http://justintadlock.com).
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<label>
|
||||||
|
<input type="checkbox" value="true" {{{ data.attr }}} <# if ( data.value ) { #> checked="checked" <# } #> />
|
||||||
|
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</label>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<ul class="butterbean-checkbox-list">
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" value="{{ choice }}" name="{{ data.field_name }}[]" <# if ( -1 !== _.indexOf( data.value, choice ) ) { #> checked="checked" <# } #> />
|
||||||
|
{{ label }}
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</ul>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<label>
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<input {{{ data.attr }}} value="<# if ( data.value ) { #>#{{ data.value }}<# } #>" />
|
||||||
|
</label>
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<?php $month = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.month.label }}</span>
|
||||||
|
<select name="{{ data.month.name }}">
|
||||||
|
<# _.each( data.month.choices, function( choice ) { #>
|
||||||
|
<option value="{{ choice.num }}" <# if ( choice.num === data.month.value ) { #> selected="selected" <# } #>>{{ choice.label }}</option>
|
||||||
|
<# } ) #>
|
||||||
|
</select>
|
||||||
|
</label>';
|
||||||
|
|
||||||
|
$day = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.day.label }}</span>
|
||||||
|
<input type="text" name="{{ data.day.name }}" value="{{ data.day.value }}" {{{ data.day.attr }}} />
|
||||||
|
</label>';
|
||||||
|
|
||||||
|
$year = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.year.label }}</span>
|
||||||
|
<input type="text" name="{{ data.year.name }}" value="{{ data.year.value }}" {{{ data.year.attr }}} />
|
||||||
|
</label>';
|
||||||
|
|
||||||
|
$hour = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.hour.label }}</span>
|
||||||
|
<input type="text" name="{{ data.hour.name }}" value="{{ data.hour.value }}" {{{ data.hour.attr }}} />
|
||||||
|
</label>';
|
||||||
|
|
||||||
|
$minute = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.minute.label }}</span>
|
||||||
|
<input type="text" name="{{ data.minute.name }}" value="{{ data.minute.value }}" {{{ data.minute.attr }}} />
|
||||||
|
</label>';
|
||||||
|
|
||||||
|
$second = '<label>
|
||||||
|
<span class="screen-reader-text">{{ data.second.label }}</span>
|
||||||
|
<input type="text" name="{{ data.second.name }}" value="{{ data.second.value }}" {{{ data.second.attr }}} />
|
||||||
|
</label>'; ?>
|
||||||
|
|
||||||
|
<# if ( data.show_time ) { #>
|
||||||
|
|
||||||
|
<?php // Translators: 1: month, 2: day, 3: year, 4: hour, 5: minute, 6: second.
|
||||||
|
printf( __( '%1$s %2$s, %3$s @ %4$s:%5$s:%6$s', 'butterbean' ), $month, $day, $year, $hour, $minute, $second );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<# } else { #>
|
||||||
|
|
||||||
|
<?php // Translators: 1: month, 2: day, 3: year.
|
||||||
|
printf( __( '%1$s %2$s, %3$s', 'butterbean' ), $month, $day, $year );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<# } #>
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<input type="hidden" class="butterbean-attachment-id" name="{{ data.field_name }}" value="{{ data.value }}" />
|
||||||
|
|
||||||
|
<# if ( data.src ) { #>
|
||||||
|
<img class="butterbean-img" src="{{ data.src }}" alt="{{ data.alt }}" />
|
||||||
|
<# } else { #>
|
||||||
|
<div class="butterbean-placeholder">{{ data.l10n.placeholder }}</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<# if ( data.src ) { #>
|
||||||
|
<button type="button" class="button button-secondary butterbean-change-media">{{ data.l10n.change }}</button>
|
||||||
|
<button type="button" class="button button-secondary butterbean-remove-media">{{ data.l10n.remove }}</button>
|
||||||
|
<# } else { #>
|
||||||
|
<button type="button" class="button button-secondary butterbean-add-media">{{ data.l10n.upload }}</button>
|
||||||
|
<# } #>
|
||||||
|
</p>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<div class="butterbean-multi-avatars-wrap">
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( user ) { #>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" value="{{ user.id }}" name="{{ data.field_name }}[]" <# if ( -1 !== _.indexOf( data.value, user.id ) ) { #> checked="checked" <# } #> />
|
||||||
|
|
||||||
|
<span class="screen-reader-text">{{ user.name }}</span>
|
||||||
|
|
||||||
|
{{{ user.avatar }}}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</div><!-- .butterbean-multi-avatars-wrap -->
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( palette, choice ) { #>
|
||||||
|
<label aria-selected="{{ palette.selected }}">
|
||||||
|
<input type="radio" value="{{ choice }}" name="{{ data.field_name }}" <# if ( palette.selected ) { #> checked="checked" <# } #> />
|
||||||
|
|
||||||
|
<span class="butterbean-palette-label">{{ palette.label }}</span>
|
||||||
|
|
||||||
|
<div class="butterbean-palette-block">
|
||||||
|
|
||||||
|
<# _.each( palette.colors, function( color ) { #>
|
||||||
|
<span class="butterbean-palette-color" style="background-color: {{ color }}"> </span>
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<# } ) #>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<label>
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<select name="{{ data.field_name }}" id="{{ data.field_name }}">
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( choice ) { #>
|
||||||
|
<option value="{{ choice.value }}" <# if ( choice.value === data.value ) { #> selected="selected" <# } #>>{{ choice.label }}</option>
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</label>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( args, choice ) { #>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="{{ choice }}" name="{{ data.field_name }}" <# if ( data.value === choice ) { #> checked="checked" <# } #> />
|
||||||
|
<span class="screen-reader-text">{{ args.label }}</span>
|
||||||
|
<img src="{{ args.url }}" alt="{{ args.label }}" />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<ul class="butterbean-radio-list">
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="{{ choice }}" name="{{ data.field_name }}" <# if ( data.value === choice ) { #> checked="checked" <# } #> />
|
||||||
|
{{ label }}
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</ul>
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<label>
|
||||||
|
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<select {{{ data.attr }}}>
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<option value="{{ choice }}" <# if ( choice === data.value ) { #> selected="selected" <# } #>>{{ label }}</option>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
<# _.each( data.group, function( group ) { #>
|
||||||
|
|
||||||
|
<optgroup label="{{ group.label }}">
|
||||||
|
|
||||||
|
<# _.each( group.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<option value="{{ choice }}" <# if ( choice === data.value ) { #> selected="selected" <# } #>>{{ label }}</option>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</optgroup>
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<label>
|
||||||
|
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<select {{{ data.attr }}}>
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<option value="{{ choice }}" <# if ( data.value === choice ) { #> selected="selected" <# } #>>{{ label }}</option>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<label>
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<textarea {{{ data.attr }}}>{{{ data.value }}}</textarea>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</label>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<label>
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<input type="{{ data.type }}" value="{{ data.value }}" {{{ data.attr }}} />
|
||||||
|
</label>
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
<ul class="butterbean-nav"></ul>
|
||||||
|
<div class="butterbean-content"></div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<a href="#butterbean-{{ data.manager }}-section-{{ data.name }}"><i class="{{ data.icon }}" aria-hidden="true"></i><span class="label">{{ data.label }}</span></a>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field checkbox">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" value="true" {{{ data.attr }}} <# if ( data.value ) { #> checked="checked" <# } #> />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<div class="attesa-mb-field checkbox">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<ul class="butterbean-checkbox-list">
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" value="{{ choice }}" name="{{ data.field_name }}[]" <# if ( -1 !== _.indexOf( data.value, choice ) ) { #> checked="checked" <# } #> />
|
||||||
|
{{ label }}
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field color">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<input class=" butterbean-color-picker" {{{ data.attr }}} value="<# if ( data.value ) { #>#{{ data.value }}<# } #>" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<div class="attesa-mb-field image">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<input type="hidden" class="butterbean-attachment-id" name="{{ data.field_name }}" value="{{ data.value }}" />
|
||||||
|
|
||||||
|
<# if ( data.src ) { #>
|
||||||
|
<img class="butterbean-img" src="{{ data.src }}" alt="{{ data.alt }}" />
|
||||||
|
<# } else { #>
|
||||||
|
<div class="butterbean-placeholder">{{ data.l10n.placeholder }}</div>
|
||||||
|
<# } #>
|
||||||
|
<p>
|
||||||
|
<# if ( data.src ) { #>
|
||||||
|
<button type="button" class="button button-secondary butterbean-change-media">{{ data.l10n.change }}</button>
|
||||||
|
<button type="button" class="button button-secondary butterbean-remove-media">{{ data.l10n.remove }}</button>
|
||||||
|
<# } else { #>
|
||||||
|
<button type="button" class="button button-secondary butterbean-add-media">{{ data.l10n.upload }}</button>
|
||||||
|
<# } #>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field number">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<input type="number" value="{{ data.value }}" {{{ data.attr }}} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OnOff control class.
|
||||||
|
*
|
||||||
|
* @package Attesa WordPress theme
|
||||||
|
* @subpackage Controls
|
||||||
|
* @see https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnOff control
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class Attesa_ButterBean_Control_Onoff extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'onoff';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
$value = parent::get_value( $setting );
|
||||||
|
$object = $this->get_setting( $setting );
|
||||||
|
|
||||||
|
return ! $value && $object ? $object->default : $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<div class="attesa-mb-field onoff">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" value="true" {{{ data.attr }}} <# if ( data.value ) { #> checked="checked" <# } #> />
|
||||||
|
<span class="slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* RGBA Color control class.
|
||||||
|
*
|
||||||
|
* @package Attesa WordPress theme
|
||||||
|
* @subpackage Controls
|
||||||
|
* @see https://github.com/justintadlock/butterbean
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RGBA Color control
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class Attesa_ButterBean_Control_RGBA_Color extends ButterBean_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'rgba-color';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom options to pass to the color picker. Mostly, this is a wrapper for
|
||||||
|
* `iris()`, which is bundled with core WP. However, if they change pickers
|
||||||
|
* in the future, it may correspond to a different script.
|
||||||
|
*
|
||||||
|
* @link http://automattic.github.io/Iris/#options
|
||||||
|
* @link https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $options = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attributes for the control.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_attr() {
|
||||||
|
$attr = parent::get_attr();
|
||||||
|
|
||||||
|
$setting = $this->get_setting();
|
||||||
|
|
||||||
|
$attr['type'] = 'text';
|
||||||
|
$attr['maxlength'] = 7;
|
||||||
|
$attr['data-default'] = $setting ? $setting->default : '';
|
||||||
|
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value for the setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @param string $setting
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_value( $setting = 'default' ) {
|
||||||
|
|
||||||
|
$value = parent::get_value( $setting );
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
$this->json['options'] = $this->options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field rgba-color alpha-true">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<input class="widefat butterbean-color-picker-alpha" {{{ data.attr }}} value="<# if ( data.value ) { #>{{ data.value }}<# } #>" data-alpha="true" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<div class="attesa-mb-field select">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<select class="butterbean-select" {{{ data.attr }}}>
|
||||||
|
|
||||||
|
<# _.each( data.choices, function( label, choice ) { #>
|
||||||
|
|
||||||
|
<option value="{{ choice }}" <# if ( data.value === choice ) { #> selected="selected" <# } #>>{{ label }}</option>
|
||||||
|
|
||||||
|
<# } ) #>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field text">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<input type="text" value="{{ data.value }}" {{{ data.attr }}} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div class="attesa-mb-field textarea">
|
||||||
|
<div class="attesa-extra-block-first">
|
||||||
|
<# if ( data.label ) { #>
|
||||||
|
<span class="butterbean-label">{{ data.label }}</span>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( data.description ) { #>
|
||||||
|
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
<div class="attesa-extra-block-second">
|
||||||
|
<label>
|
||||||
|
<textarea type="text" class="widefat" {{{ data.attr }}}>{{{ data.value }}}</textarea>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
.butterbean-manager-default {
|
||||||
|
margin: 25px 0;
|
||||||
|
border: 1px solid #e2e4e7;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
.butterbean-manager-default .butterbean-label {
|
||||||
|
font-weight: 600 !important;
|
||||||
|
}
|
||||||
|
.butterbean-manager-default .butterbean-nav li a {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.butterbean-manager-default .butterbean-nav li[aria-selected=true] a {
|
||||||
|
font-weight: 400 !important;
|
||||||
|
color: #0073aa !important;
|
||||||
|
}
|
||||||
|
.attesa-mb-field:before,
|
||||||
|
.attesa-mb-field:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
.attesa-mb-field:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.attesa-mb-field {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.attesa-mb-field input[type=number],
|
||||||
|
.attesa-mb-field input[type=text]:not(.wp-color-picker),
|
||||||
|
.attesa-mb-field select {
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #8d96a0;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
.attesa-mb-field input[type=checkbox] {
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #8d96a0;
|
||||||
|
}
|
||||||
|
.attesa-extra-single:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.attesa-extra-single:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.attesa-extra-title-section {
|
||||||
|
font-weight: 700;
|
||||||
|
display: block;
|
||||||
|
background: rgba(0,0,0,0.05);
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
.attesa-extra-block-first {
|
||||||
|
display: inline;
|
||||||
|
float: left;
|
||||||
|
width: 35%;
|
||||||
|
padding: 0 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
body.rtl .attesa-extra-block-first {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.attesa-extra-block-second {
|
||||||
|
display: inline;
|
||||||
|
float: left;
|
||||||
|
width: 65%;
|
||||||
|
padding: 0 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 45px;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .switch input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .slider {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 34px;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0,0,0,0.1);
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .slider:before {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
content: "";
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
left: 4px;
|
||||||
|
bottom: 4px;
|
||||||
|
background-color: white;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .switch input:checked + .slider {
|
||||||
|
background-color: #11a0d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attesa-mb-field.onoff .switch input:focus + .slider {
|
||||||
|
box-shadow: 0 0 1px #11a0d2;
|
||||||
|
}
|
||||||
|
.attesa-mb-field.onoff .switch input:checked + .slider:before {
|
||||||
|
-webkit-transform: translateX(18px);
|
||||||
|
-ms-transform: translateX(18px);
|
||||||
|
transform: translateX(18px);
|
||||||
|
}
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
.attesa-extra-settings {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.attesa-extra-block-first,
|
||||||
|
.attesa-extra-block-second {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
.attesa-extra-block-second {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
133
wp-content/plugins/attesa-extra/metabox/functions.php
Normal file
133
wp-content/plugins/attesa-extra/metabox/functions.php
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
/* Get the correct ID of the page */
|
||||||
|
function attesaextra_get_the_current_ID() {
|
||||||
|
$theID = '';
|
||||||
|
if ( is_singular() ) {
|
||||||
|
$theID = get_the_ID();
|
||||||
|
} elseif (function_exists( 'is_woocommerce' ) && is_shop()) {
|
||||||
|
$theID = get_option('woocommerce_shop_page_id');
|
||||||
|
} elseif (is_home() && !is_front_page()) {
|
||||||
|
$theID = get_option('page_for_posts');
|
||||||
|
}
|
||||||
|
$theID = apply_filters( 'attesa_post_id', $theID );
|
||||||
|
$theID = $theID ? $theID : '';
|
||||||
|
return $theID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if use general custom settings */
|
||||||
|
function attesaextra_check_use_custom_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_general_use_custom_settings', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if the page is 100% full width for page builders */
|
||||||
|
function attesaextra_check_for_fullwidth_builders() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_general_use_full_width_builders', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the page overlay the header */
|
||||||
|
function attesaextra_check_for_overlaytoheader() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_general_overlay_contenttoheader', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if use header custom settings */
|
||||||
|
function attesaextra_check_use_header_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_header_use_custom_settings', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if use post custom settings */
|
||||||
|
function attesaextra_check_use_post_settings() {
|
||||||
|
if (get_post_meta(get_the_ID(), '_post_use_custom_settings', true) && is_singular( 'post' )) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if use page custom settings */
|
||||||
|
function attesaextra_check_use_page_settings() {
|
||||||
|
if (get_post_meta(get_the_ID(), '_page_use_custom_settings', true) && is_page()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit general colors settings */
|
||||||
|
function attesaextra_edit_general_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_general_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit topbar colors settings */
|
||||||
|
function attesaextra_edit_topbar_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_topnav_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit header colors settings */
|
||||||
|
function attesaextra_edit_header_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_header_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit classic sidebar colors settings */
|
||||||
|
function attesaextra_edit_classicsidebar_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_classic_sidebar_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit push sidebar colors settings */
|
||||||
|
function attesaextra_edit_pushsidebar_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_push_sidebar_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Check if use custom colors settings and edit footer colors settings */
|
||||||
|
function attesaextra_edit_footer_colors_settings() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_color_use_custom_settings', true) && get_post_meta(attesaextra_get_the_current_ID(), '_color_use_footer_color', true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Sanitize color and check if is hex or rgba */
|
||||||
|
function attesaextra_sanitize_hex_or_rgba($color) {
|
||||||
|
if ( empty( $color ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (false === strpos($color, 'rgba')) {
|
||||||
|
// Is hex color
|
||||||
|
$color = sanitize_hex_color( $color );
|
||||||
|
} else {
|
||||||
|
// Is rgba color
|
||||||
|
$color = str_replace( ' ', '', $color );
|
||||||
|
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
||||||
|
$color = 'rgba(' . attesaextra_check_the_range( $red, 0, 255 ) . ',' . attesaextra_check_the_range( $green, 0, 255 ) . ',' . attesaextra_check_the_range( $blue, 0, 255 ) . ',' . attesaextra_check_the_range( $alpha, 0, 1 ) . ')';
|
||||||
|
}
|
||||||
|
return $color;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* Helper to sanitize rgba color */
|
||||||
|
if ( ! function_exists( 'attesaextra_check_the_range' ) ) {
|
||||||
|
function attesaextra_check_the_range( $input, $min, $max ){
|
||||||
|
if ( $input < $min ) {
|
||||||
|
$input = $min;
|
||||||
|
}
|
||||||
|
if ( $input > $max ) {
|
||||||
|
$input = $max;
|
||||||
|
}
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
}
|
||||||
973
wp-content/plugins/attesa-extra/metabox/hooks.php
Normal file
973
wp-content/plugins/attesa-extra/metabox/hooks.php
Normal file
@ -0,0 +1,973 @@
|
|||||||
|
<?php
|
||||||
|
/* Custom header color text if the full width page overlay the menu */
|
||||||
|
function attesaextra_fullwidth_and_overlayheader_text_color($attesa_custom_css) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && attesaextra_check_for_fullwidth_builders() && attesaextra_check_for_overlaytoheader()) {
|
||||||
|
$generalOverlayContentToHeaderColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_overlay_contenttoheader_color', true);
|
||||||
|
$generalOverlayContentToHeaderBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_overlay_contentbackground', true);
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .site-branding .site-description,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-social-header-desktop .site-social-header a,
|
||||||
|
header.site-header:not(.menuMinor) .cartwoo-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) .cartedd-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) button.menu-toggle,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:hover,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:focus,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:active {
|
||||||
|
color: '.esc_html($generalOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
@media all and (min-width: 1025px) {
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li:not(.attesaMenuButton) > a {
|
||||||
|
color: '.esc_html($generalOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__line,
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__plus,
|
||||||
|
body:not(.yesOpenPopupMenu) header.site-header:not(.menuMinor) .menu-full-screen-icon .icon-full-screen .square-full-screen {
|
||||||
|
background-color: '.esc_html($generalOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__circle {
|
||||||
|
border-color: '.esc_html($generalOverlayContentToHeaderColor).';
|
||||||
|
}';
|
||||||
|
if ($generalOverlayContentToHeaderBackgroundColor) {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .nav-middle,
|
||||||
|
header.site-header:not(.menuMinor) .nav-middle-top-title {
|
||||||
|
background-color: '.esc_html($generalOverlayContentToHeaderBackgroundColor).';
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
if (attesa_options('_header_format', 'compat') == 'custom') {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .awp-social-buttons .site-social-elementor a,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-custom-logo .site-branding .site-description {
|
||||||
|
color: '.esc_html($generalOverlayContentToHeaderColor).' !important;
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $attesa_custom_css;
|
||||||
|
}
|
||||||
|
add_action('attesa_custom_css_style_filter', 'attesaextra_fullwidth_and_overlayheader_text_color', 999);
|
||||||
|
|
||||||
|
/* Custom header color text if the post overlay the menu */
|
||||||
|
function attesaextra_post_overlayheader_text_color($attesa_custom_css) {
|
||||||
|
if (attesaextra_check_use_post_settings() && !attesaextra_check_for_fullwidth_builders() && get_post_meta(get_the_ID(), '_post_featured_image_style', true) == 'header') {
|
||||||
|
$postOverlayContentToHeaderColor = get_post_meta(get_the_ID(), '_post_overlay_contenttoheader_color', true);
|
||||||
|
$attesa_custom_css .='
|
||||||
|
.attesaFeatBoxTitle .entry-title {
|
||||||
|
color: '.esc_html($postOverlayContentToHeaderColor).';
|
||||||
|
}';
|
||||||
|
if (get_post_meta(get_the_ID(), '_post_overlay_featured_image', true)) {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .site-branding .site-description,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-social-header-desktop .site-social-header a,
|
||||||
|
header.site-header:not(.menuMinor) .cartwoo-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) .cartedd-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) button.menu-toggle,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:hover,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:focus,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:active,
|
||||||
|
.attesaFeatBoxTitle .entry-title {
|
||||||
|
color: '.esc_html($postOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
@media all and (min-width: 1025px) {
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li:not(.attesaMenuButton) > a {
|
||||||
|
color: '.esc_html($postOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__line,
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__plus,
|
||||||
|
body:not(.yesOpenPopupMenu) header.site-header:not(.menuMinor) .menu-full-screen-icon .icon-full-screen .square-full-screen {
|
||||||
|
background-color: '.esc_html($postOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__circle {
|
||||||
|
border-color: '.esc_html($postOverlayContentToHeaderColor).';
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
if (attesa_options('_header_format', 'compat') == 'custom') {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .awp-social-buttons .site-social-elementor a,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-custom-logo .site-branding .site-description {
|
||||||
|
color: '.esc_html($postOverlayContentToHeaderColor).' !important;
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $attesa_custom_css;
|
||||||
|
}
|
||||||
|
add_action('attesa_custom_css_style_filter', 'attesaextra_post_overlayheader_text_color', 999);
|
||||||
|
|
||||||
|
/* Custom header color text if the page overlay the menu */
|
||||||
|
function attesaextra_page_overlayheader_text_color($attesa_custom_css) {
|
||||||
|
if (attesaextra_check_use_page_settings() && !attesaextra_check_for_fullwidth_builders() && get_post_meta(get_the_ID(), '_page_featured_image_style', true) == 'header') {
|
||||||
|
$pageOverlayContentToHeaderColor = get_post_meta(get_the_ID(), '_page_overlay_contenttoheader_color', true);
|
||||||
|
$attesa_custom_css .='
|
||||||
|
.attesaFeatBoxTitle .entry-title {
|
||||||
|
color: '.esc_html($pageOverlayContentToHeaderColor).';
|
||||||
|
}';
|
||||||
|
if (get_post_meta(get_the_ID(), '_page_overlay_featured_image', true)) {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .site-branding .site-description,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-social-header-desktop .site-social-header a,
|
||||||
|
header.site-header:not(.menuMinor) .cartwoo-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) .cartedd-button-mobile a,
|
||||||
|
header.site-header:not(.menuMinor) button.menu-toggle,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:hover,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:focus,
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li.attesaMenuButton > a:active,
|
||||||
|
.attesaFeatBoxTitle .entry-title {
|
||||||
|
color: '.esc_html($pageOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
@media all and (min-width: 1025px) {
|
||||||
|
header.site-header:not(.menuMinor) .main-navigation > div > ul > li:not(.attesaMenuButton) > a {
|
||||||
|
color: '.esc_html($pageOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__line,
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__plus,
|
||||||
|
body:not(.yesOpenPopupMenu) header.site-header:not(.menuMinor) .menu-full-screen-icon .icon-full-screen .square-full-screen {
|
||||||
|
background-color: '.esc_html($pageOverlayContentToHeaderColor).';
|
||||||
|
}
|
||||||
|
header.site-header:not(.menuMinor) .hamburger-menu .menu__circle {
|
||||||
|
border-color: '.esc_html($pageOverlayContentToHeaderColor).';
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
if (attesa_options('_header_format', 'compat') == 'custom') {
|
||||||
|
$attesa_custom_css .='
|
||||||
|
header.site-header:not(.menuMinor) .awp-social-buttons .site-social-elementor a,
|
||||||
|
header.site-header:not(.menuMinor) .attesa-custom-logo .site-branding .site-description {
|
||||||
|
color: '.esc_html($pageOverlayContentToHeaderColor).' !important;
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $attesa_custom_css;
|
||||||
|
}
|
||||||
|
add_action('attesa_custom_css_style_filter', 'attesaextra_page_overlayheader_text_color', 999);
|
||||||
|
|
||||||
|
/* Filter for attesa_check_bar() with new features*/
|
||||||
|
add_filter( 'attesa_check_return_filter', 'attesaextra_check_return_filter', 10, 2 );
|
||||||
|
function attesaextra_check_return_filter($attesa_check_return,$position) {
|
||||||
|
if ($position == 'classic' && attesaextra_check_use_custom_settings() && attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
$attesa_check_return = false;
|
||||||
|
}
|
||||||
|
if ($position == 'classic') {
|
||||||
|
$whereToShowMeta = get_post_meta(attesaextra_get_the_current_ID(), '_classic_sidebar_position', true);
|
||||||
|
} elseif ($position == 'footer') {
|
||||||
|
$whereToShowMeta = get_post_meta(attesaextra_get_the_current_ID(), '_footer_widgets_position', true);
|
||||||
|
} else {
|
||||||
|
$whereToShowMeta = get_post_meta(attesaextra_get_the_current_ID(), '_push_sidebar_position', true);
|
||||||
|
}
|
||||||
|
if ($whereToShowMeta == 'show') {
|
||||||
|
$attesa_check_return = true;
|
||||||
|
} elseif ($whereToShowMeta == 'none') {
|
||||||
|
$attesa_check_return = false;
|
||||||
|
}
|
||||||
|
return $attesa_check_return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Class for 100% full width page */
|
||||||
|
function attesaextra_fullwidth_class($classes) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
$classes[] = 'attesa-full-width';
|
||||||
|
if (attesaextra_check_for_overlaytoheader()) {
|
||||||
|
$classes[] = 'withOverlayMenu';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
add_filter( 'body_class', 'attesaextra_fullwidth_class' );
|
||||||
|
|
||||||
|
/* Filter for website structure */
|
||||||
|
add_filter( 'attesa_website_structure', 'attesaextra_website_structure' );
|
||||||
|
function attesaextra_website_structure($websiteStructureNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings()) {
|
||||||
|
$websiteStructure = get_post_meta(attesaextra_get_the_current_ID(), '_website_structure', true);
|
||||||
|
return $websiteStructure ? $websiteStructure : $websiteStructureNoFilter;
|
||||||
|
}
|
||||||
|
return $websiteStructureNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for max width website structure boxed */
|
||||||
|
add_filter( 'attesa_max_width_structure', 'attesaextra_max_width_structure' );
|
||||||
|
function attesaextra_max_width_structure($websiteBoxedWidthNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && get_post_meta(attesaextra_get_the_current_ID(), '_website_structure', true) == 'boxed') {
|
||||||
|
$websiteBoxedWidth = get_post_meta(attesaextra_get_the_current_ID(), '_max_width_structure', true);
|
||||||
|
return $websiteBoxedWidth ? $websiteBoxedWidth : $websiteBoxedWidthNoFilter;
|
||||||
|
}
|
||||||
|
return $websiteBoxedWidthNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for border radius */
|
||||||
|
add_filter( 'attesa_elements_border_radius', 'attesaextra_elements_border_radius' );
|
||||||
|
function attesaextra_elements_border_radius($borderRadiusNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings()) {
|
||||||
|
$borderRadius = get_post_meta(attesaextra_get_the_current_ID(), '_elements_border_radius', true);
|
||||||
|
return $borderRadius ? $borderRadius : $borderRadiusNoFilter;
|
||||||
|
}
|
||||||
|
return $borderRadiusNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for max width site content */
|
||||||
|
add_filter( 'attesa_max_width_site_content', 'attesaextra_max_width_site_content' );
|
||||||
|
function attesaextra_max_width_site_content($max_widthNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && !attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
$max_width = get_post_meta(attesaextra_get_the_current_ID(), '_max_width_site_content', true);
|
||||||
|
return $max_width ? $max_width : $max_widthNoFilter;
|
||||||
|
}
|
||||||
|
return $max_widthNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for width side content */
|
||||||
|
add_filter( 'attesa_width_site_content', 'attesaextra_width_site_content' );
|
||||||
|
function attesaextra_width_site_content($width_contentNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && !attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
$width_content = get_post_meta(attesaextra_get_the_current_ID(), '_max_width_with_sidebar', true);
|
||||||
|
return $width_content ? $width_content : $width_contentNoFilter;
|
||||||
|
}
|
||||||
|
return $width_contentNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for width side content without sidebar */
|
||||||
|
add_filter( 'attesa_width_site_content_no_sidebar', 'attesaextra_width_site_content_no_sidebar' );
|
||||||
|
function attesaextra_width_site_content_no_sidebar($width_content_nosidebarNoFilter) {
|
||||||
|
if (attesaextra_check_use_custom_settings() && !attesaextra_check_for_fullwidth_builders()) {
|
||||||
|
$width_content_nosidebar = get_post_meta(attesaextra_get_the_current_ID(), '_max_width_without_sidebar', true);
|
||||||
|
return $width_content_nosidebar ? $width_content_nosidebar : $width_content_nosidebar;
|
||||||
|
}
|
||||||
|
return $width_content_nosidebarNoFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for classic sidebar position */
|
||||||
|
add_filter( 'attesa_classic_sidebar_position', 'attesaextra_classic_sidebar_position' );
|
||||||
|
function attesaextra_classic_sidebar_position($classicSidebarPositionCode) {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_classic_sidebar_position', true) == 'show') {
|
||||||
|
$classicsidebarPositionMeta = get_post_meta(attesaextra_get_the_current_ID(), '_choose_classic_sidebar_position', true);
|
||||||
|
if (empty($classicsidebarPositionMeta) || $classicsidebarPositionMeta == 'default') {
|
||||||
|
return $classicSidebarPositionCode;
|
||||||
|
} elseif ($classicsidebarPositionMeta == 'right') {
|
||||||
|
return '#primary.content-area {float: left;}';
|
||||||
|
} else {
|
||||||
|
return '#primary.content-area {float: right;}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $classicSidebarPositionCode;
|
||||||
|
}
|
||||||
|
/* Filter for push sidebar position */
|
||||||
|
add_filter( 'attesa_push_sidebar_position', 'attesaextra_push_sidebar_position' );
|
||||||
|
function attesaextra_push_sidebar_position($pushSidebarPositionCode) {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_push_sidebar_position', true) == 'show') {
|
||||||
|
$pushsidebarPositionMeta = get_post_meta(attesaextra_get_the_current_ID(), '_choose_push_sidebar_position', true);
|
||||||
|
if (empty($pushsidebarPositionMeta) || $pushsidebarPositionMeta == 'default') {
|
||||||
|
return $pushSidebarPositionCode;
|
||||||
|
} elseif ($pushsidebarPositionMeta == 'right') {
|
||||||
|
return '@media all and (min-width: 1025px) {
|
||||||
|
body {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.attesa-site-wrap {
|
||||||
|
left: 0
|
||||||
|
-webkit-transition: left .25s ease-in-out;
|
||||||
|
-moz-transition: left .25s ease-in-out;
|
||||||
|
-o-transition: left .25s ease-in-out;
|
||||||
|
-ms-transition: left .25s ease-in-out;
|
||||||
|
transition: left .25s ease-in-out;
|
||||||
|
}
|
||||||
|
body.yesOpen .attesa-site-wrap,
|
||||||
|
body.yesOpen:not(.format_featuredtitle) header.site-header {
|
||||||
|
left: -150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body.yesOpen header.site-header.noSticky,
|
||||||
|
body.yesOpen header.site-header.relative
|
||||||
|
header.site-header {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
#tertiary.widget-area {
|
||||||
|
border-left-width: 3px;
|
||||||
|
border-left-style: solid;
|
||||||
|
right: -390px;
|
||||||
|
-wekbit-transition-property: right;
|
||||||
|
-moz-transition-property: right;
|
||||||
|
-o-transition-property: right;
|
||||||
|
transition-property: right;
|
||||||
|
}
|
||||||
|
#tertiary.widget-area.yesOpen {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
#tertiary.widget-area{
|
||||||
|
right: -100%
|
||||||
|
}
|
||||||
|
}';
|
||||||
|
} else {
|
||||||
|
return '@media all and (min-width: 1025px) {
|
||||||
|
body {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.attesa-site-wrap {
|
||||||
|
right: 0;
|
||||||
|
-webkit-transition: right .25s ease-in-out;
|
||||||
|
-moz-transition: right .25s ease-in-out;
|
||||||
|
-o-transition: right .25s ease-in-out;
|
||||||
|
-ms-transition: right .25s ease-in-out;
|
||||||
|
transition: right .25s ease-in-out;
|
||||||
|
}
|
||||||
|
body.yesOpen .attesa-site-wrap,
|
||||||
|
body.yesOpen:not(.format_featuredtitle) header.site-header {
|
||||||
|
right: -150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body.yesOpen header.site-header.noSticky,
|
||||||
|
body.yesOpen header.site-header.relative,
|
||||||
|
header.site-header {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
#tertiary.widget-area {
|
||||||
|
border-right-width: 3px;
|
||||||
|
border-right-style: solid;
|
||||||
|
left: -390px;
|
||||||
|
-wekbit-transition-property: left;
|
||||||
|
-moz-transition-property: left;
|
||||||
|
-o-transition-property: left;
|
||||||
|
transition-property: left;
|
||||||
|
}
|
||||||
|
#tertiary.widget-area.yesOpen {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
#tertiary.widget-area{
|
||||||
|
left: -100%
|
||||||
|
}
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $pushSidebarPositionCode;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image style */
|
||||||
|
add_filter('attesa_post_featured_image_style', 'attesaextra_post_featured_image_style');
|
||||||
|
function attesaextra_post_featured_image_style($featImagePostsNoFilter) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$postFeaturedImageStyle = get_post_meta(get_the_ID(), '_post_featured_image_style', true);
|
||||||
|
if (empty($postFeaturedImageStyle) || $postFeaturedImageStyle == 'default') {
|
||||||
|
return $featImagePostsNoFilter;
|
||||||
|
} else {
|
||||||
|
return $postFeaturedImageStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImagePostsNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image overlay style */
|
||||||
|
add_filter('attesa_overlay_featured_image_style', 'attesaextra_overlay_featured_image_style');
|
||||||
|
function attesaextra_overlay_featured_image_style($overlayFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$overlayFeatImage = get_post_meta(get_the_ID(), '_post_overlay_featured_image', true);
|
||||||
|
if (empty($overlayFeatImage)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $overlayFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image fixed style */
|
||||||
|
add_filter('attesa_fixed_featured_image_style', 'attesaextra_fixed_featured_image_style');
|
||||||
|
function attesaextra_fixed_featured_image_style($fixedFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$fixedFeatImage = get_post_meta(get_the_ID(), '_post_fixed_featured_image', true);
|
||||||
|
if (empty($fixedFeatImage)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fixedFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image height style */
|
||||||
|
add_filter('attesa_height_featured_image_style', 'attesaextra_height_featured_image_style');
|
||||||
|
function attesaextra_height_featured_image_style($heightFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$heightFeatImage = get_post_meta(get_the_ID(), '_post_height_featured_image', true);
|
||||||
|
return $heightFeatImage ? $heightFeatImage : $heightFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
return $heightFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image opacity style */
|
||||||
|
add_filter('attesa_opacity_featured_image_style', 'attesaextra_opacity_featured_image_style');
|
||||||
|
function attesaextra_opacity_featured_image_style($featImagePostsOpacityPrint) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$featImagePostsOpacity = get_post_meta(get_the_ID(), '_post_opacity_featured_image', true);
|
||||||
|
if (empty($featImagePostsOpacity)) {
|
||||||
|
return $featImagePostsOpacityPrint;
|
||||||
|
} else {
|
||||||
|
list($r, $g, $b) = sscanf($featImagePostsOpacity, '#%02x%02x%02x');
|
||||||
|
return '.attesaFeatBox .attesaFeatBoxOpacityPost {background-color: rgba('.esc_html($r).', '.esc_html($g).', '.esc_html($b).',0.3)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImagePostsOpacityPrint;
|
||||||
|
}
|
||||||
|
/* Filter for post featured image title style */
|
||||||
|
add_filter('attesa_title_featured_image_style', 'attesaextra_title_featured_image_style');
|
||||||
|
function attesaextra_title_featured_image_style($featImageTitleNoFilter) {
|
||||||
|
if (attesaextra_check_use_post_settings()) {
|
||||||
|
$featImageTitle = get_post_meta(get_the_ID(), '_post_featured_title_style', true);
|
||||||
|
if (empty($featImageTitle)) {
|
||||||
|
return $featImageTitleNoFilter;
|
||||||
|
} else {
|
||||||
|
return $featImageTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImageTitleNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image style */
|
||||||
|
add_filter('attesa_page_featured_image_style', 'attesaextra_page_featured_image_style');
|
||||||
|
function attesaextra_page_featured_image_style($featImagePagesNoFilter) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$pageFeaturedImageStyle = get_post_meta(get_the_ID(), '_page_featured_image_style', true);
|
||||||
|
if (empty($pageFeaturedImageStyle) || $pageFeaturedImageStyle == 'default') {
|
||||||
|
return $featImagePagesNoFilter;
|
||||||
|
} else {
|
||||||
|
return $pageFeaturedImageStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImagePagesNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image overlay style */
|
||||||
|
add_filter('attesa_overlay_featured_image_style_page', 'attesaextra_overlay_featured_image_style_page');
|
||||||
|
function attesaextra_overlay_featured_image_style_page($overlayFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$overlayFeatImage = get_post_meta(get_the_ID(), '_page_overlay_featured_image', true);
|
||||||
|
if (empty($overlayFeatImage)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $overlayFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image fixed style */
|
||||||
|
add_filter('attesa_fixed_featured_image_style_page', 'attesaextra_fixed_featured_image_style_page');
|
||||||
|
function attesaextra_fixed_featured_image_style_page($fixedFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$fixedFeatImage = get_post_meta(get_the_ID(), '_page_fixed_featured_image', true);
|
||||||
|
if (empty($fixedFeatImage)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fixedFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image height style */
|
||||||
|
add_filter('attesa_height_featured_image_style_page', 'attesaextra_height_featured_image_style_page');
|
||||||
|
function attesaextra_height_featured_image_style_page($heightFeatImageNoFilter) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$heightFeatImage = get_post_meta(get_the_ID(), '_page_height_featured_image', true);
|
||||||
|
return $heightFeatImage ? $heightFeatImage : $heightFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
return $heightFeatImageNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image opacity style */
|
||||||
|
add_filter('attesa_opacity_featured_image_style_page', 'attesaextra_opacity_featured_image_style_page');
|
||||||
|
function attesaextra_opacity_featured_image_style_page($featImagePagesOpacityPrint) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$featImagePagesOpacity = get_post_meta(get_the_ID(), '_page_opacity_featured_image', true);
|
||||||
|
if (empty($featImagePagesOpacity)) {
|
||||||
|
return $featImagePagesOpacityPrint;
|
||||||
|
} else {
|
||||||
|
list($r, $g, $b) = sscanf($featImagePagesOpacity, '#%02x%02x%02x');
|
||||||
|
return '.attesaFeatBox .attesaFeatBoxOpacityPage {background-color: rgba('.esc_html($r).', '.esc_html($g).', '.esc_html($b).',0.3)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImagePagesOpacityPrint;
|
||||||
|
}
|
||||||
|
/* Filter for page featured image title style */
|
||||||
|
add_filter('attesa_title_featured_image_style_page', 'attesaextra_title_featured_image_style_page');
|
||||||
|
function attesaextra_title_featured_image_style_page($featImageTitleNoFilter) {
|
||||||
|
if (attesaextra_check_use_page_settings()) {
|
||||||
|
$featImageTitle = get_post_meta(get_the_ID(), '_page_featured_title_style', true);
|
||||||
|
if (empty($featImageTitle)) {
|
||||||
|
return $featImageTitleNoFilter;
|
||||||
|
} else {
|
||||||
|
return $featImageTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $featImageTitleNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header style */
|
||||||
|
add_filter('attesa_header_style', 'attesaextra_header_style');
|
||||||
|
function attesaextra_header_style($headerStyleNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$headerStyle = get_post_meta(attesaextra_get_the_current_ID(), '_header_style', true);
|
||||||
|
if (empty($headerStyle) || $headerStyle == 'default') {
|
||||||
|
return $headerStyleNoFilter;
|
||||||
|
} else {
|
||||||
|
return $headerStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $headerStyleNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to fixed when scroll down */
|
||||||
|
add_filter('attesa_sticky_header_scroll', 'attesaextra_sticky_header_scroll');
|
||||||
|
function attesaextra_sticky_header_scroll($stickyHeaderNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$stickyHeader = get_post_meta(attesaextra_get_the_current_ID(), '_sticky_header_scroll', true);
|
||||||
|
if (empty($stickyHeader)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $stickyHeaderNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to fixed when scroll down also on smartphone/tablet */
|
||||||
|
add_filter('attesa_sticky_header_scroll_mobile', 'attesaextra_sticky_header_scroll_mobile');
|
||||||
|
function attesaextra_sticky_header_scroll_mobile($stickyHeaderMobileNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$stickyHeaderMobile = get_post_meta(attesaextra_get_the_current_ID(), '_sticky_header_scroll_mobile', true);
|
||||||
|
if (empty($stickyHeaderMobile)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $stickyHeaderMobileNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to show top nav bar */
|
||||||
|
add_filter('attesa_show_top_bar', 'attesaextra_show_top_bar');
|
||||||
|
function attesaextra_show_top_bar($showTopBarNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$topNav = get_post_meta(attesaextra_get_the_current_ID(), '_use_top_nav', true);
|
||||||
|
if (empty($topNav)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $showTopBarNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to use header colors */
|
||||||
|
add_filter('attesa_filter_use_header_colors', 'attesaextra_filter_use_header_colors');
|
||||||
|
function attesaextra_filter_use_header_colors($headerColorsNoFilter) {
|
||||||
|
if (attesaextra_edit_header_colors_settings()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $headerColorsNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for top bar style */
|
||||||
|
add_filter('attesa_topbar_style', 'attesaextra_topbar_style');
|
||||||
|
function attesaextra_topbar_style($topBarStyleNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$topBarStyle = get_post_meta(attesaextra_get_the_current_ID(), '_topbar_style', true);
|
||||||
|
if (empty($topBarStyle) || $topBarStyle == 'default') {
|
||||||
|
return $topBarStyleNoFilter;
|
||||||
|
} else {
|
||||||
|
return $topBarStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $topBarStyleNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to show top nav bar also on smartphone/tablet */
|
||||||
|
add_filter('attesa_show_top_bar_mobile', 'attesaextra_show_top_bar_mobile');
|
||||||
|
function attesaextra_show_top_bar_mobile($showTopBarMobileNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$topNavMobile = get_post_meta(attesaextra_get_the_current_ID(), '_use_top_nav_mobile', true);
|
||||||
|
if (empty($topNavMobile)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $showTopBarMobileNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to choose the nav bar scoll */
|
||||||
|
add_filter('attesa_choose_top_nav', 'attesaextra_choose_top_nav');
|
||||||
|
function attesaextra_choose_top_nav($topBarScrollNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$topBarScroll = get_post_meta(attesaextra_get_the_current_ID(), '_scroll_top_nav', true);
|
||||||
|
if (empty($topBarScroll) || $topBarScroll == 'default') {
|
||||||
|
return $topBarScrollNoFilter;
|
||||||
|
} else {
|
||||||
|
return $topBarScroll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $topBarScrollNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header to upload a custom logo */
|
||||||
|
add_filter('get_custom_logo', 'attesaextra_upload_custom_logo');
|
||||||
|
function attesaextra_upload_custom_logo($html) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$metaLogo = get_post_meta(attesaextra_get_the_current_ID(), '_upload_custom_logo', true);
|
||||||
|
if ($metaLogo) {
|
||||||
|
$html = '';
|
||||||
|
$logo_attributes = array(
|
||||||
|
'class' => 'custom-logo',
|
||||||
|
);
|
||||||
|
$image_alt = get_post_meta( $metaLogo, '_wp_attachment_image_alt', true );
|
||||||
|
if ( empty( $image_alt ) ) {
|
||||||
|
$logo_attributes['alt'] = get_bloginfo( 'name', 'display' );
|
||||||
|
}
|
||||||
|
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home">%2$s</a>',
|
||||||
|
esc_url( home_url( '/' ) ),
|
||||||
|
wp_get_attachment_image( $metaLogo, 'full', false, $logo_attributes )
|
||||||
|
);
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
/* Filter to upload costom logo on scroll */
|
||||||
|
add_filter('attesa_logo_on_scroll_filter', 'attesaextra_upload_custom_logo_on_scroll');
|
||||||
|
function attesaextra_upload_custom_logo_on_scroll($logoOnScrollNoFilter) {
|
||||||
|
if (attesaextra_check_use_header_settings()) {
|
||||||
|
$logoOnScroll = get_post_meta(attesaextra_get_the_current_ID(), '_upload_custom_logo_on_scroll', true);
|
||||||
|
if ($logoOnScroll) {
|
||||||
|
$logoOnScrollSrc = wp_get_attachment_image_src( $attachment_id = $logoOnScroll, 'full' );
|
||||||
|
return $logoOnScrollSrc[0];
|
||||||
|
}
|
||||||
|
return $logoOnScrollNoFilter;
|
||||||
|
}
|
||||||
|
return $logoOnScrollNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for general link color */
|
||||||
|
add_filter('attesa_general_link_color', 'attesaextra_general_link_color');
|
||||||
|
function attesaextra_general_link_color($generalLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$generalLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_link_color', true);
|
||||||
|
return $generalLinkColor ? $generalLinkColor : $generalLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $generalLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for general text color */
|
||||||
|
add_filter('attesa_general_text_color', 'attesaextra_general_text_color');
|
||||||
|
function attesaextra_general_text_color($generalTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$generalTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_text_color', true);
|
||||||
|
return $generalTextColor ? $generalTextColor : $generalTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $generalTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for general background color */
|
||||||
|
add_filter('attesa_general_background_color', 'attesaextra_general_background_color');
|
||||||
|
function attesaextra_general_background_color($generalBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$generalBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_background_color', true);
|
||||||
|
return $generalBackgroundColor ? $generalBackgroundColor : $generalBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $generalBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for outer background color */
|
||||||
|
add_filter('attesa_outer_background_color', 'attesaextra_outer_background_color');
|
||||||
|
function attesaextra_outer_background_color($outerBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings() && get_post_meta(attesaextra_get_the_current_ID(), '_website_structure', true) == 'boxed') {
|
||||||
|
$outerBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_outer_background_color', true);
|
||||||
|
return $outerBackgroundColor ? $outerBackgroundColor : $outerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $outerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for alternative background color */
|
||||||
|
add_filter('attesa_alternative_background_color', 'attesaextra_alternative_background_color');
|
||||||
|
function attesaextra_alternative_background_color($alternativeBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$alternativeBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_alternative_background_color', true);
|
||||||
|
return $alternativeBackgroundColor ? $alternativeBackgroundColor : $alternativeBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $alternativeBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for content text color */
|
||||||
|
add_filter('attesa_content_text_color', 'attesaextra_content_text_color');
|
||||||
|
function attesaextra_content_text_color($contentTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$contentTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_content_text_color', true);
|
||||||
|
return $contentTextColor ? $contentTextColor : $contentTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $contentTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for general border color */
|
||||||
|
add_filter('attesa_general_border_color', 'attesaextra_general_border_color');
|
||||||
|
function attesaextra_general_border_color($generalBorderColorNoFilter) {
|
||||||
|
if (attesaextra_edit_general_colors_settings()) {
|
||||||
|
$generalBorderColor = get_post_meta(attesaextra_get_the_current_ID(), '_general_border_color', true);
|
||||||
|
return $generalBorderColor ? $generalBorderColor : $generalBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
return $generalBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for topbar background color */
|
||||||
|
add_filter('attesa_topbar_background_color', 'attesaextra_topbar_background_color');
|
||||||
|
function attesaextra_topbar_background_color($topbarBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_topbar_colors_settings()) {
|
||||||
|
$topbarBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_topbar_background_color', true);
|
||||||
|
return $topbarBackgroundColor ? $topbarBackgroundColor : $topbarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $topbarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for topbar text color */
|
||||||
|
add_filter('attesa_topbar_text_color', 'attesaextra_topbar_text_color');
|
||||||
|
function attesaextra_topbar_text_color($topbarTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_topbar_colors_settings()) {
|
||||||
|
$topbarTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_topbar_text_color', true);
|
||||||
|
return $topbarTextColor ? $topbarTextColor : $topbarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $topbarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for topbar border color */
|
||||||
|
add_filter('attesa_topbar_border_color', 'attesaextra_topbar_border_color');
|
||||||
|
function attesaextra_topbar_border_color($topbarBorderColorNoFilter) {
|
||||||
|
if (attesaextra_edit_topbar_colors_settings()) {
|
||||||
|
$topbarBorderColor = get_post_meta(attesaextra_get_the_current_ID(), '_topbar_border_color', true);
|
||||||
|
return $topbarBorderColor ? $topbarBorderColor : $topbarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
return $topbarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header background color */
|
||||||
|
add_filter('attesa_header_background_color', 'attesaextra_header_background_color');
|
||||||
|
function attesaextra_header_background_color($headerBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_header_colors_settings()) {
|
||||||
|
$headerBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_header_background_color', true);
|
||||||
|
return $headerBackgroundColor ? $headerBackgroundColor : $headerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $headerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header link color */
|
||||||
|
add_filter('attesa_header_link_color', 'attesaextra_header_link_color');
|
||||||
|
function attesaextra_header_link_color($headerLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_header_colors_settings()) {
|
||||||
|
$headerLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_header_link_color', true);
|
||||||
|
return $headerLinkColor ? $headerLinkColor : $headerLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $headerLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for header text color */
|
||||||
|
add_filter('attesa_header_text_color', 'attesaextra_header_text_color');
|
||||||
|
function attesaextra_header_text_color($headerTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_header_colors_settings()) {
|
||||||
|
$headerTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_header_text_color', true);
|
||||||
|
return $headerTextColor ? $headerTextColor : $headerTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $headerTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for classic sidebar link color */
|
||||||
|
add_filter('attesa_classicsidebar_link_color', 'attesaextra_classicsidebar_link_color');
|
||||||
|
function attesaextra_classicsidebar_link_color($classicSidebarLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_classicsidebar_colors_settings()) {
|
||||||
|
$classicSidebarLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_classicsidebar_link_color', true);
|
||||||
|
return $classicSidebarLinkColor ? $classicSidebarLinkColor : $classicSidebarLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $classicSidebarLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for classic sidebar text color */
|
||||||
|
add_filter('attesa_classicsidebar_text_color', 'attesaextra_classicsidebar_text_color');
|
||||||
|
function attesaextra_classicsidebar_text_color($classicSidebarTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_classicsidebar_colors_settings()) {
|
||||||
|
$classicSidebarTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_classicsidebar_text_color', true);
|
||||||
|
return $classicSidebarTextColor ? $classicSidebarTextColor : $classicSidebarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $classicSidebarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for classic sidebar background color */
|
||||||
|
add_filter('attesa_classicsidebar_background_color', 'attesaextra_classicsidebar_background_color');
|
||||||
|
function attesaextra_classicsidebar_background_color($classicSidebarBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_classicsidebar_colors_settings()) {
|
||||||
|
$classicSidebarBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_classicsidebar_background_color', true);
|
||||||
|
return $classicSidebarBackgroundColor ? $classicSidebarBackgroundColor : $classicSidebarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $classicSidebarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for classic sidebar border color */
|
||||||
|
add_filter('attesa_classicsidebar_border_color', 'attesaextra_classicsidebar_border_color');
|
||||||
|
function attesaextra_classicsidebar_border_color($classicSidebarBorderColorNoFilter) {
|
||||||
|
if (attesaextra_edit_classicsidebar_colors_settings()) {
|
||||||
|
$classicSidebarBorderColor = get_post_meta(attesaextra_get_the_current_ID(), '_classicsidebar_border_color', true);
|
||||||
|
return $classicSidebarBorderColor ? $classicSidebarBorderColor : $classicSidebarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
return $classicSidebarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for push sidebar link color */
|
||||||
|
add_filter('attesa_pushsidebar_link_color', 'attesaextra_pushsidebar_link_color');
|
||||||
|
function attesaextra_pushsidebar_link_color($pushSidebarLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_pushsidebar_colors_settings()) {
|
||||||
|
$pushSidebarLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_pushsidebar_link_color', true);
|
||||||
|
return $pushSidebarLinkColor ? $pushSidebarLinkColor : $pushSidebarLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $pushSidebarLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for push sidebar text color */
|
||||||
|
add_filter('attesa_pushsidebar_text_color', 'attesaextra_pushsidebar_text_color');
|
||||||
|
function attesaextra_pushsidebar_text_color($pushSidebarTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_pushsidebar_colors_settings()) {
|
||||||
|
$pushSidebarTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_pushsidebar_text_color', true);
|
||||||
|
return $pushSidebarTextColor ? $pushSidebarTextColor : $pushSidebarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $pushSidebarTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for push sidebar background color */
|
||||||
|
add_filter('attesa_pushsidebar_background_color', 'attesaextra_pushsidebar_background_color');
|
||||||
|
function attesaextra_pushsidebar_background_color($pushSidebarBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_pushsidebar_colors_settings()) {
|
||||||
|
$pushSidebarBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_pushsidebar_background_color', true);
|
||||||
|
return $pushSidebarBackgroundColor ? $pushSidebarBackgroundColor : $pushSidebarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $pushSidebarBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for push sidebar border color */
|
||||||
|
add_filter('attesa_pushsidebar_border_color', 'attesaextra_pushsidebar_border_color');
|
||||||
|
function attesaextra_pushsidebar_border_color($pushSidebarBorderColorNoFilter) {
|
||||||
|
if (attesaextra_edit_pushsidebar_colors_settings()) {
|
||||||
|
$pushSidebarBorderColor = get_post_meta(attesaextra_get_the_current_ID(), '_pushsidebar_border_color', true);
|
||||||
|
return $pushSidebarBorderColor ? $pushSidebarBorderColor : $pushSidebarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
return $pushSidebarBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for footer link color */
|
||||||
|
add_filter('attesa_footer_link_color', 'attesaextra_footer_link_color');
|
||||||
|
function attesaextra_footer_link_color($footerLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$footerLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_footer_link_color', true);
|
||||||
|
return $footerLinkColor ? $footerLinkColor : $footerLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $footerLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for footer text color */
|
||||||
|
add_filter('attesa_footer_text_color', 'attesaextra_footer_text_color');
|
||||||
|
function attesaextra_footer_text_color($footerTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$footerTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_footer_text_color', true);
|
||||||
|
return $footerTextColor ? $footerTextColor : $footerTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $footerTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for footer background color */
|
||||||
|
add_filter('attesa_footer_background_color', 'attesaextra_footer_background_color');
|
||||||
|
function attesaextra_footer_background_color($footerBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$footerBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_footer_background_color', true);
|
||||||
|
return $footerBackgroundColor ? $footerBackgroundColor : $footerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $footerBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for footer border color */
|
||||||
|
add_filter('attesa_footer_border_color', 'attesaextra_footer_border_color');
|
||||||
|
function attesaextra_footer_border_color($footerBorderColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$footerBorderColor = get_post_meta(attesaextra_get_the_current_ID(), '_footer_border_color', true);
|
||||||
|
return $footerBorderColor ? $footerBorderColor : $footerBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
return $footerBorderColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for subfooter background color */
|
||||||
|
add_filter('attesa_subfooter_background_color', 'attesaextra_subfooter_background_color');
|
||||||
|
function attesaextra_subfooter_background_color($subFooterBackgroundColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$subFooterBackgroundColor = get_post_meta(attesaextra_get_the_current_ID(), '_subfooter_background_color', true);
|
||||||
|
return $subFooterBackgroundColor ? $subFooterBackgroundColor : $subFooterBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
return $subFooterBackgroundColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for subfooter text color */
|
||||||
|
add_filter('attesa_subfooter_text_color', 'attesaextra_subfooter_text_color');
|
||||||
|
function attesaextra_subfooter_text_color($subFooterTextColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$subFooterTextColor = get_post_meta(attesaextra_get_the_current_ID(), '_subfooter_text_color', true);
|
||||||
|
return $subFooterTextColor ? $subFooterTextColor : $subFooterTextColorNoFilter;
|
||||||
|
}
|
||||||
|
return $subFooterTextColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Filter for subfooter link color */
|
||||||
|
add_filter('attesa_subfooter_link_color', 'attesaextra_subfooter_link_color');
|
||||||
|
function attesaextra_subfooter_link_color($subFooterLinkColorNoFilter) {
|
||||||
|
if (attesaextra_edit_footer_colors_settings()) {
|
||||||
|
$subFooterLinkColor = get_post_meta(attesaextra_get_the_current_ID(), '_subfooter_link_color', true);
|
||||||
|
return $subFooterLinkColor ? $subFooterLinkColor : $subFooterLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
return $subFooterLinkColorNoFilter;
|
||||||
|
}
|
||||||
|
/* Action for shortcode before site content */
|
||||||
|
add_action('attesa_before_site_content', 'attesaextra_before_site_content');
|
||||||
|
function attesaextra_before_site_content() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_site_content', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_site_content', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode after site content */
|
||||||
|
add_action('attesa_after_site_content', 'attesaextra_after_site_content');
|
||||||
|
function attesaextra_after_site_content() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_site_content', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_site_content', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Filter for shortcode before page content */
|
||||||
|
add_filter('the_content', 'attesaextra_before_page_content' );
|
||||||
|
function attesaextra_before_page_content($content) {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_page_content', true)) {
|
||||||
|
$attesaextra_shortcode_before_page_content = do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_page_content', true)));
|
||||||
|
$content = $attesaextra_shortcode_before_page_content . $content;
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
/* Filter for shortcode after page content */
|
||||||
|
add_filter('the_content', 'attesaextra_after_page_content' );
|
||||||
|
function attesaextra_after_page_content($content) {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_page_content', true)) {
|
||||||
|
$attesaextra_shortcode_after_page_content = do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_page_content', true)));
|
||||||
|
$content .= $attesaextra_shortcode_after_page_content;
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
/* Action for shortcode before classic sidebar */
|
||||||
|
add_action('attesa_before_classic_sidebar', 'attesaextra_before_classic_sidebar');
|
||||||
|
function attesaextra_before_classic_sidebar() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_classic_side', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_classic_side', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode after classic sidebar */
|
||||||
|
add_action('attesa_after_classic_sidebar', 'attesaextra_after_classic_sidebar');
|
||||||
|
function attesaextra_after_classic_sidebar() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_classic_side', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_classic_side', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode before push sidebar */
|
||||||
|
add_action('attesa_before_push_sidebar', 'attesaextra_before_push_sidebar');
|
||||||
|
function attesaextra_before_push_sidebar() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_push_side', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_push_side', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode after push sidebar */
|
||||||
|
add_action('attesa_after_push_sidebar', 'attesaextra_after_push_sidebar');
|
||||||
|
function attesaextra_after_push_sidebar() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_push_side', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_push_side', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode before footer widgets */
|
||||||
|
add_action('attesa_before_footer_widgets', 'attesaextra_before_footer_widgets');
|
||||||
|
function attesaextra_before_footer_widgets() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_footer_wid', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_before_footer_wid', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Action for shortcode after footer widgets */
|
||||||
|
add_action('attesa_after_footer_widgets', 'attesaextra_after_footer_widgets');
|
||||||
|
function attesaextra_after_footer_widgets() {
|
||||||
|
if (get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_footer_wid', true)) {
|
||||||
|
echo do_shortcode(wp_kses_post(get_post_meta(attesaextra_get_the_current_ID(), '_shortcode_after_footer_wid', true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter for Breadcrumb */
|
||||||
|
add_filter('attesa_the_breadcrumb_filter', 'attesaextra_the_breadcrumb_filter' );
|
||||||
|
function attesaextra_the_breadcrumb_filter($true) {
|
||||||
|
if (attesaextra_check_use_custom_settings()) {
|
||||||
|
$yoast_breadcrumb_filter = get_post_meta(attesaextra_get_the_current_ID(), '_show_yoast_breadcrumb', true);
|
||||||
|
if (attesaextra_check_for_fullwidth_builders() || $yoast_breadcrumb_filter == 'hide' ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $true;
|
||||||
|
}
|
||||||
@ -0,0 +1,421 @@
|
|||||||
|
( function( $ ) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
$( document ).on( 'ready', function() {
|
||||||
|
/* General Settings */
|
||||||
|
|
||||||
|
/* Hide/Show for custom settings general */
|
||||||
|
var general_use_custom_settings = $('#butterbean-control-_general_use_custom_settings input'),
|
||||||
|
general_use_custom_settings_items = $('#butterbean-control-_general_use_full_width_builders, #butterbean-control-_general_overlay_contenttoheader, #butterbean-control-_general_overlay_contenttoheader_color, #butterbean-control-_general_overlay_contentbackground, #butterbean-control-_website_structure, #butterbean-control-_max_width_structure, #butterbean-control-_elements_border_radius, #butterbean-control-_max_width_site_content, #butterbean-control-_max_width_with_sidebar, #butterbean-control-_max_width_without_sidebar, #butterbean-control-_use_share_buttons, #butterbean-control-_use_contact_buttons, #butterbean-control-_show_yoast_breadcrumb');
|
||||||
|
|
||||||
|
general_use_custom_settings_items.hide();
|
||||||
|
|
||||||
|
if ( general_use_custom_settings.is(":checked") ) {
|
||||||
|
general_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
general_use_custom_settings.change( function () {
|
||||||
|
general_use_custom_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
general_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* If set 100% full width for page builders */
|
||||||
|
var general_use_full_width_builders = $('#butterbean-control-_general_use_full_width_builders input'),
|
||||||
|
general_use_full_width_builders_items = $('#butterbean-control-_max_width_site_content .attesa-mb-field, #butterbean-control-_max_width_with_sidebar .attesa-mb-field, #butterbean-control-_max_width_without_sidebar .attesa-mb-field, #butterbean-control-_classic_sidebar_position .attesa-mb-field, #butterbean-control-_show_yoast_breadcrumb .attesa-mb-field'),
|
||||||
|
general_use_full_width_builders_itemsVisible = $('#butterbean-control-_general_overlay_contenttoheader .attesa-mb-field');
|
||||||
|
|
||||||
|
general_use_full_width_builders_itemsVisible.hide();
|
||||||
|
|
||||||
|
if ( general_use_full_width_builders.is(":checked") ) {
|
||||||
|
general_use_full_width_builders_items.hide('fast');
|
||||||
|
general_use_full_width_builders_itemsVisible.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
general_use_full_width_builders.change( function () {
|
||||||
|
general_use_full_width_builders_items.show('fast');
|
||||||
|
general_use_full_width_builders_itemsVisible.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
general_use_full_width_builders_items.hide('fast');
|
||||||
|
general_use_full_width_builders_itemsVisible.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* If set overlay header for page builders */
|
||||||
|
var use_overlay_header_full_width = $('#butterbean-control-_general_overlay_contenttoheader input'),
|
||||||
|
use_overlay_header_full_width_items = $('#butterbean-control-_general_overlay_contenttoheader_color .attesa-mb-field, #butterbean-control-_general_overlay_contentbackground .attesa-mb-field');
|
||||||
|
|
||||||
|
use_overlay_header_full_width_items.hide();
|
||||||
|
|
||||||
|
if ( use_overlay_header_full_width.is(":checked") ) {
|
||||||
|
use_overlay_header_full_width_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
use_overlay_header_full_width.change( function () {
|
||||||
|
use_overlay_header_full_width_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
use_overlay_header_full_width_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for website structure */
|
||||||
|
var choose_website_structure = $('#butterbean-control-_website_structure select'),
|
||||||
|
choose_website_structure_val = choose_website_structure.val(),
|
||||||
|
choose_website_structure_items = $('#butterbean-control-_max_width_structure .attesa-mb-field');
|
||||||
|
|
||||||
|
choose_website_structure_items.hide();
|
||||||
|
|
||||||
|
if ( choose_website_structure_val === 'boxed' ) {
|
||||||
|
choose_website_structure_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
choose_website_structure.change( function () {
|
||||||
|
choose_website_structure_items.hide('fast');
|
||||||
|
if ( $( this ).val() == 'boxed' ) {
|
||||||
|
choose_website_structure_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
/* Widgets Settings */
|
||||||
|
var classic_sidebar_position = $('#butterbean-control-_classic_sidebar_position select'),
|
||||||
|
classic_sidebar_position_val = classic_sidebar_position.val(),
|
||||||
|
choose_sidebar_position_classic = $('#butterbean-control-_choose_classic_sidebar_position .attesa-mb-field, #butterbean-control-_choose_classic_sidebar_area .attesa-mb-field'),
|
||||||
|
push_sidebar_position = $('#butterbean-control-_push_sidebar_position select'),
|
||||||
|
push_sidebar_position_val = push_sidebar_position.val(),
|
||||||
|
choose_sidebar_position_push = $('#butterbean-control-_choose_push_sidebar_position .attesa-mb-field, #butterbean-control-_choose_push_sidebar_area .attesa-mb-field');
|
||||||
|
|
||||||
|
choose_sidebar_position_classic.hide();
|
||||||
|
choose_sidebar_position_push.hide();
|
||||||
|
|
||||||
|
if ( classic_sidebar_position_val === 'show' ) {
|
||||||
|
choose_sidebar_position_classic.show('fast');
|
||||||
|
}
|
||||||
|
if ( push_sidebar_position_val === 'show' ) {
|
||||||
|
choose_sidebar_position_push.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
classic_sidebar_position.change( function () {
|
||||||
|
choose_sidebar_position_classic.hide('fast');
|
||||||
|
if ( $( this ).val() == 'show' ) {
|
||||||
|
choose_sidebar_position_classic.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
push_sidebar_position.change( function () {
|
||||||
|
choose_sidebar_position_push.hide('fast');
|
||||||
|
if ( $( this ).val() == 'show' ) {
|
||||||
|
choose_sidebar_position_push.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Header Settings */
|
||||||
|
/* Hide/Show for use custom button header */
|
||||||
|
var custom_button_header = $('#butterbean-control-_header_use_custom_settings input'),
|
||||||
|
custom_button_header_items = $('#butterbean-control-_header_style, #butterbean-control-_sticky_header_scroll, #butterbean-control-_sticky_header_scroll_mobile, #butterbean-control-_use_top_nav, #butterbean-control-_use_top_nav_mobile, #butterbean-control-_topbar_style, #butterbean-control-_scroll_top_nav, #butterbean-control-_upload_custom_logo, #butterbean-control-_upload_custom_logo_on_scroll');
|
||||||
|
|
||||||
|
custom_button_header_items.hide();
|
||||||
|
|
||||||
|
if ( custom_button_header.is(":checked") ) {
|
||||||
|
custom_button_header_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_button_header.change( function () {
|
||||||
|
custom_button_header_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_button_header_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for sticky header also on tablet/smartphone */
|
||||||
|
var sticky_header_settings = $('#butterbean-control-_sticky_header_scroll input'),
|
||||||
|
sticky_header_settings_items = $('#butterbean-control-_sticky_header_scroll_mobile .attesa-mb-field, #butterbean-control-_upload_custom_logo_on_scroll .attesa-mb-field');
|
||||||
|
|
||||||
|
sticky_header_settings_items.hide();
|
||||||
|
|
||||||
|
if ( sticky_header_settings.is(":checked") ) {
|
||||||
|
sticky_header_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
sticky_header_settings.change( function () {
|
||||||
|
sticky_header_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
sticky_header_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for top bar */
|
||||||
|
var use_top_nav = $('#butterbean-control-_use_top_nav input'),
|
||||||
|
choose_top_nav = $('#butterbean-control-_use_top_nav_mobile .attesa-mb-field, #butterbean-control-_topbar_style .attesa-mb-field, #butterbean-control-_scroll_top_nav .attesa-mb-field');
|
||||||
|
|
||||||
|
choose_top_nav.hide();
|
||||||
|
|
||||||
|
if ( use_top_nav.is(":checked") ) {
|
||||||
|
choose_top_nav.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
use_top_nav.change( function () {
|
||||||
|
choose_top_nav.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
choose_top_nav.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Post Settings */
|
||||||
|
/* Hide/Show for custom settings post */
|
||||||
|
var post_use_custom_settings = $('#butterbean-control-_post_use_custom_settings input'),
|
||||||
|
post_use_custom_settings_items = $('#butterbean-control-_post_featured_image_style, #butterbean-control-_post_overlay_featured_image, #butterbean-control-_post_fixed_featured_image, #butterbean-control-_post_height_featured_image, #butterbean-control-_post_opacity_featured_image, #butterbean-control-_post_overlay_contenttoheader_color, #butterbean-control-_post_featured_title_style, #butterbean-control-_use_custom_header_button_post, #butterbean-control-_text_custom_header_button_post, #butterbean-control-_url_custom_header_button_post, #butterbean-control-_open_custom_header_button_post');
|
||||||
|
|
||||||
|
post_use_custom_settings_items.hide();
|
||||||
|
|
||||||
|
if ( post_use_custom_settings.is(":checked") ) {
|
||||||
|
post_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
post_use_custom_settings.change( function () {
|
||||||
|
post_use_custom_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
post_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for big featured images post */
|
||||||
|
var big_featured_image_post = $('#butterbean-control-_post_featured_image_style select'),
|
||||||
|
big_featured_image_post_val = big_featured_image_post.val(),
|
||||||
|
choose_big_featured_image_post = $('#butterbean-control-_post_overlay_featured_image .attesa-mb-field, #butterbean-control-_post_fixed_featured_image .attesa-mb-field, #butterbean-control-_post_height_featured_image .attesa-mb-field, #butterbean-control-_post_opacity_featured_image .attesa-mb-field, #butterbean-control-_post_overlay_contenttoheader_color .attesa-mb-field, #butterbean-control-_post_featured_title_style .attesa-mb-field, #butterbean-control-_use_custom_header_button_post .attesa-mb-field');
|
||||||
|
|
||||||
|
choose_big_featured_image_post.hide();
|
||||||
|
|
||||||
|
if ( big_featured_image_post_val === 'header' ) {
|
||||||
|
choose_big_featured_image_post.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
big_featured_image_post.change( function () {
|
||||||
|
choose_big_featured_image_post.hide('fast');
|
||||||
|
if ( $( this ).val() == 'header' ) {
|
||||||
|
choose_big_featured_image_post.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for use custom buttons in post */
|
||||||
|
var post_use_custom_button = $('#butterbean-control-_use_custom_header_button_post input'),
|
||||||
|
post_use_custom_button_items = $('#butterbean-control-_text_custom_header_button_post .attesa-mb-field, #butterbean-control-_url_custom_header_button_post .attesa-mb-field, #butterbean-control-_open_custom_header_button_post .attesa-mb-field');
|
||||||
|
|
||||||
|
post_use_custom_button_items.hide();
|
||||||
|
|
||||||
|
if ( post_use_custom_button.is(":checked") ) {
|
||||||
|
post_use_custom_button_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
post_use_custom_button.change( function () {
|
||||||
|
post_use_custom_button_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
post_use_custom_button_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Page Settings */
|
||||||
|
/* Hide/Show for custom settings page */
|
||||||
|
var page_use_custom_settings = $('#butterbean-control-_page_use_custom_settings input'),
|
||||||
|
page_use_custom_settings_items = $('#butterbean-control-_page_featured_image_style, #butterbean-control-_page_overlay_featured_image, #butterbean-control-_page_fixed_featured_image, #butterbean-control-_page_height_featured_image, #butterbean-control-_page_opacity_featured_image, #butterbean-control-_page_overlay_contenttoheader_color, #butterbean-control-_page_featured_title_style, #butterbean-control-_use_custom_header_button_page, #butterbean-control-_text_custom_header_button_page, #butterbean-control-_url_custom_header_button_page, #butterbean-control-_open_custom_header_button_page');
|
||||||
|
|
||||||
|
page_use_custom_settings_items.hide();
|
||||||
|
|
||||||
|
if ( page_use_custom_settings.is(":checked") ) {
|
||||||
|
page_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
page_use_custom_settings.change( function () {
|
||||||
|
page_use_custom_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
page_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for big featured images page */
|
||||||
|
var big_featured_image_page = $('#butterbean-control-_page_featured_image_style select'),
|
||||||
|
big_featured_image_page_val = big_featured_image_page.val(),
|
||||||
|
choose_big_featured_image_page = $('#butterbean-control-_page_overlay_featured_image .attesa-mb-field, #butterbean-control-_page_fixed_featured_image .attesa-mb-field, #butterbean-control-_page_height_featured_image .attesa-mb-field, #butterbean-control-_page_opacity_featured_image .attesa-mb-field, #butterbean-control-_page_overlay_contenttoheader_color .attesa-mb-field, #butterbean-control-_page_featured_title_style .attesa-mb-field, #butterbean-control-_use_custom_header_button_page .attesa-mb-field');
|
||||||
|
|
||||||
|
choose_big_featured_image_page.hide();
|
||||||
|
|
||||||
|
if ( big_featured_image_page_val === 'header' ) {
|
||||||
|
choose_big_featured_image_page.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
big_featured_image_page.change( function () {
|
||||||
|
choose_big_featured_image_page.hide('fast');
|
||||||
|
if ( $( this ).val() == 'header' ) {
|
||||||
|
choose_big_featured_image_page.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for use custom buttons in page */
|
||||||
|
var page_use_custom_button = $('#butterbean-control-_use_custom_header_button_page input'),
|
||||||
|
page_use_custom_button_items = $('#butterbean-control-_text_custom_header_button_page .attesa-mb-field, #butterbean-control-_url_custom_header_button_page .attesa-mb-field, #butterbean-control-_open_custom_header_button_page .attesa-mb-field');
|
||||||
|
|
||||||
|
page_use_custom_button_items.hide();
|
||||||
|
|
||||||
|
if ( page_use_custom_button.is(":checked") ) {
|
||||||
|
page_use_custom_button_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
page_use_custom_button.change( function () {
|
||||||
|
page_use_custom_button_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
page_use_custom_button_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Colors Settings */
|
||||||
|
/* Hide/Show for colors settings page */
|
||||||
|
var colors_use_custom_settings = $('#butterbean-control-_color_use_custom_settings input'),
|
||||||
|
colors_use_custom_settings_items = $('#butterbean-control-_color_use_general_color, #butterbean-control-_outer_background_color, #butterbean-control-_general_background_color, #butterbean-control-_alternative_background_color, #butterbean-control-_general_text_color, #butterbean-control-_content_text_color, #butterbean-control-_general_link_color, #butterbean-control-_general_border_color, #butterbean-control-_color_use_topnav_color, #butterbean-control-_topbar_background_color, #butterbean-control-_topbar_text_color, #butterbean-control-_topbar_border_color, #butterbean-control-_color_use_header_color, #butterbean-control-_header_text_color, #butterbean-control-_header_background_color, #butterbean-control-_header_link_color, #butterbean-control-_color_use_classic_sidebar_color, #butterbean-control-_classicsidebar_background_color, #butterbean-control-_classicsidebar_text_color, #butterbean-control-_classicsidebar_link_color, #butterbean-control-_classicsidebar_border_color, #butterbean-control-_color_use_push_sidebar_color, #butterbean-control-_pushsidebar_background_color, #butterbean-control-_pushsidebar_text_color, #butterbean-control-_pushsidebar_link_color, #butterbean-control-_pushsidebar_border_color, #butterbean-control-_color_use_footer_color, #butterbean-control-_footer_background_color, #butterbean-control-_footer_text_color, #butterbean-control-_footer_link_color, #butterbean-control-_footer_border_color, #butterbean-control-_subfooter_background_color, #butterbean-control-_subfooter_text_color, #butterbean-control-_subfooter_link_color');
|
||||||
|
|
||||||
|
colors_use_custom_settings_items.hide();
|
||||||
|
|
||||||
|
if ( colors_use_custom_settings.is(":checked") ) {
|
||||||
|
colors_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
colors_use_custom_settings.change( function () {
|
||||||
|
colors_use_custom_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
colors_use_custom_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit general colors */
|
||||||
|
var custom_general_colors_settings = $('#butterbean-control-_color_use_general_color input'),
|
||||||
|
custom_general_colors_settings_items = $('#butterbean-control-_outer_background_color .attesa-mb-field, #butterbean-control-_general_background_color .attesa-mb-field, #butterbean-control-_alternative_background_color .attesa-mb-field, #butterbean-control-_general_text_color .attesa-mb-field, #butterbean-control-_content_text_color .attesa-mb-field, #butterbean-control-_general_link_color .attesa-mb-field, #butterbean-control-_general_border_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_general_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_general_colors_settings.is(":checked") ) {
|
||||||
|
custom_general_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_general_colors_settings.change( function () {
|
||||||
|
custom_general_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_general_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit topbar colors */
|
||||||
|
var custom_top_colors_settings = $('#butterbean-control-_color_use_topnav_color input'),
|
||||||
|
custom_top_colors_settings_items = $('#butterbean-control-_topbar_background_color .attesa-mb-field, #butterbean-control-_topbar_text_color .attesa-mb-field, #butterbean-control-_topbar_border_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_top_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_top_colors_settings.is(":checked") ) {
|
||||||
|
custom_top_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_top_colors_settings.change( function () {
|
||||||
|
custom_top_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_top_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit header colors */
|
||||||
|
var custom_header_colors_settings = $('#butterbean-control-_color_use_header_color input'),
|
||||||
|
custom_header_colors_settings_items = $('#butterbean-control-_header_background_color .attesa-mb-field, #butterbean-control-_header_text_color .attesa-mb-field, #butterbean-control-_header_link_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_header_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_header_colors_settings.is(":checked") ) {
|
||||||
|
custom_header_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_header_colors_settings.change( function () {
|
||||||
|
custom_header_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_header_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit classic sidebar colors */
|
||||||
|
var custom_classicsidebar_colors_settings = $('#butterbean-control-_color_use_classic_sidebar_color input'),
|
||||||
|
custom_classicsidebar_colors_settings_items = $('#butterbean-control-_classicsidebar_background_color .attesa-mb-field, #butterbean-control-_classicsidebar_text_color .attesa-mb-field, #butterbean-control-_classicsidebar_link_color .attesa-mb-field, #butterbean-control-_classicsidebar_border_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_classicsidebar_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_classicsidebar_colors_settings.is(":checked") ) {
|
||||||
|
custom_classicsidebar_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_classicsidebar_colors_settings.change( function () {
|
||||||
|
custom_classicsidebar_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_classicsidebar_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit push sidebar colors */
|
||||||
|
var custom_pushsidebar_colors_settings = $('#butterbean-control-_color_use_push_sidebar_color input'),
|
||||||
|
custom_pushsidebar_colors_settings_items = $('#butterbean-control-_pushsidebar_background_color .attesa-mb-field, #butterbean-control-_pushsidebar_text_color .attesa-mb-field, #butterbean-control-_pushsidebar_link_color .attesa-mb-field, #butterbean-control-_pushsidebar_border_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_pushsidebar_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_pushsidebar_colors_settings.is(":checked") ) {
|
||||||
|
custom_pushsidebar_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_pushsidebar_colors_settings.change( function () {
|
||||||
|
custom_pushsidebar_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_pushsidebar_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for edit footer colors */
|
||||||
|
var custom_footer_colors_settings = $('#butterbean-control-_color_use_footer_color input'),
|
||||||
|
custom_footer_colors_settings_items = $('#butterbean-control-_footer_background_color .attesa-mb-field, #butterbean-control-_footer_text_color .attesa-mb-field, #butterbean-control-_footer_link_color .attesa-mb-field, #butterbean-control-_footer_border_color .attesa-mb-field, #butterbean-control-_subfooter_background_color .attesa-mb-field, #butterbean-control-_subfooter_text_color .attesa-mb-field, #butterbean-control-_subfooter_link_color .attesa-mb-field');
|
||||||
|
|
||||||
|
custom_footer_colors_settings_items.hide();
|
||||||
|
|
||||||
|
if ( custom_footer_colors_settings.is(":checked") ) {
|
||||||
|
custom_footer_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_footer_colors_settings.change( function () {
|
||||||
|
custom_footer_colors_settings_items.hide('fast');
|
||||||
|
if ( $( this ).is(":checked") ) {
|
||||||
|
custom_footer_colors_settings_items.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
/* Hide/Show for footer callout */
|
||||||
|
var footer_callout_setting = $('#butterbean-control-_use_footer_callout select'),
|
||||||
|
footer_callout_setting_val = footer_callout_setting.val(),
|
||||||
|
footer_callout_setting_choose = $('#butterbean-control-_footer_callout_text, #butterbean-control-_footer_callout_subtext, #butterbean-control-_footer_callout_text_button, #butterbean-control-_footer_callout_link_button, #butterbean-control-_footer_callout_shortcode, #butterbean-control-_footer_callout_block_style, #butterbean-control-_footer_callout_open_button, #butterbean-control-_footer_callout_padding, #butterbean-control-_footer_callout_background_color, #butterbean-control-_footer_callout_text_color, #butterbean-control-_footer_callout_button_color, #butterbean-control-_footer_callout_image, #butterbean-control-_footer_callout_image_alignment, #butterbean-control-_footer_callout_image_max_height'),
|
||||||
|
footer_callout_settings_custom_template = $('#butterbean-control-_footer_callout_get_attesa_template');
|
||||||
|
|
||||||
|
footer_callout_setting_choose.hide();
|
||||||
|
footer_callout_settings_custom_template.hide();
|
||||||
|
|
||||||
|
if ( footer_callout_setting_val === 'custom' ) {
|
||||||
|
footer_callout_setting_choose.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( footer_callout_setting_val === 'custom_template' ) {
|
||||||
|
footer_callout_settings_custom_template.show('fast');
|
||||||
|
}
|
||||||
|
|
||||||
|
footer_callout_setting.change( function () {
|
||||||
|
footer_callout_setting_choose.hide('fast');
|
||||||
|
footer_callout_settings_custom_template.hide('fast');
|
||||||
|
if ( $( this ).val() == 'custom' ) {
|
||||||
|
footer_callout_setting_choose.show('fast');
|
||||||
|
}
|
||||||
|
if ( $( this ).val() == 'custom_template' ) {
|
||||||
|
footer_callout_settings_custom_template.show('fast');
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
} ) ( jQuery );
|
||||||
1750
wp-content/plugins/attesa-extra/metabox/metabox.php
Normal file
1750
wp-content/plugins/attesa-extra/metabox/metabox.php
Normal file
File diff suppressed because it is too large
Load Diff
80
wp-content/plugins/attesa-extra/metabox/shortcodes.php
Normal file
80
wp-content/plugins/attesa-extra/metabox/shortcodes.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
if ( ! class_exists( 'AttesaExtra_Shortcodes' ) ) {
|
||||||
|
class AttesaExtra_Shortcodes {
|
||||||
|
public function __construct() {
|
||||||
|
add_shortcode( 'attesa_date', array( $this, 'date_shortcode' ) );
|
||||||
|
add_shortcode( 'attesa_copyright', array( $this, 'copyright_symbol_shortcode' ) );
|
||||||
|
add_shortcode( 'attesa_registered_trademark', array( $this, 'registered_trademark_symbol_shortcode' ) );
|
||||||
|
add_shortcode( 'attesa_qrcode', array( $this, 'registered_qrcode_shortcode' ) );
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Register the [attesa_date] shortcode
|
||||||
|
*
|
||||||
|
* @since 1.1.8
|
||||||
|
*/
|
||||||
|
public function date_shortcode( $atts, $content = null ) {
|
||||||
|
extract( shortcode_atts( array(
|
||||||
|
'year' => '',
|
||||||
|
), $atts ) );
|
||||||
|
$date = '';
|
||||||
|
if ( '' != $year ) {
|
||||||
|
$date .= $year . ' - ';
|
||||||
|
}
|
||||||
|
$date .= date( 'Y' );
|
||||||
|
return esc_html( $date );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the [attesa_copyright] shortcode
|
||||||
|
*
|
||||||
|
* @since 1.1.8
|
||||||
|
*/
|
||||||
|
public function copyright_symbol_shortcode( $atts, $content = null ) {
|
||||||
|
return '©';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the [attesa_registered_trademark] shortcode
|
||||||
|
*
|
||||||
|
* @since 1.1.8
|
||||||
|
*/
|
||||||
|
public function registered_trademark_symbol_shortcode( $atts, $content = null ) {
|
||||||
|
return '®';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the [attesa_qrcode] shortcode
|
||||||
|
*
|
||||||
|
* @since 1.1.8
|
||||||
|
*/
|
||||||
|
public function registered_qrcode_shortcode( $atts, $content = null ) {
|
||||||
|
$atts = shortcode_atts(
|
||||||
|
array(
|
||||||
|
'url' => '',
|
||||||
|
'size' => 200,
|
||||||
|
'color' => '#000000',
|
||||||
|
'background' => '#ffffff',
|
||||||
|
'format' => 'png',
|
||||||
|
'position' => 'center',
|
||||||
|
),
|
||||||
|
$atts,
|
||||||
|
'attesa_qrcode'
|
||||||
|
);
|
||||||
|
if ( ! $atts['url'] ) {
|
||||||
|
return '<p>' . esc_html__('Please enter a valid URL to generate the QR code', 'attesa-extra') . '</p>';
|
||||||
|
}
|
||||||
|
$url = add_query_arg(
|
||||||
|
array(
|
||||||
|
'data' => rawurlencode( $atts['url'] ),
|
||||||
|
'size' => sprintf( '%1$sx%1$s', intval( $atts['size'] ) ),
|
||||||
|
'format' => $atts['format'],
|
||||||
|
'color' => ltrim( $atts['color'], '#' ),
|
||||||
|
'bgcolor' => ltrim( $atts['background'], '#' ),
|
||||||
|
),
|
||||||
|
'https://api.qrserver.com/v1/create-qr-code/'
|
||||||
|
);
|
||||||
|
return '<div class="attesa-extra-qrcode ' . esc_attr($atts['position']) . '"><img src="' . esc_url( $url ) . '" /></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new AttesaExtra_Shortcodes();
|
||||||
665
wp-content/plugins/attesa-extra/panel/assets/css/demos.css
Normal file
665
wp-content/plugins/attesa-extra/panel/assets/css/demos.css
Normal file
@ -0,0 +1,665 @@
|
|||||||
|
.awp-clr:after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
visibility: hidden;
|
||||||
|
clear: both;
|
||||||
|
zoom: 1;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-about-description {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-about-description p {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.8;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap hr {
|
||||||
|
margin: 32px 0 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .themes {
|
||||||
|
margin: 0 -15px;
|
||||||
|
min-width: 100% !important; /* Fix the zoom image bug */
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-header-bar {
|
||||||
|
display: inline-block;
|
||||||
|
width: -webkit-calc(100% - 40px);
|
||||||
|
width: calc(100% - 40px);
|
||||||
|
margin: 20px 0 30px;
|
||||||
|
padding: 0 20px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation {
|
||||||
|
font-size: 13px;
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation ul {
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li {
|
||||||
|
float: left;
|
||||||
|
margin: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li.active a,
|
||||||
|
.awp-demo-wrap .awp-navigation li.active a:hover {
|
||||||
|
border-bottom: 4px solid #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li a {
|
||||||
|
display: block;
|
||||||
|
padding: 15px 0;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #444;
|
||||||
|
border-bottom: 4px solid #fff;
|
||||||
|
outline: 0;
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li a:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #00a0d2;
|
||||||
|
border-bottom: 4px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-search-input {
|
||||||
|
width: 100%;
|
||||||
|
margin: 10px 0;
|
||||||
|
-webkit-transition: 50ms border-color ease-in-out;
|
||||||
|
transition: 50ms border-color ease-in-out;
|
||||||
|
outline: 0;
|
||||||
|
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .07);
|
||||||
|
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme-wrap {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 33.33%;
|
||||||
|
padding: 0 15px 30px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme-wrap.awp_is_free:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "Free";
|
||||||
|
top: 1px;
|
||||||
|
right: 16px;
|
||||||
|
z-index: 9;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: #07de49;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme-wrap.awp_is_pro:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "PRO";
|
||||||
|
top: 1;
|
||||||
|
right: 16px;
|
||||||
|
z-index: 9;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: #f06292;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme {
|
||||||
|
float: none;
|
||||||
|
width: 100% !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-is-fadeout {
|
||||||
|
-webkit-animation: awp-fade linear 200ms 1 forwards;
|
||||||
|
animation: awp-fade linear 200ms 1 forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-is-fadein {
|
||||||
|
-webkit-animation: awp-fade linear 200ms 1 reverse forwards;
|
||||||
|
animation: awp-fade linear 200ms 1 reverse forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes awp-fade {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes awp-fade {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-import-loader {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-import-loader.preview-all {
|
||||||
|
background: rgba(255, 255, 255, .7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-import-loader i {
|
||||||
|
font-size: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
position: relative;
|
||||||
|
top: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
margin: -16px auto 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-icon i.custom-loader:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -15px;
|
||||||
|
margin-top: -15px;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
opacity: .8;
|
||||||
|
border-width: 3px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: rgba(0,0,0,0.2);
|
||||||
|
border-left-color: #000;
|
||||||
|
z-index: 99;
|
||||||
|
-webkit-border-radius: 50%;
|
||||||
|
-moz-border-radius: 50%;
|
||||||
|
-ms-border-radius: 50%;
|
||||||
|
border-radius: 50%;
|
||||||
|
-ms-animation: spinner 0.6s infinite linear;
|
||||||
|
-webkit-animation: spinner 0.6s infinite linear;
|
||||||
|
-o-animation: spinner 0.6s infinite linear;
|
||||||
|
-moz-animation: spinner 0.6s infinite linear;
|
||||||
|
animation: spinner 0.6s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-icon i {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes spinner {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spinner {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-wrap {
|
||||||
|
display: none;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-wrap,
|
||||||
|
#awp-demo-popup-wrap .awp-demo-popup-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 99999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-overlay {
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-container {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-container:before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
height: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-content-wrap {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: left;
|
||||||
|
max-width: 100%;
|
||||||
|
z-index: 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-content-inner {
|
||||||
|
position: relative;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 600px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
z-index: 1000;
|
||||||
|
-webkit-box-shadow: 3px 3px 20px 0 rgba(0, 0, 0, 0.15);
|
||||||
|
-moz-box-shadow: 3px 3px 20px 0 rgba(0, 0, 0, 0.15);
|
||||||
|
box-shadow: 3px 3px 20px 0 rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-content-inner a {
|
||||||
|
text-decoration: none;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-content-inner .awp-demo-popup-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
color: #333;
|
||||||
|
opacity: .5;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 40px;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-popup-content-inner .awp-demo-popup-close:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-content h2.title {
|
||||||
|
position: relative;
|
||||||
|
font-size: 15px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 25px 15px 18px;
|
||||||
|
margin: 0 0 20px;
|
||||||
|
letter-spacing: 0.6px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-content h2.title:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -43px;
|
||||||
|
display: inline-block;
|
||||||
|
width: 86px;
|
||||||
|
height: 2px;
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-popup-text {
|
||||||
|
padding: 0 30px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-popup-text p {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 0 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins-wrap {
|
||||||
|
border-top: 3px solid #eaeaea;
|
||||||
|
padding-top: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins-wrap h3 {
|
||||||
|
margin: 0 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins {
|
||||||
|
margin: 25px auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins .awp-plugin {
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 1px solid #eaeaea;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins .awp-plugin:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins h2 {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 28px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-required-plugins .button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-content .awp-button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #f06292;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px 20px;
|
||||||
|
border: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: .1em;
|
||||||
|
line-height: 1;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none !important;
|
||||||
|
-webkit-transition: all .3s ease;
|
||||||
|
-moz-transition: all .3s ease;
|
||||||
|
-ms-transition: all .3s ease;
|
||||||
|
-o-transition: all .3s ease;
|
||||||
|
transition: all .3s ease;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-popup-content .awp-button:hover {
|
||||||
|
background-color: #bd3563;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-import-form,
|
||||||
|
.awp-loader,
|
||||||
|
.awp-last {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#awp-demo-import-form ul.awp-popup-text,
|
||||||
|
.awp-loader .awp-import-status {
|
||||||
|
width: 360px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 30px auto 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status p {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status p:before {
|
||||||
|
display: inline-block;
|
||||||
|
font: 400 18px/1 dashicons;
|
||||||
|
vertical-align: bottom;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status .awp-imported:before {
|
||||||
|
content: '\f147';
|
||||||
|
color: #79ba49;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status .awp-importing:before {
|
||||||
|
content: '\f463';
|
||||||
|
color: #f56e28;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-webkit-animation: spinner 2s infinite linear;
|
||||||
|
animation: spinner 2s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status .awp-importing-failed {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-loader .awp-import-status .awp-importing-failed:before {
|
||||||
|
content: '\f158';
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last {
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last .checkmark {
|
||||||
|
display: block;
|
||||||
|
width: 130px;
|
||||||
|
height: 130px;
|
||||||
|
margin: 0 auto;
|
||||||
|
-webkit-animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
|
||||||
|
animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
|
||||||
|
border-radius: 50%;
|
||||||
|
-webkit-box-shadow: inset 0 0 0 #5bc142;
|
||||||
|
box-shadow: inset 0 0 0 #5bc142;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-miterlimit: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last .checkmark-circle {
|
||||||
|
-webkit-animation: stroke .6s cubic-bezier(.65, 0, .45, 1) forwards;
|
||||||
|
animation: stroke .6s cubic-bezier(.65, 0, .45, 1) forwards;
|
||||||
|
stroke-dasharray: 166;
|
||||||
|
stroke-dashoffset: 166;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke-miterlimit: 10;
|
||||||
|
stroke: #5bc142;
|
||||||
|
fill: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last .checkmark-check {
|
||||||
|
-webkit-transform-origin: 50% 50%;
|
||||||
|
-ms-transform-origin: 50% 50%;
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
-webkit-animation: stroke .3s cubic-bezier(.65, 0, .45, 1) .8s forwards;
|
||||||
|
animation: stroke .3s cubic-bezier(.65, 0, .45, 1) .8s forwards;
|
||||||
|
stroke-dasharray: 48;
|
||||||
|
stroke-dashoffset: 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes stroke {
|
||||||
|
100% {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes stroke {
|
||||||
|
100% {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes scale {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
-webkit-transform: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-transform: scale3d(1.1, 1.1, 1);
|
||||||
|
transform: scale3d(1.1, 1.1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scale {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
-webkit-transform: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-transform: scale3d(1.1, 1.1, 1);
|
||||||
|
transform: scale3d(1.1, 1.1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fill {
|
||||||
|
100% {
|
||||||
|
-webkit-box-shadow: inset 0 0 0 100px #5bc142;
|
||||||
|
box-shadow: inset 0 0 0 100px #5bc142;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fill {
|
||||||
|
100% {
|
||||||
|
-webkit-box-shadow: inset 0 0 0 100px #5bc142;
|
||||||
|
box-shadow: inset 0 0 0 100px #5bc142;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last h3 {
|
||||||
|
font-size: 20px;
|
||||||
|
margin: 30px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last p {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last a {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
border-bottom: 2px solid;
|
||||||
|
margin-top: 6px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-last a:after {
|
||||||
|
content: '\f345';
|
||||||
|
font: 400 16px/1 dashicons;
|
||||||
|
vertical-align: bottom;
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RTL */
|
||||||
|
.rtl .awp-demo-wrap .theme-wrap,
|
||||||
|
.rtl .awp-demo-wrap .awp-navigation,
|
||||||
|
.rtl .awp-demo-wrap .awp-navigation li {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .awp-demo-popup-content-wrap {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .awp-demo-popup-content-inner .awp-demo-popup-close {
|
||||||
|
left: 0;
|
||||||
|
right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .awp-required-plugins .button {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive */
|
||||||
|
@media only screen and (min-width: 1640px) {
|
||||||
|
.awp-demo-wrap .theme-wrap {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
.awp-demo-wrap .theme-wrap {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 850px) {
|
||||||
|
.awp-demo-popup-container:before {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 780px) {
|
||||||
|
.awp-demo-wrap .theme {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme-actions {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .theme-browser .theme .theme-actions .button-primary {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 640px) {
|
||||||
|
.awp-demo-wrap .awp-navigation {
|
||||||
|
width: -webkit-calc(100% - 180px);
|
||||||
|
width: calc(100% - 180px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-navigation li a {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awp-demo-wrap .awp-search-input {
|
||||||
|
display: inline-block;
|
||||||
|
width: 180px;
|
||||||
|
height: 30px;
|
||||||
|
margin: 0;
|
||||||
|
margin-top: 11px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 580px) {
|
||||||
|
.awp-demo-wrap .theme-wrap {
|
||||||
|
float: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
wp-content/plugins/attesa-extra/panel/assets/css/demos.min.css
vendored
Normal file
1
wp-content/plugins/attesa-extra/panel/assets/css/demos.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
50
wp-content/plugins/attesa-extra/panel/assets/css/message.css
Normal file
50
wp-content/plugins/attesa-extra/panel/assets/css/message.css
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
.attesa-message {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.attesa-message a.button-primary,
|
||||||
|
.attesa-message a.button-secondary {
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
.attesa-message a.attesa-message-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 10px 15px 10px 21px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.23076923;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.attesa-message a.attesa-message-close:before {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
left: 0;
|
||||||
|
-webkit-transition: all .1s ease-in-out;
|
||||||
|
transition: all .1s ease-in-out;
|
||||||
|
}
|
||||||
|
.awp-message-inner {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.awp-icon, .awp-notice {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.awp-icon img {
|
||||||
|
max-width: 50px;
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.awp-notice {
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
.awp-notice .awp-text {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
/* CSS for the PRO features admin page */
|
||||||
|
.attesa-pro-col:before,
|
||||||
|
.attesa-pro-col:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
.attesa-pro-col:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.about-wrap {
|
||||||
|
margin: 25px auto 20px;
|
||||||
|
}
|
||||||
|
.about-wrap h1 {
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.about-wrap h4 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.about-wrap .two-col .col {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: center;
|
||||||
|
background: #e5e5e5;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin: 1%;
|
||||||
|
width: 31%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.about-wrap .two-col .col.w2 {
|
||||||
|
width: 48%;
|
||||||
|
}
|
||||||
|
.attesa-pro-col > div:nth-child(3n+1) {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.about-wrap .col h3,
|
||||||
|
.about-wrap .two-col img {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.attesa-get-pro {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.attesa-get-pro a {
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #f06292;
|
||||||
|
margin: 1%;
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 120%;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
border-radius: 5px;
|
||||||
|
border-bottom: 3px solid rgba(0,0,0,0.2);
|
||||||
|
-o-transition: background-color .3s ease-in-out;
|
||||||
|
-moz-transition: background-color .3s ease-in-out;
|
||||||
|
-webkit-transition: background-color .3s ease-in-out;
|
||||||
|
transition: background-color .3s ease-in-out;
|
||||||
|
}
|
||||||
|
.attesa-get-pro a:hover,
|
||||||
|
.attesa-get-pro a:focus,
|
||||||
|
.attesa-get-pro a:active {
|
||||||
|
background-color: #bd3563;
|
||||||
|
}
|
||||||
|
@media all and (max-width: 850px) {
|
||||||
|
.about-wrap .two-col .col {
|
||||||
|
width: 48%;
|
||||||
|
}
|
||||||
|
.attesa-pro-col > div:nth-child(3n+1) {
|
||||||
|
clear: none;
|
||||||
|
}
|
||||||
|
.attesa-pro-col > div:nth-child(2n+1) {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
.about-wrap .two-col .col,
|
||||||
|
.about-wrap .two-col .col.w2 {
|
||||||
|
width: 98%;
|
||||||
|
}
|
||||||
|
.attesa-pro-col > div:nth-child(2n+1) {
|
||||||
|
clear: none;
|
||||||
|
}
|
||||||
|
.attesa-pro-col > div:nth-child(1n+1) {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
}
|
||||||
226
wp-content/plugins/attesa-extra/panel/assets/css/welcome.css
Normal file
226
wp-content/plugins/attesa-extra/panel/assets/css/welcome.css
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
.about-wrap .under-the-hood {
|
||||||
|
max-width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
pre.changelog {
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(50%, #f5f5f5), color-stop(50%, #e6e6e6));
|
||||||
|
background-image: -webkit-linear-gradient(#f5f5f5 50%, #e6e6e6 50%);
|
||||||
|
background-image: linear-gradient(#f5f5f5 50%,#e6e6e6 50%);
|
||||||
|
background-size: 38px 38px;
|
||||||
|
border: 1px solid #d4d4d4;
|
||||||
|
display: block;
|
||||||
|
line-height: 19px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
overflow: visible;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding: 0 0 0 4px;
|
||||||
|
}
|
||||||
|
pre.changelog span {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.return-to-dashboard.attesa {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
p.attesa-actions a.skip {
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
.about-wrap .two-col .col {
|
||||||
|
margin: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: center;
|
||||||
|
background: #e5e5e5;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
p.attesa-actions a.docs:focus,
|
||||||
|
p.attesa-actions a.docs:hover,
|
||||||
|
p.attesa-actions a.skip:focus,
|
||||||
|
p.attesa-actions a.skip:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
p.attesa-actions a.button-primary,
|
||||||
|
p.attesa-actions a.button-secondary {
|
||||||
|
text-decoration: none!important;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.about-wrap {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.about-wrap h1 {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 38px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.welcome-description-wrap {
|
||||||
|
width: 100%;
|
||||||
|
margin: 20px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.about-wrap .about-text {
|
||||||
|
margin: 20px 10px;
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
.attesa-screenshot {
|
||||||
|
margin: 20px 10px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.attesa-screenshot img {
|
||||||
|
box-shadow: -5px 5px 5px 0 rgba(0,0,0,0.12);
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.about-wrap table td h3 {
|
||||||
|
margin: 15px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.wrap table {
|
||||||
|
border: 1px solid #e1e1e1;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
.wrap table th {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
.wrap table td:first-child {
|
||||||
|
background: rgba(255,255,255,0.4);
|
||||||
|
}
|
||||||
|
.about-wrap table td .table-desc {
|
||||||
|
font-size: 15px;
|
||||||
|
margin: 20px;
|
||||||
|
padding-left: 20px;
|
||||||
|
display: block;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.about-wrap table .table-feature-title > h3 {
|
||||||
|
color: #404040;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.wrap table th:first-child {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.wrap table th:nth-child(2) {
|
||||||
|
background-color: #ffa2c1;
|
||||||
|
}
|
||||||
|
.wrap table th:nth-child(3) {
|
||||||
|
background-color: #f06292;
|
||||||
|
}
|
||||||
|
.wrap table th:last-child {
|
||||||
|
background-color: #bd3563;
|
||||||
|
}
|
||||||
|
.wrap table th h3 {
|
||||||
|
color: #fff;
|
||||||
|
margin: 15px;
|
||||||
|
}
|
||||||
|
tr:nth-child(2n) {
|
||||||
|
background-color: #e7e7e7;
|
||||||
|
}
|
||||||
|
.wrap table td span {
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
.wrap table td .dashicons.dashicons-no {
|
||||||
|
color: #CE2D2D;
|
||||||
|
}
|
||||||
|
.wrap table td .dashicons.dashicons-yes {
|
||||||
|
color: #24B37E;
|
||||||
|
}
|
||||||
|
table tr .btn-wrapper {
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
table tr .btn-wrapper .button {
|
||||||
|
background-color: #f06292;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 0;
|
||||||
|
padding: 27px 0;
|
||||||
|
width: 59%;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
table tr .btn-wrapper .button:hover,
|
||||||
|
table tr .btn-wrapper .button:focus {
|
||||||
|
background: #bd3563 none repeat scroll 0 0;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.option-panel-toggle {
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group:before,
|
||||||
|
.attesa-changelog-group:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group .attesa-changelog {
|
||||||
|
float: left;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group.withpro .attesa-changelog {
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group.nopro .attesa-changelog {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group pre.changelog {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
@media (max-width: 1400px) {
|
||||||
|
.about-wrap h1 {
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
.about-wrap .about-text {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.about-wrap .about-text {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.about-wrap table td h3,
|
||||||
|
.about-wrap table td {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 980px) {
|
||||||
|
.about-wrap h1 {
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
.about-wrap .about-text,
|
||||||
|
.attesa-screenshot {
|
||||||
|
float: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group.withpro .attesa-changelog,
|
||||||
|
.attesa-changelog-group.nopro .attesa-changelog {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.attesa-changelog-group pre.changelog {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.about-wrap .under-the-hood,
|
||||||
|
.welcome-description-wrap {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.about-wrap .about-text {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 418 B |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user