Skip to content

Commit

Permalink
release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
skyshab committed Apr 27, 2019
1 parent 73c139a commit 1d499b1
Show file tree
Hide file tree
Showing 619 changed files with 4,330 additions and 19,690 deletions.
12 changes: 6 additions & 6 deletions app/Customize/Controls/Color.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Color control
*
* Creates color picker with alpha channel.
*
* Creates color picker with alpha channel.
*
* @package Taproot
* @author Sky Shabatura <[email protected]>
* @copyright 2018 Sky Shabatura
* @copyright 2019 Sky Shabatura
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://taproot-theme.com
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ public function render_content() {
// Process the palette
if ( is_array( $this->palette ) ) {
$palette = implode( '|', $this->palette );
}
}
else {
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
}
Expand All @@ -74,7 +74,7 @@ public function render_content() {
// Output the description if passed in
if ( isset( $this->description ) && '' !== $this->description ) {
echo '<span class="description customize-control-description">' . esc_html( $this->description ) . '</span>';
}
}
?>
<div class="customize-control-content">
<label>
Expand All @@ -83,5 +83,5 @@ public function render_content() {
</div>
<?php
}

}
10 changes: 5 additions & 5 deletions app/Customize/Controls/Font_Styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Taproot
* @author Sky Shabatura <[email protected]>
* @copyright 2018 Sky Shabatura
* @copyright 2019 Sky Shabatura
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://taproot-theme.com
*/
Expand All @@ -16,7 +16,7 @@

