From fc44d1b308821e232c830788f6f550105889d4b2 Mon Sep 17 00:00:00 2001
From: zzhenryquezz <43827016+zzhenryquezz@users.noreply.github.com>
Date: Sat, 22 Dec 2018 21:52:00 -0200
Subject: [PATCH 1/2] Check if class exits before run the file
Just a check to prevent some issue if the class don't exist
---
.../alpha-color-picker/alpha-color-picker.php | 128 +++++++++---------
1 file changed, 65 insertions(+), 63 deletions(-)
diff --git a/customizer/alpha-color-picker/alpha-color-picker.php b/customizer/alpha-color-picker/alpha-color-picker.php
index 483d3f4..e199add 100644
--- a/customizer/alpha-color-picker/alpha-color-picker.php
+++ b/customizer/alpha-color-picker/alpha-color-picker.php
@@ -19,75 +19,77 @@
* You should have received a copy of the GNU General Public License
* along with this Alpha Color Picker. If not, see .
*/
-class Customize_Alpha_Color_Control extends WP_Customize_Control {
+if(class_exists('WP_Customize_Control')){
+ class Customize_Alpha_Color_Control extends WP_Customize_Control {
- /**
- * Official control name.
- */
- public $type = 'alpha-color';
+ /**
+ * Official control name.
+ */
+ public $type = 'alpha-color';
- /**
- * Add support for palettes to be passed in.
- *
- * Supported palette values are true, false, or an array of RGBa and Hex colors.
- */
- public $palette;
+ /**
+ * Add support for palettes to be passed in.
+ *
+ * Supported palette values are true, false, or an array of RGBa and Hex colors.
+ */
+ public $palette;
- /**
- * Add support for showing the opacity value on the slider handle.
- */
- public $show_opacity;
+ /**
+ * Add support for showing the opacity value on the slider handle.
+ */
+ public $show_opacity;
- /**
- * Enqueue scripts and styles.
- *
- * Ideally these would get registered and given proper paths before this control object
- * gets initialized, then we could simply enqueue them here, but for completeness as a
- * stand alone class we'll register and enqueue them here.
- */
- public function enqueue() {
- wp_enqueue_script(
- 'alpha-color-picker',
- get_stylesheet_directory_uri() . '/admin/customizer/alpha-color-picker/alpha-color-picker.js',
- array( 'jquery', 'wp-color-picker' ),
- '1.0.0',
- true
- );
- wp_enqueue_style(
- 'alpha-color-picker',
- get_stylesheet_directory_uri() . '/admin/customizer/alpha-color-picker/alpha-color-picker.css',
- array( 'wp-color-picker' ),
- '1.0.0'
- );
- }
-
- /**
- * Render the control.
- */
- public function render_content() {
-
- // Process the palette
- if ( is_array( $this->palette ) ) {
- $palette = implode( '|', $this->palette );
- } else {
- // Default to true.
- $palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
+ /**
+ * Enqueue scripts and styles.
+ *
+ * Ideally these would get registered and given proper paths before this control object
+ * gets initialized, then we could simply enqueue them here, but for completeness as a
+ * stand alone class we'll register and enqueue them here.
+ */
+ public function enqueue() {
+ wp_enqueue_script(
+ 'alpha-color-picker',
+ get_stylesheet_directory_uri() . '/admin/customizer/alpha-color-picker/alpha-color-picker.js',
+ array( 'jquery', 'wp-color-picker' ),
+ '1.0.0',
+ true
+ );
+ wp_enqueue_style(
+ 'alpha-color-picker',
+ get_stylesheet_directory_uri() . '/admin/customizer/alpha-color-picker/alpha-color-picker.css',
+ array( 'wp-color-picker' ),
+ '1.0.0'
+ );
}
- // Support passing show_opacity as string or boolean. Default to true.
- $show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
+ /**
+ * Render the control.
+ */
+ public function render_content() {
- // Begin the output. ?>
-
- show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
+
+ // Begin the output. ?>
+
+
Date: Sat, 22 Dec 2018 22:45:09 -0200
Subject: [PATCH 2/2] Fix Missing the span name of the inputs
---
customizer/alpha-color-picker/alpha-color-picker.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/customizer/alpha-color-picker/alpha-color-picker.php b/customizer/alpha-color-picker/alpha-color-picker.php
index e199add..2b1a9d8 100644
--- a/customizer/alpha-color-picker/alpha-color-picker.php
+++ b/customizer/alpha-color-picker/alpha-color-picker.php
@@ -79,6 +79,11 @@ public function render_content() {
$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
// Begin the output. ?>
+ label){
+ echo '' . sanitize_text_field( $this->label ) . '';
+ }
+ ?>