Skip to content

Commit

Permalink
minor js bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipsesrl committed Nov 28, 2019
1 parent fa9b5a5 commit 116370a
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 76 deletions.
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.udesly.com/
Tags: webflow to wordpress, editor, page builder, layout design, udesly, webflow
Requires at least: 5.0
Tested up to: 5.2.3
Stable tag: 2.0.0.41
Stable tag: 2.0.0.42
License: GPLv3 or later
License URI: https://www.udesly.com/terms-conditions-of-use/#udesly-wordpress-plugin
Requires PHP: 5.6.0
Expand Down Expand Up @@ -80,6 +80,9 @@ That's all!

Absolutely! You can use the Udesly Adapter to create more than one website.
== Changelog ==
= 2.0.0.42 =
* Fixed minor wc js bug

= 2.0.0.41 =
* Fixed minor css bug

Expand Down
2 changes: 1 addition & 1 deletion assets/js/bundle/udesly-wf-wc.bundle.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions includes/Core/Udesly.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function add_public_hooks()
Posts::public_hooks();
Taxonomies::public_hooks();
Scripts::public_hooks();
DataManager::public_hooks();
FrontendEditorType::public_hooks();
Box::public_hooks();
Rule::public_hooks();
Expand Down
122 changes: 122 additions & 0 deletions includes/Theme/DataManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Udesly\Theme;

use mysql_xdevapi\Exception;
use Udesly\FrontendEditor\FrontendEditorType;
if (!defined('WPINC') || !defined('ABSPATH')) {
die;
Expand All @@ -20,6 +21,11 @@ public static function get_theme_udesly_data_path()
return self::get_theme_data_folder_path() . 'udesly-data.json';
}

public static function get_options_udesly_data_path()
{
return self::get_theme_data_folder_path() . 'udesly-customizer-options.json';
}

public static function is_udesly_theme_active()
{
return file_exists(self::get_theme_udesly_data_path());
Expand All @@ -38,6 +44,122 @@ public static function admin_hooks()
add_action("delete_post", array(self::class, "udesly_delete_check_data"));
}

public static function public_hooks() {
add_action( 'customize_register', array(self::class, 'register_customizer') );
}

public static function register_customizer( $wp_customize ) {
//All our sections, settings, and controls will be added here

$path = self::get_options_udesly_data_path();
if (!file_exists($path)) {
return;
}
try {
$file = file_get_contents($path);
$options = json_decode($file);
if (!$options) {
return;
}
$options = (array) $options;

if (count($options) == 0) {
return;
}

$wp_customize->add_panel('udesly_panel', array(
'title'=>'Your Theme',
'description'=> 'Theme Options',
'priority'=> 10,
));

$section_id = 'udesly_theme_section';
$wp_customize->add_section( $section_id , array(
'title' => __( 'Theme Options', 'udesly' ),
'priority' => 30,
'panel' => 'udesly_panel'
) );

foreach ($options as $key => $option) {
switch ($option->type) {
case "text":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control(
$option->slug,
array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
'type' => 'text'
)
);
break;
case "textarea":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control(
$option->slug,
array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
'type' => 'textarea'
)
);
break;
case "url":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control(
$option->slug,
array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
'type' => 'url'
)
);
break;
case "number":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control(
$option->slug,
array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
'type' => 'number'
)
);
break;
case "image":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control(
new \WP_Customize_Image_Control(
$wp_customize,
$option->slug,
array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
)
)
);
break;
case "color":
$wp_customize->add_setting($option->slug, array('default' => $option->default));
$wp_customize->add_control( new \WP_Customize_Color_Control( $wp_customize, $option->slug, array(
'label' => $option->label,
'section' => $section_id,
'settings' => $option->slug,
) ) );
break;
}
}

} catch(\Exception $e) {
return;
}
}

public static function udesly_delete_check_data() {
delete_transient("_udesly_last_checked_data");
delete_transient("_udesly_cached_checked_data");
Expand Down
Loading

0 comments on commit 116370a

Please sign in to comment.