Initial commit
This commit is contained in:
61
wp-content/plugins/gp-premium/backgrounds/functions/css.php
Normal file
61
wp-content/plugins/gp-premium/backgrounds/functions/css.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'GeneratePress_Backgrounds_CSS' ) ) {
|
||||
class GeneratePress_Backgrounds_CSS {
|
||||
|
||||
protected $_selector = '';
|
||||
protected $_selector_output = '';
|
||||
protected $_css = '';
|
||||
protected $_output = '';
|
||||
|
||||
public function set_selector( $selector = '' ) {
|
||||
// Render the css in the output string everytime the selector changes
|
||||
if ( $this->_selector !== '' ) {
|
||||
$this->add_selector_rules_to_output();
|
||||
}
|
||||
|
||||
$this->_selector = $selector;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function add_property( $property, $value, $url = '' ) {
|
||||
// If we don't have a value or our value is the same as our og default, bail
|
||||
if ( empty( $value ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set up our background image URL param if needed
|
||||
$url_start = ( '' !== $url ) ? "url('" : "";
|
||||
$url_end = ( '' !== $url ) ? "')" : "";
|
||||
|
||||
$this->_css .= $property . ':' . $url_start . $value . $url_end . ';';
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function add_selector_rules_to_output() {
|
||||
if ( ! empty( $this->_css ) ) {
|
||||
$this->_selector_output = $this->_selector;
|
||||
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
|
||||
|
||||
$this->_output .= $selector_output;
|
||||
|
||||
// Reset the css
|
||||
$this->_css = '';
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function css_output() {
|
||||
// Add current selector's rules to output
|
||||
$this->add_selector_rules_to_output();
|
||||
|
||||
// Output minified css
|
||||
return $this->_output;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
1315
wp-content/plugins/gp-premium/backgrounds/functions/functions.php
Normal file
1315
wp-content/plugins/gp-premium/backgrounds/functions/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,424 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! function_exists( 'generate_backgrounds_secondary_nav_customizer' ) ) {
|
||||
add_action( 'customize_register', 'generate_backgrounds_secondary_nav_customizer', 1000 );
|
||||
/**
|
||||
* Adds our Secondary Nav background image options
|
||||
*
|
||||
* These options are in their own function so we can hook it in late to
|
||||
* make sure Secondary Nav is activated.
|
||||
*
|
||||
* 1000 priority is there to make sure Secondary Nav is registered (999)
|
||||
* as we check to see if the layout control exists.
|
||||
*
|
||||
* Secondary Nav now uses 100 as a priority.
|
||||
*/
|
||||
function generate_backgrounds_secondary_nav_customizer( $wp_customize ) {
|
||||
// Bail if we don't have our defaults
|
||||
if ( ! function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure Secondary Nav is activated
|
||||
if ( ! $wp_customize->get_section( 'secondary_nav_section' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our defaults
|
||||
$defaults = generate_secondary_nav_get_defaults();
|
||||
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' );
|
||||
}
|
||||
|
||||
// Get our controls
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// Add our section
|
||||
$wp_customize->add_section(
|
||||
'secondary_bg_images_section',
|
||||
array(
|
||||
'title' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'description' => '',
|
||||
'panel' => 'generate_backgrounds_panel',
|
||||
'priority' => 21,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Section_Shortcut_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_navigation_background_image_shortcuts',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'element' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'shortcuts' => array(
|
||||
'layout' => 'secondary_nav_section',
|
||||
'colors' => 'secondary_navigation_color_section',
|
||||
'typography' => 'secondary_font_section',
|
||||
),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'priority' => 1,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_image]', array(
|
||||
'default' => $defaults['nav_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_image]',
|
||||
'priority' => 750,
|
||||
'label' => __( 'Navigation', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_repeat]',
|
||||
'priority' => 800
|
||||
)
|
||||
);
|
||||
|
||||
// Item background
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_image]', array(
|
||||
'default' => $defaults['nav_item_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_image]',
|
||||
'priority' => 950,
|
||||
'label' => __( 'Navigation Item', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Item repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
'priority' => 1000
|
||||
)
|
||||
);
|
||||
|
||||
// Item hover
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_hover_image]', array(
|
||||
'default' => $defaults['nav_item_hover_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-hover-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_hover_image]',
|
||||
'priority' => 1150,
|
||||
'label' => __( 'Navigation Item Hover', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Item hover repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_hover_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
'priority' => 1200,
|
||||
)
|
||||
);
|
||||
|
||||
// Current background
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_current_image]', array(
|
||||
'default' => $defaults['nav_item_current_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-current-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_current_image]',
|
||||
'priority' => 1350,
|
||||
'label' => __( 'Navigation Item Current', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Current repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_current_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
'priority' => 1400,
|
||||
)
|
||||
);
|
||||
|
||||
// Sub-navigation section
|
||||
$wp_customize->add_section(
|
||||
'secondary_subnav_bg_images_section',
|
||||
array(
|
||||
'title' => __( 'Secondary Sub-Navigation', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'description' => '',
|
||||
'panel' => 'generate_backgrounds_panel',
|
||||
'priority' => 22,
|
||||
)
|
||||
);
|
||||
|
||||
// Item background
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_image]', array(
|
||||
'default' => $defaults['sub_nav_item_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_image]',
|
||||
'priority' => 1700,
|
||||
'label' => __( 'Sub-Navigation Item', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Item repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
'priority' => 1800
|
||||
)
|
||||
);
|
||||
|
||||
// Item hover
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_image]', array(
|
||||
'default' => $defaults['sub_nav_item_hover_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-hover-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_hover_image]',
|
||||
'priority' => 2000,
|
||||
'label' => __( 'Sub-Navigation Item Hover', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Item hover repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_hover_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
'priority' => 2100,
|
||||
)
|
||||
);
|
||||
|
||||
// Current background
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_image]', array(
|
||||
'default' => $defaults['sub_nav_item_current_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-current-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_current_image]',
|
||||
'priority' => 2300,
|
||||
'label' => __( 'Sub-Navigation Item Current', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Current background repeat
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_current_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
'priority' => 2400,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
Addon Name: Generate Backgrounds
|
||||
Author: Thomas Usborne
|
||||
Author URI: http://edge22.com
|
||||
*/
|
||||
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define the version
|
||||
if ( ! defined( 'GENERATE_BACKGROUNDS_VERSION' ) ) {
|
||||
define( 'GENERATE_BACKGROUNDS_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
Reference in New Issue
Block a user