/**
* Font style control for Customizer.
*
*
* @since 1.0.0
*/
class Font_Styles extends WP_Customize_Control {
Expand All @@ -27,16 +27,16 @@ class Font_Styles extends WP_Customize_Control {
*
* @since 1.0.0
* @var string
*/
*/
public $type = 'taproot-font-styles';


/**
* Render control markup.
*
* @since 1.0.0
*/
public function render_content()
*/
public function render_content()
{ ?>
<label>
<?php if( ! empty( $this->label ) ) : ?>
Expand Down
8 changes: 4 additions & 4 deletions app/Customize/Controls/Group_Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Taproot
* @author Sky Shabatura <[email protected]>
* @copyright 2018 Sky Shabatura
* @copyright 2019 Sky Shabatura
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://taproot-theme.com
*/
Expand All @@ -16,7 +16,7 @@

/**
* Adds Title for a group of controls.
*
*
* @since 1.0.0
*/
class Group_Title extends WP_Customize_Control {
Expand All @@ -27,15 +27,15 @@ class Group_Title extends WP_Customize_Control {
*
* @since 1.0.0
* @var string
*/
*/
public $type = 'taproot-option-group';


/**
* Render control markup.
*
* @since 1.0.0
*/
*/
public function render_content() {
if( !empty( $this->label ) ) :
printf( '<label class="taproot-group-title">%s</label>', esc_html( $this->label ) );
Expand Down
50 changes: 25 additions & 25 deletions app/Customize/Controls/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Taproot
* @author Sky Shabatura <[email protected]>
* @copyright 2018 Sky Shabatura
* @copyright 2019 Sky Shabatura
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://taproot-theme.com
*/
Expand All @@ -14,7 +14,7 @@
use WP_Customize_Control;


/**
/**
* Range-based sliding value picker for Customizer.
*
* @since 1.0.0
Expand All @@ -27,7 +27,7 @@ class Range extends WP_Customize_Control {
*
* @since 1.0.0
* @var string
*/
*/
public $type = 'taproot-range';


Expand All @@ -41,37 +41,37 @@ class Range extends WP_Customize_Control {
* Render control markup.
*
* @since 1.0.0
*/
public function render_content() {
*/
public function render_content() {

$default_value = $this->settings[0]->default;
$default_number = floatval( $default_value );

// process the unit value
$default_unit = preg_replace('/\d/', '', $default_value );
$default_unit = str_replace('.', '', $default_unit);
$default_unit = ('' != $default_unit ) ? $default_unit : 'unitless';
$default_unit = str_replace('.', '', $default_unit);
$default_unit = ('' != $default_unit ) ? $default_unit : 'unitless';

// is control enabled?
$control_enabled = ( null !== $this->value(1) ) ? $this->value(1) : 1;

// set default values
$value = '';
$value = '';
$numeric_value = '';
$unit_value = '';
$unit_value = '';

// if a value is set
if( $this->value(0) ) {
$value = $this->value(0);
$numeric_value = floatval( $value );
$numeric_value = floatval( $value );
$unit_value = preg_replace('/\d/', '', $value );
$unit_value = str_replace('.', '', $unit_value);
$unit_value = ('' != $unit_value ) ? $unit_value : 'unitless';
}
$unit_value = str_replace('.', '', $unit_value);
$unit_value = ('' != $unit_value ) ? $unit_value : 'unitless';
}
// otherwise, is there a default?
elseif( $default_value ) {
$value = $default_value;
}
elseif( $default_value ) {
$value = $default_value;
}

$attributes = $this->atts;
$input_attrs = isset( $attributes[$unit_value] ) ? $attributes[$unit_value] : [];
Expand Down Expand Up @@ -99,14 +99,14 @@ public function render_content() {
<span class="taproot-range-enable-message"> <?php echo esc_html__('click to enable', 'taproot'); ?> </span>
<input type="range" class="taproot-range" <?php echo $initial_atts; ?> value="<?php echo esc_attr( $numeric_value ); ?>" data-reset_value="<?php echo esc_attr( $default_number ); ?>" />
<input type="number" class="taproot-range-input" <?php echo $initial_atts; ?> value="<?php echo esc_attr( $numeric_value ); ?>" />

<?php $disabled = ( 1 === count($attributes) ) ? 'disabled' : ''; ?>

<select class="taproot-unit" data-reset_value="<?php echo esc_attr( $default_unit ); ?>" <?php echo esc_attr( $disabled ) ?> >
<?php
foreach( $attributes as $unit => $atts ) {
$a_list = $this->get_attributes( $atts );
$unit_name = ( 'unitless' === $unit ) ? '' : $unit;
$a_list = $this->get_attributes( $atts );
$unit_name = ( 'unitless' === $unit ) ? '' : $unit;
printf( '<option value="%s" %s %s>%s</option>', $unit, selected($unit_value, $unit, false), $a_list, $unit_name );
} ?>
</select>
Expand All @@ -125,7 +125,7 @@ public function render_content() {
* Get Attributes markup
*
* @since 1.0.0
*/
*/
public function get_attributes( $atts ) {

$attributes = '';
Expand All @@ -136,15 +136,15 @@ public function get_attributes( $atts ) {

if( isset( $atts['max'] ) ) {
$attributes .= sprintf( 'max="%s" ', $atts['max'] );
}
}

if( isset( $atts['step'] ) ) {
$attributes .= sprintf( 'step="%s" ', $atts['step'] );
}
}

if( isset( $atts['default'] ) ) {
$attributes .= sprintf( 'default="%s" ', $atts['default'] );
}
}

return $attributes;
}
Expand Down
74 changes: 58 additions & 16 deletions app/Customize/Customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @package Taproot
* @author Sky Shabatura <[email protected]>
* @copyright 2018 Sky Shabatura
* @copyright 2019 Sky Shabatura
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://taproot-theme.com
*/
Expand All @@ -35,23 +35,23 @@ class Customize implements Bootable {

/**
* Stores panels object
*
*
* @since 1.0.0
* @var string
*/
*/
private $panels;


/**
* Set up our Panles object
*
* @since 1.0.0
*
*
* @param string $id
* @param array $args
*/
public function __construct() {
$this->panels = new Panels();
$this->panels = new Panels();
}


Expand All @@ -62,22 +62,22 @@ public function __construct() {
* @access public
* @return void
*/
public function boot() {
public function boot() {

// load panels
add_action( 'init', [ $this, 'load_panels' ] );
add_action( 'init', [ $this, 'load_panels' ] );

// Load our controls, callbacks, adjustments and utility functions
add_action( 'customize_register', [ $this, 'customize_register' ] );

// load front facing styles
add_filter( 'rootstrap/styles/public', [ $this, 'panel_styles'] );

// Enqueue scripts and styles.
add_action( 'customize_controls_enqueue_scripts', [ $this, 'controlsEnqueue'] );
add_action( 'customize_preview_init', [ $this, 'previewEnqueue' ] );
}


/**
* Print customizer public styles
Expand All @@ -86,25 +86,67 @@ public function boot() {
*/
public function load_panels() {
$panels = $this->panels;
include_once 'Panels/register-panels.php';
include_once 'Panels/register-panels.php';
}


/**
* Callback for customize register.
*
* Load files for controls, callbacks, utilities and adjustments
*
* Load files for controls, callbacks, utilities and adjustments
*
* @since 1.0.0
* @access public
* @param WP_Customize_Manager $manager Instance of the customize manager.
* @return void
*/
public function customize_register( WP_Customize_Manager $manager ) {
include_once 'functions/functions-controls.php';
include_once 'functions/functions-controls.php';
include_once 'functions/functions-sanitize.php';
include_once 'functions/functions-partials.php';
include_once 'customize-register.php';

// change menus priority
if( $manager->get_panel( 'nav_menus' ) ) {
$manager->get_panel( 'nav_menus' )->priority = 45;
}

// make footer sidebars appear in the customizer last
if( $manager->get_section( 'sidebar-widgets-footer-1' ) ) {
$manager->get_section( 'sidebar-widgets-footer-1' )->priority = 500;
}

if( $manager->get_section( 'sidebar-widgets-footer-2' ) ) {
$manager->get_section( 'sidebar-widgets-footer-2' )->priority = 510;
}

if( $manager->get_section( 'sidebar-widgets-footer-3' ) ) {
$manager->get_section( 'sidebar-widgets-footer-3' )->priority = 520;
}

if( $manager->get_section( 'sidebar-widgets-footer-4' ) ) {
$manager->get_section( 'sidebar-widgets-footer-4' )->priority = 530;
}

// Hide the default colors section
if( $manager->get_section( 'colors' ) ) {
$manager->remove_section( 'colors' );
}

// Rename site icon section
if( $manager->get_section( 'title_tagline' ) ) {
$manager->get_section( 'title_tagline' )->title = __('Site Icon', 'taproot');
$manager->get_section( 'title_tagline' )->panel = 'general';
}

// move to the general settings panel
if( $manager->get_section( 'static_front_page' ) ) {
$manager->get_section( 'static_front_page' )->panel = 'general';
}

// Hide the default show title/tagline controls
if( $manager->get_control( 'display_header_text' ) ) {
$manager->remove_control( 'display_header_text' );
}
}


Expand Down Expand Up @@ -149,5 +191,5 @@ public function controlsEnqueue() {
public function previewEnqueue() {
wp_enqueue_script( 'taproot-customize-preview', asset( 'js/customize-preview.js' ), [ 'customize-preview' ], null, true );
}

}
Loading

0 comments on commit 1d499b1

Please sign in to comment.