Supreme Modules Lite – Divi Theme, Extra Theme and Divi Builder - Version 2.1.4

Version Description

06.05.2020 = * Added: Divi Easy Theme Builder Header. * Enhanced: Divi Supreme setting page. * Enhanced: Check through most files with WordPress Coding Standards to ensures code quality and adherence to coding conventions.

Download this release

Release Info

Developer divisupreme
Plugin Icon 128x128 Supreme Modules Lite – Divi Theme, Extra Theme and Divi Builder
Version 2.1.4
Comparing to
See all releases

Code changes from version 2.1.3 to 2.1.4

admin/css/dsm-plugin.css CHANGED
@@ -52,7 +52,7 @@
52
  display: none;
53
  }
54
 
55
- .dsm-settings-checkbox .slider {
56
  position: absolute;
57
  cursor: pointer;
58
  top: 0;
@@ -64,7 +64,7 @@
64
  transition: .4s;
65
  }
66
 
67
- .dsm-settings-checkbox .slider:before {
68
  position: absolute;
69
  content: "";
70
  height: 16px;
@@ -76,29 +76,37 @@
76
  transition: .4s;
77
  }
78
 
79
- .dsm-settings-checkbox input:checked+.slider {
80
  background-color: #6b09eb;
81
  }
82
 
83
- .dsm-settings-checkbox input:focus+.slider {
84
  box-shadow: 0 0 1px #6b09eb;
85
  }
86
 
87
- .dsm-settings-checkbox input:checked+.slider:before {
88
  -webkit-transform: translateX(26px);
89
  -ms-transform: translateX(26px);
90
  transform: translateX(26px);
91
  }
92
 
93
 
94
- .dsm-settings-checkbox .round {
95
  border-radius: 24px;
96
  }
97
 
98
- .dsm-settings-checkbox .round:before {
99
  border-radius: 50%;
100
  }
101
 
 
 
 
 
 
 
 
 
102
  .dsm-settings-panel p.submit .button-primary {
103
  color: #fff;
104
  border-color: #25db92;
52
  display: none;
53
  }
54
 
55
+ .dsm-settings-checkbox .dsm-settings-slider {
56
  position: absolute;
57
  cursor: pointer;
58
  top: 0;
64
  transition: .4s;
65
  }
66
 
67
+ .dsm-settings-checkbox .dsm-settings-slider:before {
68
  position: absolute;
69
  content: "";
70
  height: 16px;
76
  transition: .4s;
77
  }
78
 
79
+ .dsm-settings-checkbox input:checked+.dsm-settings-slider {
80
  background-color: #6b09eb;
81
  }
82
 
83
+ .dsm-settings-checkbox input:focus+.dsm-settings-slider {
84
  box-shadow: 0 0 1px #6b09eb;
85
  }
86
 
87
+ .dsm-settings-checkbox input:checked+.dsm-settings-slider:before {
88
  -webkit-transform: translateX(26px);
89
  -ms-transform: translateX(26px);
90
  transform: translateX(26px);
91
  }
92
 
93
 
94
+ .dsm-settings-checkbox .dsm-settings-round {
95
  border-radius: 24px;
96
  }
97
 
98
+ .dsm-settings-checkbox .dsm-settings-round:before {
99
  border-radius: 50%;
100
  }
101
 
102
+ .dsm-settings-panel .setting_subheading {
103
+ border-bottom: 1px solid #eee;
104
+ padding: 0 0 1em 0;
105
+ }
106
+ .dsm-settings-panel .setting_subheading_title {
107
+ margin: 0.5em 0;
108
+ }
109
+
110
  .dsm-settings-panel p.submit .button-primary {
111
  color: #fff;
112
  border-color: #25db92;
includes/class-dsm-supreme-modules-for-divi.php CHANGED
@@ -224,6 +224,11 @@ class Dsm_Supreme_Modules_For_Divi {
224
  add_action( 'manage_et_pb_layout_posts_custom_column', array( $this, 'dsm_divi_shortcode_post_columns_content' ) );
225
  }
226
 
 
 
 
 
 
227
  // ContactForm7.
228
  add_filter( 'et_builder_load_actions', array( $this, 'dsm_et_builder_load_cf7' ) );
229
  add_action( 'wp_ajax_nopriv_dsm_load_cf7_library', array( $this, 'dsm_load_cf7_library' ) );
@@ -325,8 +330,9 @@ class Dsm_Supreme_Modules_For_Divi {
325
  */
326
  public function dsm_plugin_action_links( $links ) {
327
  $dsm_go_pro = sprintf(
328
- __( '<a href="' . esc_url( 'https://divisupreme.com/features/' ) . '"" target="_blank" class="dsm-plugin-gopro">%1$s</a>', 'dsm-supreme-modules-for-divi' ),
329
- sprintf( '%s', esc_html__( 'Go Pro', 'dsm-supreme-modules-for-divi' ) )
 
330
  );
331
 
332
  $links[] = $dsm_go_pro;
@@ -504,7 +510,7 @@ class Dsm_Supreme_Modules_For_Divi {
504
  if ( isset( get_post_meta( $post->ID )['dsm-remove-default-footer-meta-box-options'] ) ) {
505
  checked( get_post_meta( $post->ID )['dsm-remove-default-footer-meta-box-options'][0], 'yes' );}
506
  ?>
507
- />
508
  <label for="dsm-remove-default-footer-meta-box-options">Remove default Divi footer</label>
509
  </p>
510
  <p class="dsm-footer-show-on-blank-template-meta-box-options" style="margin-bottom: 0; margin-top: 0;">
@@ -513,7 +519,7 @@ class Dsm_Supreme_Modules_For_Divi {
513
  if ( isset( get_post_meta( $post->ID )['dsm-footer-show-on-blank-template'] ) ) {
514
  checked( get_post_meta( $post->ID )['dsm-footer-show-on-blank-template'][0], 'yes' );}
515
  ?>
516
- />
517
  <label for="dsm-footer-show-on-blank-template">Show on Blank Page Template</label>
518
  </p>
519
  <p class="dsm-footer-show-on-404-template-meta-box-options" style="margin-top: 0;">
@@ -522,7 +528,7 @@ class Dsm_Supreme_Modules_For_Divi {
522
  if ( isset( get_post_meta( $post->ID )['dsm-footer-show-on-404-template'] ) ) {
523
  checked( get_post_meta( $post->ID )['dsm-footer-show-on-404-template'][0], 'yes' );}
524
  ?>
525
- />
526
  <label for="dsm-footer-show-on-404-template">Show on 404 Page</label>
527
  </p>
528
  <p><?php _e( 'Note: Footer Template will only show up on the frontend.', 'dsm-supreme-modules-for-divi' ); ?></p>
@@ -885,6 +891,40 @@ class Dsm_Supreme_Modules_For_Divi {
885
  }
886
  }
887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  /**
889
  * Load Custom CF7
890
  *
224
  add_action( 'manage_et_pb_layout_posts_custom_column', array( $this, 'dsm_divi_shortcode_post_columns_content' ) );
225
  }
226
 
227
+ //Divi Theme Builder.
228
+ if ( $this->settings_api->get_option( 'dsm_theme_builder_header_fixed', 'dsm_theme_builder' ) === 'on' ) {
229
+ add_filter( 'body_class', array( $this, 'dsm_theme_builder_header_css_classes' ) );
230
+ }
231
+
232
  // ContactForm7.
233
  add_filter( 'et_builder_load_actions', array( $this, 'dsm_et_builder_load_cf7' ) );
234
  add_action( 'wp_ajax_nopriv_dsm_load_cf7_library', array( $this, 'dsm_load_cf7_library' ) );
330
  */
331
  public function dsm_plugin_action_links( $links ) {
332
  $dsm_go_pro = sprintf(
333
+ __( '<a href="%2$s" target="_blank" class="dsm-plugin-gopro">%1$s</a>', 'dsm-supreme-modules-for-divi' ),
334
+ sprintf( '%s', esc_html__( 'Go Pro', 'dsm-supreme-modules-for-divi' ) ),
335
+ esc_url( 'https://divisupreme.com/features/' )
336
  );
337
 
338
  $links[] = $dsm_go_pro;
510
  if ( isset( get_post_meta( $post->ID )['dsm-remove-default-footer-meta-box-options'] ) ) {
511
  checked( get_post_meta( $post->ID )['dsm-remove-default-footer-meta-box-options'][0], 'yes' );}
512
  ?>
513
+ />
514
  <label for="dsm-remove-default-footer-meta-box-options">Remove default Divi footer</label>
515
  </p>
516
  <p class="dsm-footer-show-on-blank-template-meta-box-options" style="margin-bottom: 0; margin-top: 0;">
519
  if ( isset( get_post_meta( $post->ID )['dsm-footer-show-on-blank-template'] ) ) {
520
  checked( get_post_meta( $post->ID )['dsm-footer-show-on-blank-template'][0], 'yes' );}
521
  ?>
522
+ />
523
  <label for="dsm-footer-show-on-blank-template">Show on Blank Page Template</label>
524
  </p>
525
  <p class="dsm-footer-show-on-404-template-meta-box-options" style="margin-top: 0;">
528
  if ( isset( get_post_meta( $post->ID )['dsm-footer-show-on-404-template'] ) ) {
529
  checked( get_post_meta( $post->ID )['dsm-footer-show-on-404-template'][0], 'yes' );}
530
  ?>
531
+ />
532
  <label for="dsm-footer-show-on-404-template">Show on 404 Page</label>
533
  </p>
534
  <p><?php _e( 'Note: Footer Template will only show up on the frontend.', 'dsm-supreme-modules-for-divi' ); ?></p>
891
  }
892
  }
893
 
894
+ /**
895
+ * Creates the Divi Supreme Theme Builder Header.
896
+ *
897
+ * @since 2.1.2
898
+ */
899
+
900
+ public function dsm_theme_builder_header_css_classes( $classes ) {
901
+ if ( $this->settings_api->get_option( 'dsm_theme_builder_header_fixed', 'dsm_theme_builder' ) === 'on' ) {
902
+ $classes[] = 'dsm_fixed_header';
903
+ }
904
+ if ( $this->settings_api->get_option( 'dsm_theme_builder_header_auto_calc', 'dsm_theme_builder' ) === 'on' || $this->settings_api->get_option( 'dsm_theme_builder_header_auto_calc', 'dsm_theme_builder' ) === '' ) {
905
+ $classes[] = 'dsm_fixed_header_auto';
906
+ }
907
+ if ( $this->settings_api->get_option( 'dsm_theme_builder_header_shrink', 'dsm_theme_builder' ) === 'on' ) {
908
+ $classes[] = 'dsm_fixed_header_shrink';
909
+ }
910
+ /*
911
+ if ( isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed_devices'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed_devices'] ) {
912
+ $disabled_on_array = get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed_devices'];
913
+ foreach ( $disabled_on_array as $value ) {
914
+ if ( 'phone' === $value ) {
915
+ $classes[] = 'dsm_fixed_header_phone_disable';
916
+ }
917
+ if ( 'tablet' === $value ) {
918
+ $classes[] = 'dsm_fixed_header_tablet_disable';
919
+ }
920
+ if ( 'desktop' === $value ) {
921
+ $classes[] = 'dsm_fixed_header_desktop_disable';
922
+ }
923
+ }
924
+ }*/
925
+ return $classes;
926
+ }
927
+
928
  /**
929
  * Load Custom CF7
930
  *
includes/class.page-settings.php CHANGED
@@ -26,7 +26,7 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
26
 
27
  function admin_menu() {
28
  add_menu_page( __( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ), __( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ), 'manage_options', 'divi_supreme_settings', array( $this, 'plugin_page' ), plugins_url( 'supreme-modules-for-divi/admin/img/icon-128x128.png' ), 99 );
29
- if ( $this->settings_api->get_option( 'dsm_use_header_footer', 'dsm_general' ) == 'on' ) {
30
  add_submenu_page( 'divi_supreme_settings', __( 'Divi Templates', 'dsm-supreme-modules-for-divi' ), __( 'Divi Templates', 'dsm-supreme-modules-for-divi' ), 'manage_options', 'edit.php?post_type=dsm_header_footer' );
31
  }
32
  }
@@ -35,7 +35,11 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
35
  $sections = array(
36
  array(
37
  'id' => 'dsm_general',
38
- 'title' => __( 'Divi Supreme General Settings', 'dsm-supreme-modules-for-divi' ),
 
 
 
 
39
  ),
40
  array(
41
  'id' => 'dsm_settings_social_media',
@@ -60,14 +64,15 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
60
  array(
61
  'name' => 'dsm_section_subtitle',
62
  'class' => 'dsm-section-subtitle',
63
- 'label' => __( '<h3>Divi Supreme Extensions</h3>', 'dsm-supreme-modules-for-divi' ),
64
- 'type' => 'html',
 
65
  ),
66
  array(
67
  'name' => 'dsm_use_scheduled_content',
68
  'class' => 'dsm-settings-checkbox',
69
  'label' => __( 'Enable Scheduled Content on Section & Row', 'dsm-supreme-modules-for-divi' ),
70
- 'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
71
  'type' => 'checkbox',
72
  'default' => 'off',
73
  ),
@@ -75,7 +80,7 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
75
  'name' => 'dsm_use_header_footer',
76
  'class' => 'dsm-settings-checkbox',
77
  'label' => __( 'Enable Divi Templates', 'dsm-supreme-modules-for-divi' ),
78
- 'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
79
  'type' => 'checkbox',
80
  'default' => 'off',
81
  ),
@@ -83,17 +88,107 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
83
  'name' => 'dsm_use_shortcode',
84
  'class' => 'dsm-settings-checkbox',
85
  'label' => __( 'Enable Divi Library Shortcodes', 'dsm-supreme-modules-for-divi' ),
86
- 'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  'type' => 'checkbox',
88
  'default' => 'off',
89
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  ),
91
  'dsm_settings_social_media' => array(
92
  array(
93
  'name' => 'dsm_section_subtitle',
94
  'class' => 'dsm-section-subtitle',
95
- 'label' => __( '<h3>Divi Supreme Social Media Settings</h3>', 'dsm-supreme-modules-for-divi' ),
96
- 'type' => 'html',
 
97
  ),
98
  'dsm_facebook_app_id' => array(
99
  'name' => 'dsm_facebook_app_id',
@@ -108,6 +203,7 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
108
  ),
109
  'dsm_facebook_site_lang' => array(
110
  'name' => 'dsm_facebook_site_lang',
 
111
  'label' => __( 'Facebook Language', 'dsm-supreme-modules-for-divi' ),
112
  'desc' => __( 'Check this box if you would like your Divi Facebook Modules to use your WordPress Site Language instead of the default English(US).', 'dsm-supreme-modules-for-divi' ),
113
  'type' => 'checkbox',
@@ -117,12 +213,14 @@ if ( ! class_exists( 'DSM_Settings' ) ) :
117
  'dsm_settings_misc' => array(
118
  'dsm_uninstall_on_delete' => array(
119
  'name' => 'dsm_uninstall_on_delete',
 
120
  'label' => __( 'Remove Data on Uninstall?', 'dsm-supreme-modules-for-divi' ),
121
  'desc' => __( 'Check this box if you would like Divi Supreme to completely remove all of its data when the plugin is deleted.', 'dsm-supreme-modules-for-divi' ),
122
  'type' => 'checkbox',
123
  ),
124
  'dsm_allow_mime_json_upload' => array(
125
  'name' => 'dsm_allow_mime_json_upload',
 
126
  'label' => __( 'Allow JSON file upload', 'dsm-supreme-modules-for-divi' ),
127
  'desc' => __( 'Check this box if you would like allow JSON file through WordPress Media Uploader.', 'dsm-supreme-modules-for-divi' ),
128
  'type' => 'checkbox',
26
 
27
  function admin_menu() {
28
  add_menu_page( __( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ), __( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ), 'manage_options', 'divi_supreme_settings', array( $this, 'plugin_page' ), plugins_url( 'supreme-modules-for-divi/admin/img/icon-128x128.png' ), 99 );
29
+ if ( $this->settings_api->get_option( 'dsm_use_header_footer', 'dsm_general' ) === 'on' ) {
30
  add_submenu_page( 'divi_supreme_settings', __( 'Divi Templates', 'dsm-supreme-modules-for-divi' ), __( 'Divi Templates', 'dsm-supreme-modules-for-divi' ), 'manage_options', 'edit.php?post_type=dsm_header_footer' );
31
  }
32
  }
35
  $sections = array(
36
  array(
37
  'id' => 'dsm_general',
38
+ 'title' => __( 'General Settings', 'dsm-supreme-modules-for-divi' ),
39
+ ),
40
+ array(
41
+ 'id' => 'dsm_theme_builder',
42
+ 'title' => __( 'Easy Theme Builder', 'dsm-supreme-modules-for-divi' ),
43
  ),
44
  array(
45
  'id' => 'dsm_settings_social_media',
64
  array(
65
  'name' => 'dsm_section_subtitle',
66
  'class' => 'dsm-section-subtitle',
67
+ 'label' => __( 'Divi Supreme Extensions', 'dsm-supreme-modules-for-divi' ),
68
+ 'desc' => __( 'This is where you can enable Divi Extensions.' ),
69
+ 'type' => 'subheading',
70
  ),
71
  array(
72
  'name' => 'dsm_use_scheduled_content',
73
  'class' => 'dsm-settings-checkbox',
74
  'label' => __( 'Enable Scheduled Content on Section & Row', 'dsm-supreme-modules-for-divi' ),
75
+ //'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
76
  'type' => 'checkbox',
77
  'default' => 'off',
78
  ),
80
  'name' => 'dsm_use_header_footer',
81
  'class' => 'dsm-settings-checkbox',
82
  'label' => __( 'Enable Divi Templates', 'dsm-supreme-modules-for-divi' ),
83
+ //'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
84
  'type' => 'checkbox',
85
  'default' => 'off',
86
  ),
88
  'name' => 'dsm_use_shortcode',
89
  'class' => 'dsm-settings-checkbox',
90
  'label' => __( 'Enable Divi Library Shortcodes', 'dsm-supreme-modules-for-divi' ),
91
+ //'desc' => __( '<span class="slider round"></span>', 'dsm-supreme-modules-for-divi' ),
92
+ 'type' => 'checkbox',
93
+ 'default' => 'off',
94
+ ),
95
+ /*
96
+ array(
97
+ 'name' => 'dsm_use_sticky_element',
98
+ 'class' => 'dsm-settings-checkbox',
99
+ 'label' => __( 'Enable Divi Sticky Element', 'dsm-supreme-modules-for-divi' ),
100
+ 'type' => 'checkbox',
101
+ 'default' => 'off',
102
+ ),*/
103
+ ),
104
+ 'dsm_theme_builder' => array(
105
+ array(
106
+ 'name' => 'dsm_theme_builder_header',
107
+ 'label' => __( 'Theme Builder Header', 'dsm-supreme-modules-for-divi' ),
108
+ 'desc' => __( 'Configure Theme Builder Header settings here.' ),
109
+ 'type' => 'subheading',
110
+ ),
111
+ array(
112
+ 'name' => 'dsm_theme_builder_header_fixed',
113
+ 'class' => 'dsm-settings-checkbox',
114
+ 'label' => __( 'Enable Fixed Header', 'dsm-supreme-modules-for-divi' ),
115
+ 'desc' => __( 'This will make the Divi Theme Builder Header stay fixed to the top.', 'dsm-supreme-modules-for-divi' ),
116
+ 'type' => 'checkbox',
117
+ 'default' => 'off',
118
+ ),
119
+ /*
120
+ array(
121
+ 'name' => 'dsm_theme_builder_header_fixed_devices',
122
+ 'label' => __( 'Disable On', 'dsm-supreme-modules-for-divi' ),
123
+ 'desc' => __( 'This will disable the fixed header on selected devices.', 'dsm-supreme-modules-for-divi' ),
124
+ 'type' => 'multicheck',
125
+ 'options' => array(
126
+ 'desktop' => 'Desktop',
127
+ 'tablet' => 'Tablet',
128
+ 'phone' => 'Phone',
129
+ ),
130
+ ),*/
131
+ array(
132
+ 'name' => 'dsm_theme_builder_header_auto_calc',
133
+ 'class' => 'dsm-settings-checkbox',
134
+ 'label' => __( 'Push Body Down', 'dsm-supreme-modules-for-divi' ),
135
+ 'desc' => __( 'This will calculate the Divi Theme Builder Header height automatically and apply the height to the body to prevent the first section from overlapping. This will push tbe first section down based on the header height. This is not needed if you have a transparent background for the header.', 'dsm-supreme-modules-for-divi' ),
136
+ 'type' => 'checkbox',
137
+ 'default' => 'off',
138
+ ),
139
+ array(
140
+ 'name' => 'dsm_theme_builder_header_shrink_break',
141
+ 'desc' => __( '<hr />', 'dsm-supreme-modules-for-divi' ),
142
+ 'type' => 'html',
143
+ ),
144
+ array(
145
+ 'name' => 'dsm_theme_builder_header_shrink',
146
+ 'class' => 'dsm-settings-checkbox',
147
+ 'label' => __( 'Enable Shrink on Scroll', 'dsm-supreme-modules-for-divi' ),
148
+ 'desc' => __( 'This will shrink your Divi Theme Builder Header and stays fixed when you scroll. For developers, the active shrink CSS Class Selector is ".dsm_fixed_header_shrink_active"', 'dsm-supreme-modules-for-divi' ),
149
  'type' => 'checkbox',
150
  'default' => 'off',
151
  ),
152
+ array(
153
+ 'name' => 'dsm_theme_builder_header_section_padding',
154
+ 'label' => __( 'Shrink Section Padding (px)', 'dsm-supreme-modules-for-divi' ),
155
+ 'desc' => __( 'If Shrink on Scroll is enabled, you can define a custom top and bottom padding in pixel(px) value for the section when shrinked.', 'dsm-supreme-modules-for-divi' ),
156
+ 'type' => 'text',
157
+ 'default' => '',
158
+ 'sanitize_callback' => 'sanitize_text_field',
159
+ ),
160
+ array(
161
+ 'name' => 'dsm_theme_builder_header_row_padding',
162
+ 'label' => __( 'Shrink Row Padding (px)', 'dsm-supreme-modules-for-divi' ),
163
+ 'desc' => __( 'If Shrink on Scroll is enabled, you can define a custom top and bottom padding in pixel(px) value for the row when shrinked.', 'dsm-supreme-modules-for-divi' ),
164
+ 'type' => 'text',
165
+ 'default' => '',
166
+ 'sanitize_callback' => 'sanitize_text_field',
167
+ ),
168
+ array(
169
+ 'name' => 'dsm_theme_builder_header_shrink_image',
170
+ 'label' => __( 'Shrink Image (%)', 'dsm-supreme-modules-for-divi' ),
171
+ 'desc' => __( 'If Shrink on Scroll is enabled, you can define a max-width in percentage(%) value when shrinked. (Default: 70)', 'dsm-supreme-modules-for-divi' ),
172
+ 'type' => 'text',
173
+ 'default' => '70',
174
+ 'sanitize_callback' => 'sanitize_text_field',
175
+ ),
176
+ array(
177
+ 'name' => 'dsm_theme_builder_header_start_threshold',
178
+ 'label' => __( 'Shrink Threshold', 'dsm-supreme-modules-for-divi' ),
179
+ 'desc' => __( 'If Shrink on Scroll is enabled, you can define when the header should shrink after viewport. (Default: 200)', 'dsm-supreme-modules-for-divi' ),
180
+ 'type' => 'text',
181
+ 'default' => '200',
182
+ 'sanitize_callback' => 'sanitize_text_field',
183
+ ),
184
  ),
185
  'dsm_settings_social_media' => array(
186
  array(
187
  'name' => 'dsm_section_subtitle',
188
  'class' => 'dsm-section-subtitle',
189
+ 'label' => __( 'Social Media Settings', 'dsm-supreme-modules-for-divi' ),
190
+ 'desc' => __( 'Configure Social Media settings here.' ),
191
+ 'type' => 'subheading',
192
  ),
193
  'dsm_facebook_app_id' => array(
194
  'name' => 'dsm_facebook_app_id',
203
  ),
204
  'dsm_facebook_site_lang' => array(
205
  'name' => 'dsm_facebook_site_lang',
206
+ 'class' => 'dsm-settings-checkbox',
207
  'label' => __( 'Facebook Language', 'dsm-supreme-modules-for-divi' ),
208
  'desc' => __( 'Check this box if you would like your Divi Facebook Modules to use your WordPress Site Language instead of the default English(US).', 'dsm-supreme-modules-for-divi' ),
209
  'type' => 'checkbox',
213
  'dsm_settings_misc' => array(
214
  'dsm_uninstall_on_delete' => array(
215
  'name' => 'dsm_uninstall_on_delete',
216
+ 'class' => 'dsm-settings-checkbox',
217
  'label' => __( 'Remove Data on Uninstall?', 'dsm-supreme-modules-for-divi' ),
218
  'desc' => __( 'Check this box if you would like Divi Supreme to completely remove all of its data when the plugin is deleted.', 'dsm-supreme-modules-for-divi' ),
219
  'type' => 'checkbox',
220
  ),
221
  'dsm_allow_mime_json_upload' => array(
222
  'name' => 'dsm_allow_mime_json_upload',
223
+ 'class' => 'dsm-settings-checkbox',
224
  'label' => __( 'Allow JSON file upload', 'dsm-supreme-modules-for-divi' ),
225
  'desc' => __( 'Check this box if you would like allow JSON file through WordPress Media Uploader.', 'dsm-supreme-modules-for-divi' ),
226
  'type' => 'checkbox',
includes/class.settings-api.php CHANGED
@@ -1,705 +1,726 @@
1
  <?php
2
 
3
- if ( !class_exists( 'DSM_Settings_API' ) ):
4
- class DSM_Settings_API {
5
-
6
- /**
7
- * settings sections array
8
- *
9
- * @var array
10
- */
11
- protected $settings_sections = array();
12
-
13
- /**
14
- * Settings fields array
15
- *
16
- * @var array
17
- */
18
- protected $settings_fields = array();
19
-
20
- public function __construct() {
21
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
22
- }
23
-
24
- /**
25
- * Enqueue scripts and styles
26
- */
27
- function admin_enqueue_scripts() {
28
- wp_enqueue_style( 'wp-color-picker' );
29
-
30
- wp_enqueue_media();
31
- wp_enqueue_script( 'wp-color-picker' );
32
- wp_enqueue_script( 'jquery' );
33
- }
34
-
35
- /**
36
- * Set settings sections
37
- *
38
- * @param array $sections setting sections array
39
- */
40
- function set_sections( $sections ) {
41
- $this->settings_sections = $sections;
42
-
43
- return $this;
44
- }
45
-
46
- /**
47
- * Add a single section
48
- *
49
- * @param array $section
50
- */
51
- function add_section( $section ) {
52
- $this->settings_sections[] = $section;
53
-
54
- return $this;
55
- }
56
-
57
- /**
58
- * Set settings fields
59
- *
60
- * @param array $fields settings fields array
61
- */
62
- function set_fields( $fields ) {
63
- $this->settings_fields = $fields;
64
-
65
- return $this;
66
- }
67
-
68
- function add_field( $section, $field ) {
69
- $defaults = array(
70
- 'name' => '',
71
- 'label' => '',
72
- 'desc' => '',
73
- 'type' => 'text'
74
- );
75
-
76
- $arg = wp_parse_args( $field, $defaults );
77
- $this->settings_fields[$section][] = $arg;
78
-
79
- return $this;
80
- }
81
-
82
- /**
83
- * Initialize and registers the settings sections and fileds to WordPress
84
- *
85
- * Usually this should be called at `admin_init` hook.
86
- *
87
- * This function gets the initiated settings sections and fields. Then
88
- * registers them to WordPress and ready for use.
89
- */
90
- function admin_init() {
91
- //register settings sections
92
- foreach ( $this->settings_sections as $section ) {
93
- if ( false == get_option( $section['id'] ) ) {
94
- add_option( $section['id'] );
95
- }
96
-
97
- if ( isset($section['desc']) && !empty($section['desc']) ) {
98
- $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
99
- $callback = function() use ( $section ) {
100
- echo str_replace( '"', '\"', $section['desc'] );
101
- };
102
- } else if ( isset( $section['callback'] ) ) {
103
- $callback = $section['callback'];
104
- } else {
105
- $callback = null;
106
- }
107
-
108
- add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
109
- }
110
-
111
- //register settings fields
112
- foreach ( $this->settings_fields as $section => $field ) {
113
- foreach ( $field as $option ) {
114
-
115
- $name = $option['name'];
116
- $type = isset( $option['type'] ) ? $option['type'] : 'text';
117
- $label = isset( $option['label'] ) ? $option['label'] : '';
118
- $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
119
-
120
- $args = array(
121
- 'id' => $name,
122
- 'class' => isset( $option['class'] ) ? $option['class'] : $name,
123
- 'label_for' => "{$section}[{$name}]",
124
- 'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
125
- 'name' => $label,
126
- 'section' => $section,
127
- 'size' => isset( $option['size'] ) ? $option['size'] : null,
128
- 'options' => isset( $option['options'] ) ? $option['options'] : '',
129
- 'std' => isset( $option['default'] ) ? $option['default'] : '',
130
- 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
131
- 'type' => $type,
132
- 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
133
- 'min' => isset( $option['min'] ) ? $option['min'] : '',
134
- 'max' => isset( $option['max'] ) ? $option['max'] : '',
135
- 'step' => isset( $option['step'] ) ? $option['step'] : '',
136
- );
137
-
138
- add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
139
- }
140
- }
141
-
142
- // creates our settings in the options table
143
- foreach ( $this->settings_sections as $section ) {
144
- register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
145
- }
146
- }
147
-
148
- /**
149
- * Get field description for display
150
- *
151
- * @param array $args settings field args
152
- */
153
- public function get_field_description( $args ) {
154
- if ( ! empty( $args['desc'] ) ) {
155
- $desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
156
- } else {
157
- $desc = '';
158
- }
159
-
160
- return $desc;
161
- }
162
-
163
- /**
164
- * Displays a text field for a settings field
165
- *
166
- * @param array $args settings field args
167
- */
168
- function callback_text( $args ) {
169
-
170
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
171
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
172
- $type = isset( $args['type'] ) ? $args['type'] : 'text';
173
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
174
-
175
- $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
176
- $html .= $this->get_field_description( $args );
177
-
178
- echo $html;
179
- }
180
-
181
- /**
182
- * Displays a url field for a settings field
183
- *
184
- * @param array $args settings field args
185
- */
186
- function callback_url( $args ) {
187
- $this->callback_text( $args );
188
- }
189
-
190
- /**
191
- * Displays a number field for a settings field
192
- *
193
- * @param array $args settings field args
194
- */
195
- function callback_number( $args ) {
196
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
197
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
198
- $type = isset( $args['type'] ) ? $args['type'] : 'number';
199
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
200
- $min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
201
- $max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
202
- $step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
203
-
204
- $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
205
- $html .= $this->get_field_description( $args );
206
-
207
- echo $html;
208
- }
209
-
210
- /**
211
- * Displays a checkbox for a settings field
212
- *
213
- * @param array $args settings field args
214
- */
215
- function callback_checkbox( $args ) {
216
-
217
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
218
-
219
- $html = '<fieldset>';
220
- $html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
221
- $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
222
- $html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
223
- $html .= sprintf( '%1$s</label>', $args['desc'] );
224
- $html .= '</fieldset>';
225
-
226
- echo $html;
227
- }
228
-
229
- /**
230
- * Displays a multicheckbox for a settings field
231
- *
232
- * @param array $args settings field args
233
- */
234
- function callback_multicheck( $args ) {
235
-
236
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
237
- $html = '<fieldset>';
238
- $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
239
- foreach ( $args['options'] as $key => $label ) {
240
- $checked = isset( $value[$key] ) ? $value[$key] : '0';
241
- $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
242
- $html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
243
- $html .= sprintf( '%1$s</label><br>', $label );
244
- }
245
-
246
- $html .= $this->get_field_description( $args );
247
- $html .= '</fieldset>';
248
-
249
- echo $html;
250
- }
251
-
252
- /**
253
- * Displays a radio button for a settings field
254
- *
255
- * @param array $args settings field args
256
- */
257
- function callback_radio( $args ) {
258
-
259
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
260
- $html = '<fieldset>';
261
-
262
- foreach ( $args['options'] as $key => $label ) {
263
- $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
264
- $html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
265
- $html .= sprintf( '%1$s</label><br>', $label );
266
- }
267
-
268
- $html .= $this->get_field_description( $args );
269
- $html .= '</fieldset>';
270
-
271
- echo $html;
272
- }
273
-
274
- /**
275
- * Displays a selectbox for a settings field
276
- *
277
- * @param array $args settings field args
278
- */
279
- function callback_select( $args ) {
280
-
281
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
282
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
283
- $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
284
-
285
- foreach ( $args['options'] as $key => $label ) {
286
- $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
287
- }
288
-
289
- $html .= sprintf( '</select>' );
290
- $html .= $this->get_field_description( $args );
291
-
292
- echo $html;
293
- }
294
-
295
- /**
296
- * Displays a textarea for a settings field
297
- *
298
- * @param array $args settings field args
299
- */
300
- function callback_textarea( $args ) {
301
-
302
- $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
303
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
304
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
305
-
306
- $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
307
- $html .= $this->get_field_description( $args );
308
-
309
- echo $html;
310
- }
311
-
312
- /**
313
- * Displays the html for a settings field
314
- *
315
- * @param array $args settings field args
316
- * @return string
317
- */
318
- function callback_html( $args ) {
319
- echo $this->get_field_description( $args );
320
- }
321
-
322
- /**
323
- * Displays a rich text textarea for a settings field
324
- *
325
- * @param array $args settings field args
326
- */
327
- function callback_wysiwyg( $args ) {
328
-
329
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
330
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
331
-
332
- echo '<div style="max-width: ' . $size . ';">';
333
-
334
- $editor_settings = array(
335
- 'teeny' => true,
336
- 'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
337
- 'textarea_rows' => 10
338
- );
339
-
340
- if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
341
- $editor_settings = array_merge( $editor_settings, $args['options'] );
342
- }
343
-
344
- wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
345
-
346
- echo '</div>';
347
-
348
- echo $this->get_field_description( $args );
349
- }
350
-
351
- /**
352
- * Displays a file upload field for a settings field
353
- *
354
- * @param array $args settings field args
355
- */
356
- function callback_file( $args ) {
357
-
358
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
359
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
360
- $id = $args['section'] . '[' . $args['id'] . ']';
361
- $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
362
-
363
- $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
364
- $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
365
- $html .= $this->get_field_description( $args );
366
-
367
- echo $html;
368
- }
369
-
370
- /**
371
- * Displays a password field for a settings field
372
- *
373
- * @param array $args settings field args
374
- */
375
- function callback_password( $args ) {
376
-
377
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
378
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
379
-
380
- $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
381
- $html .= $this->get_field_description( $args );
382
-
383
- echo $html;
384
- }
385
-
386
- /**
387
- * Displays a color picker field for a settings field
388
- *
389
- * @param array $args settings field args
390
- */
391
- function callback_color( $args ) {
392
-
393
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
394
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
395
-
396
- $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
397
- $html .= $this->get_field_description( $args );
398
-
399
- echo $html;
400
- }
401
-
402
-
403
- /**
404
- * Displays a select box for creating the pages select box
405
- *
406
- * @param array $args settings field args
407
- */
408
- function callback_pages( $args ) {
409
-
410
- $dropdown_args = array(
411
- 'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
412
- 'name' => $args['section'] . '[' . $args['id'] . ']',
413
- 'id' => $args['section'] . '[' . $args['id'] . ']',
414
- 'echo' => 0
415
- );
416
- $html = wp_dropdown_pages( $dropdown_args );
417
- echo $html;
418
- }
419
-
420
- /**
421
- * Sanitize callback for Settings API
422
- *
423
- * @return mixed
424
- */
425
- function sanitize_options( $options ) {
426
-
427
- if ( !$options ) {
428
- return $options;
429
- }
430
-
431
- foreach( $options as $option_slug => $option_value ) {
432
- $sanitize_callback = $this->get_sanitize_callback( $option_slug );
433
-
434
- // If callback is set, call it
435
- if ( $sanitize_callback ) {
436
- $options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
437
- continue;
438
- }
439
- }
440
-
441
- return $options;
442
- }
443
-
444
- /**
445
- * Get sanitization callback for given option slug
446
- *
447
- * @param string $slug option slug
448
- *
449
- * @return mixed string or bool false
450
- */
451
- function get_sanitize_callback( $slug = '' ) {
452
- if ( empty( $slug ) ) {
453
- return false;
454
- }
455
-
456
- // Iterate over registered fields and see if we can find proper callback
457
- foreach( $this->settings_fields as $section => $options ) {
458
- foreach ( $options as $option ) {
459
- if ( $option['name'] != $slug ) {
460
- continue;
461
- }
462
-
463
- // Return the callback name
464
- return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
465
- }
466
- }
467
-
468
- return false;
469
- }
470
-
471
- /**
472
- * Get the value of a settings field
473
- *
474
- * @param string $option settings field name
475
- * @param string $section the section name this field belongs to
476
- * @param string $default default text if it's not found
477
- * @return string
478
- */
479
- function get_option( $option, $section, $default = '' ) {
480
-
481
- $options = get_option( $section );
482
-
483
- if ( isset( $options[$option] ) ) {
484
- return $options[$option];
485
- }
486
-
487
- return $default;
488
- }
489
-
490
- /**
491
- * Show navigations as tab
492
- *
493
- * Shows all the settings section labels as tab
494
- */
495
- function show_navigation() {
496
- $html = '<h2 class="nav-tab-wrapper">';
497
-
498
- $count = count( $this->settings_sections );
499
-
500
- // don't show the navigation if only one section exists
501
- if ( $count === 1 ) {
502
- return;
503
- }
504
-
505
- foreach ( $this->settings_sections as $tab ) {
506
- $html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
507
- }
508
-
509
- $html .= '</h2>';
510
-
511
- echo $html;
512
- }
513
-
514
- /**
515
- * Show the section settings forms
516
- *
517
- * This function displays every sections in a different form
518
- */
519
- function show_forms() {
520
- ?>
521
- <div id="poststuff" class="dsm-settings-panel">
522
- <div id="post-body" class="metabox-holder columns-2">
523
- <div id="post-body-content">
524
- <div class="meta-box-sortables ui-sortable">
525
- <?php foreach ( $this->settings_sections as $form ) { ?>
526
- <div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
527
- <form method="post" action="options.php">
528
- <?php
529
- do_action( 'wsa_form_top_' . $form['id'], $form );
530
- settings_fields( $form['id'] );
531
- do_settings_sections( $form['id'] );
532
- do_action( 'wsa_form_bottom_' . $form['id'], $form );
533
- if ( isset( $this->settings_fields[ $form['id'] ] ) ):
534
- ?>
535
- <div>
536
- <?php submit_button(); ?>
537
- </div>
538
- <?php endif; ?>
539
- </form>
540
- </div>
541
- <?php } ?>
542
- </div>
543
- </div>
544
- <?php $this->divi_supreme_settings(); ?>
545
- </div>
546
- </div>
547
- <?php
548
- $this->script();
549
- }
550
-
551
- function divi_supreme_settings() {
552
- ?>
553
- <div id="postbox-container-1" class="postbox-container">
554
- <div class="meta-box-sortables">
555
- <div class="postbox">
556
- <h3 class="activity-block"><span class="dashicons dashicons-star-filled"></span> <?php _e( "Go Pro", 'dsm-supreme-modules-for-divi' ) ?></h3>
557
- <div class="inside">
558
- <p><?php _e( "Get more Divi Modules and Divi Extensions by upgrading to Pro.", 'dsm-supreme-modules-for-divi' ); ?></p>
559
- <a href="https://divisupreme.com/features/" class="button button-primary" target="_blank"><?php _e( "Learn More", 'dsm-supreme-modules-for-divi' ) ?></a>
560
- </div>
561
- </div>
562
- </div>
563
- <div class="meta-box-sortables">
564
- <div class="postbox">
565
- <h3 class="activity-block"><span class="dashicons dashicons-media-document"></span> <?php _e( "Documentation", 'dsm-supreme-modules-for-divi' ) ?></h3>
566
- <div class="inside">
567
- <p><?php _e( "Get started by spending some time with the documentation to get familiar with Divi Supreme Pro. The Documentation will cover all the information needed when using our Divi Supreme to build an amazing website, as well as some helpful tips and tricks that will make your experience working with our Divi modules and extensions easier and more enjoyable.", 'dsm-supreme-modules-for-divi' ); ?></p>
568
- <a href="https://docs.divisupreme.com/" class="button button-primary" target="_blank"><?php _e( "Documentation", 'dsm-supreme-modules-for-divi' ) ?></a>
569
- </div>
570
- </div>
571
- </div>
572
- <div class="meta-box-sortables">
573
- <div class="postbox">
574
- <h3 class="activity-block"><span class="dashicons dashicons-sos"></span> <?php _e( "Need Help?", 'dsm-supreme-modules-for-divi' ) ?></h3>
575
- <div class="inside">
576
- <p><?php _e( "Having issues or difficulties? Get help from the community on our Facebook Divi Supreme Community or contact us through our website contact form.", 'dsm-supreme-modules-for-divi' ); ?></p>
577
- <p>
578
- <a href="https://www.facebook.com/groups/261974664518981/" class="button button-primary" target="_blank"><?php _e( "Join Divi Supreme Community", 'dsm-supreme-modules-for-divi' ) ?></a>
579
- </p>
580
- <a href="https://divisupreme.com/contact/" class="button button-primary" target="_blank"><?php _e( "Contact Support", 'dsm-supreme-modules-for-divi' ) ?></a>
581
- </div>
582
- </div>
583
- </div>
584
- <div class="meta-box-sortables">
585
- <div class="postbox">
586
- <h3 class="activity-block"><span class="dashicons dashicons-heart"></span> <?php _e( "Motivate us!", 'dsm-supreme-modules-for-divi' ) ?></h3>
587
- <div class="inside">
588
- <p><?php _e( "Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Divi Supreme. ", 'dsm-supreme-modules-for-divi' ); ?></p>
589
- <p>
590
- <a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" target="_blank" style="color:#ffb900; text-decoration: none;" class="dsm-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a>
591
- </p>
592
- <a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '" class="button button-primary" target="_blank"><?php _e( "Write a review", 'dsm-supreme-modules-for-divi' ) ?></a>
593
- </div>
594
- </div>
595
- </div>
596
- </div>
597
- <?php
598
- }
599
-
600
- /**
601
- * Tabbable JavaScript codes & Initiate Color Picker
602
- *
603
- * This code uses localstorage for displaying active tabs
604
- */
605
- function script() {
606
- ?>
607
- <script>
608
- jQuery(document).ready(function($) {
609
- //Initiate Color Picker
610
- $('.wp-color-picker-field').wpColorPicker();
611
-
612
- // Switches option sections
613
- $('.group').hide();
614
- var activetab = '';
615
- if (typeof(localStorage) != 'undefined' ) {
616
- activetab = localStorage.getItem("activetab");
617
- }
618
-
619
- //if url has section id as hash then set it as active or override the current local storage value
620
- if(window.location.hash){
621
- activetab = window.location.hash;
622
- if (typeof(localStorage) != 'undefined' ) {
623
- localStorage.setItem("activetab", activetab);
624
- }
625
- }
626
-
627
- if (activetab != '' && $(activetab).length ) {
628
- $(activetab).fadeIn();
629
- } else {
630
- $('.group:first').fadeIn();
631
- }
632
- $('.group .collapsed').each(function(){
633
- $(this).find('input:checked').parent().parent().parent().nextAll().each(
634
- function(){
635
- if ($(this).hasClass('last')) {
636
- $(this).removeClass('hidden');
637
- return false;
638
- }
639
- $(this).filter('.hidden').removeClass('hidden');
640
- });
641
- });
642
-
643
- if (activetab != '' && $(activetab + '-tab').length ) {
644
- $(activetab + '-tab').addClass('nav-tab-active');
645
- }
646
- else {
647
- $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
648
- }
649
- $('.nav-tab-wrapper a').click(function(evt) {
650
- $('.nav-tab-wrapper a').removeClass('nav-tab-active');
651
- $(this).addClass('nav-tab-active').blur();
652
- var clicked_group = $(this).attr('href');
653
- if (typeof(localStorage) != 'undefined' ) {
654
- localStorage.setItem("activetab", $(this).attr('href'));
655
- }
656
- $('.group').hide();
657
- $(clicked_group).fadeIn();
658
- evt.preventDefault();
659
- });
660
-
661
- $('.wpsa-browse').on('click', function (event) {
662
- event.preventDefault();
663
-
664
- var self = $(this);
665
-
666
- // Create the media frame.
667
- var file_frame = wp.media.frames.file_frame = wp.media({
668
- title: self.data('uploader_title'),
669
- button: {
670
- text: self.data('uploader_button_text'),
671
- },
672
- multiple: false
673
- });
674
-
675
- file_frame.on('select', function () {
676
- attachment = file_frame.state().get('selection').first().toJSON();
677
- self.prev('.wpsa-url').val(attachment.url).change();
678
- });
679
-
680
- // Finally, open the modal
681
- file_frame.open();
682
- });
683
- });
684
- </script>
685
- <?php
686
- $this->_style_fix();
687
- }
688
-
689
- function _style_fix() {
690
- global $wp_version;
691
-
692
- if (version_compare($wp_version, '3.8', '<=')):
693
- ?>
694
- <style type="text/css">
695
- /** WordPress 3.8 Fix **/
696
- .form-table th { padding: 20px 10px; }
697
- #wpbody-content .metabox-holder { padding-top: 5px; }
698
- </style>
699
- <?php
700
- endif;
701
- }
702
-
703
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
704
 
705
  endif;
1
  <?php
2
 
3
+ if ( ! class_exists( 'DSM_Settings_API' ) ) :
4
+ class DSM_Settings_API {
5
+
6
+ /**
7
+ * settings sections array
8
+ *
9
+ * @var array
10
+ */
11
+ protected $settings_sections = array();
12
+
13
+ /**
14
+ * Settings fields array
15
+ *
16
+ * @var array
17
+ */
18
+ protected $settings_fields = array();
19
+
20
+ public function __construct() {
21
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
22
+ }
23
+
24
+ /**
25
+ * Enqueue scripts and styles
26
+ */
27
+ function admin_enqueue_scripts() {
28
+ wp_enqueue_style( 'wp-color-picker' );
29
+
30
+ wp_enqueue_media();
31
+ wp_enqueue_script( 'wp-color-picker' );
32
+ wp_enqueue_script( 'jquery' );
33
+ }
34
+
35
+ /**
36
+ * Set settings sections
37
+ *
38
+ * @param array $sections setting sections array
39
+ */
40
+ function set_sections( $sections ) {
41
+ $this->settings_sections = $sections;
42
+
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ * Add a single section
48
+ *
49
+ * @param array $section
50
+ */
51
+ function add_section( $section ) {
52
+ $this->settings_sections[] = $section;
53
+
54
+ return $this;
55
+ }
56
+
57
+ /**
58
+ * Set settings fields
59
+ *
60
+ * @param array $fields settings fields array
61
+ */
62
+ function set_fields( $fields ) {
63
+ $this->settings_fields = $fields;
64
+
65
+ return $this;
66
+ }
67
+
68
+ function add_field( $section, $field ) {
69
+ $defaults = array(
70
+ 'name' => '',
71
+ 'label' => '',
72
+ 'desc' => '',
73
+ 'type' => 'text',
74
+ );
75
+
76
+ $arg = wp_parse_args( $field, $defaults );
77
+ $this->settings_fields[ $section ][] = $arg;
78
+
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Initialize and registers the settings sections and fileds to WordPress
84
+ *
85
+ * Usually this should be called at `admin_init` hook.
86
+ *
87
+ * This function gets the initiated settings sections and fields. Then
88
+ * registers them to WordPress and ready for use.
89
+ */
90
+ function admin_init() {
91
+ //register settings sections
92
+ foreach ( $this->settings_sections as $section ) {
93
+ if ( false == get_option( $section['id'] ) ) {
94
+ add_option( $section['id'] );
95
+ }
96
+
97
+ if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
98
+ $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
99
+ $callback = function() use ( $section ) {
100
+ echo str_replace( '"', '\"', $section['desc'] );
101
+ };
102
+ } elseif ( isset( $section['callback'] ) ) {
103
+ $callback = $section['callback'];
104
+ } else {
105
+ $callback = null;
106
+ }
107
+
108
+ add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
109
+ }
110
+
111
+ //register settings fields
112
+ foreach ( $this->settings_fields as $section => $field ) {
113
+ foreach ( $field as $option ) {
114
+
115
+ $name = $option['name'];
116
+ $type = isset( $option['type'] ) ? $option['type'] : 'text';
117
+ $label = isset( $option['label'] ) ? $option['label'] : '';
118
+ $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
119
+
120
+ $args = array(
121
+ 'id' => $name,
122
+ 'class' => isset( $option['class'] ) ? $option['class'] : $name,
123
+ 'label_for' => "{$section}[{$name}]",
124
+ 'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
125
+ 'name' => $label,
126
+ 'section' => $section,
127
+ 'size' => isset( $option['size'] ) ? $option['size'] : null,
128
+ 'options' => isset( $option['options'] ) ? $option['options'] : '',
129
+ 'std' => isset( $option['default'] ) ? $option['default'] : '',
130
+ 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
131
+ 'type' => $type,
132
+ 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
133
+ 'min' => isset( $option['min'] ) ? $option['min'] : '',
134
+ 'max' => isset( $option['max'] ) ? $option['max'] : '',
135
+ 'step' => isset( $option['step'] ) ? $option['step'] : '',
136
+ );
137
+
138
+ add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
139
+ }
140
+ }
141
+
142
+ // creates our settings in the options table
143
+ foreach ( $this->settings_sections as $section ) {
144
+ register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Get field description for display
150
+ *
151
+ * @param array $args settings field args
152
+ */
153
+ public function get_field_description( $args ) {
154
+ if ( ! empty( $args['desc'] ) ) {
155
+ $desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
156
+ } else {
157
+ $desc = '';
158
+ }
159
+
160
+ return $desc;
161
+ }
162
+
163
+ /**
164
+ * Displays a text field for a settings field
165
+ *
166
+ * @param array $args settings field args
167
+ */
168
+ function callback_text( $args ) {
169
+
170
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
171
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
172
+ $type = isset( $args['type'] ) ? $args['type'] : 'text';
173
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
174
+
175
+ $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
176
+ $html .= $this->get_field_description( $args );
177
+
178
+ echo $html;
179
+ }
180
+
181
+ /**
182
+ * Displays a url field for a settings field
183
+ *
184
+ * @param array $args settings field args
185
+ */
186
+ function callback_url( $args ) {
187
+ $this->callback_text( $args );
188
+ }
189
+
190
+ /**
191
+ * Displays a number field for a settings field
192
+ *
193
+ * @param array $args settings field args
194
+ */
195
+ function callback_number( $args ) {
196
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
197
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
198
+ $type = isset( $args['type'] ) ? $args['type'] : 'number';
199
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
200
+ $min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
201
+ $max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
202
+ $step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
203
+
204
+ $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
205
+ $html .= $this->get_field_description( $args );
206
+
207
+ echo $html;
208
+ }
209
+
210
+ /**
211
+ * Displays a checkbox for a settings field
212
+ *
213
+ * @param array $args settings field args
214
+ */
215
+ function callback_checkbox( $args ) {
216
+
217
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
218
+
219
+ $html = '<fieldset>';
220
+ $html .= sprintf( '<label for="dsm-%1$s[%2$s]">', $args['section'], $args['id'] );
221
+ $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
222
+ $html .= sprintf( '<input type="checkbox" class="checkbox" id="dsm-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s /><span class="dsm-settings-slider dsm-settings-round"></span></label><br>', $args['section'], $args['id'], checked( $value, 'on', false ) );
223
+ $html .= $this->get_field_description( $args );
224
+ $html .= '</fieldset>';
225
+
226
+ echo $html;
227
+ }
228
+
229
+ /**
230
+ * Displays a multicheckbox for a settings field
231
+ *
232
+ * @param array $args settings field args
233
+ */
234
+ function callback_multicheck( $args ) {
235
+
236
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
237
+ $html = '<fieldset>';
238
+ $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
239
+ foreach ( $args['options'] as $key => $label ) {
240
+ $checked = isset( $value[ $key ] ) ? $value[ $key ] : '0';
241
+ $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
242
+ $html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
243
+ $html .= sprintf( '%1$s</label><br>', $label );
244
+ }
245
+
246
+ $html .= $this->get_field_description( $args );
247
+ $html .= '</fieldset>';
248
+
249
+ echo $html;
250
+ }
251
+
252
+ /**
253
+ * Displays a radio button for a settings field
254
+ *
255
+ * @param array $args settings field args
256
+ */
257
+ function callback_radio( $args ) {
258
+
259
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
260
+ $html = '<fieldset>';
261
+
262
+ foreach ( $args['options'] as $key => $label ) {
263
+ $html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
264
+ $html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
265
+ $html .= sprintf( '%1$s</label><br>', $label );
266
+ }
267
+
268
+ $html .= $this->get_field_description( $args );
269
+ $html .= '</fieldset>';
270
+
271
+ echo $html;
272
+ }
273
+
274
+ /**
275
+ * Displays a selectbox for a settings field
276
+ *
277
+ * @param array $args settings field args
278
+ */
279
+ function callback_select( $args ) {
280
+
281
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
282
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
283
+ $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
284
+
285
+ foreach ( $args['options'] as $key => $label ) {
286
+ $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
287
+ }
288
+
289
+ $html .= sprintf( '</select>' );
290
+ $html .= $this->get_field_description( $args );
291
+
292
+ echo $html;
293
+ }
294
+
295
+ /**
296
+ * Displays a textarea for a settings field
297
+ *
298
+ * @param array $args settings field args
299
+ */
300
+ function callback_textarea( $args ) {
301
+
302
+ $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
303
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
304
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
305
+
306
+ $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
307
+ $html .= $this->get_field_description( $args );
308
+
309
+ echo $html;
310
+ }
311
+
312
+ /**
313
+ * Displays the html for a settings field
314
+ *
315
+ * @param array $args settings field args
316
+ * @return string
317
+ */
318
+ function callback_html( $args ) {
319
+ echo $this->get_field_description( $args );
320
+ }
321
+
322
+ /**
323
+ * Displays a rich text textarea for a settings field
324
+ *
325
+ * @param array $args settings field args
326
+ */
327
+ function callback_wysiwyg( $args ) {
328
+
329
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
330
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : '500px';
331
+
332
+ echo '<div style="max-width: ' . $size . ';">';
333
+
334
+ $editor_settings = array(
335
+ 'teeny' => true,
336
+ 'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
337
+ 'textarea_rows' => 10,
338
+ );
339
+
340
+ if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
341
+ $editor_settings = array_merge( $editor_settings, $args['options'] );
342
+ }
343
+
344
+ wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
345
+
346
+ echo '</div>';
347
+
348
+ echo $this->get_field_description( $args );
349
+ }
350
+
351
+ /**
352
+ * Displays a file upload field for a settings field
353
+ *
354
+ * @param array $args settings field args
355
+ */
356
+ function callback_file( $args ) {
357
+
358
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
359
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
360
+ $id = $args['section'] . '[' . $args['id'] . ']';
361
+ $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
362
+
363
+ $html = sprintf( '<input type="text" class="%1$s-text dsm-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
364
+ $html .= '<input type="button" class="button dsm-browse" value="' . $label . '" />';
365
+ $html .= $this->get_field_description( $args );
366
+
367
+ echo $html;
368
+ }
369
+
370
+ /**
371
+ * Displays a password field for a settings field
372
+ *
373
+ * @param array $args settings field args
374
+ */
375
+ function callback_password( $args ) {
376
+
377
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
378
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
379
+
380
+ $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
381
+ $html .= $this->get_field_description( $args );
382
+
383
+ echo $html;
384
+ }
385
+
386
+ /**
387
+ * Displays a color picker field for a settings field
388
+ *
389
+ * @param array $args settings field args
390
+ */
391
+ function callback_color( $args ) {
392
+
393
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
394
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
395
+
396
+ $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
397
+ $html .= $this->get_field_description( $args );
398
+
399
+ echo $html;
400
+ }
401
+
402
+
403
+ /**
404
+ * Displays a select box for creating the pages select box
405
+ *
406
+ * @param array $args settings field args
407
+ */
408
+ function callback_pages( $args ) {
409
+
410
+ $dropdown_args = array(
411
+ 'selected' => esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ),
412
+ 'name' => $args['section'] . '[' . $args['id'] . ']',
413
+ 'id' => $args['section'] . '[' . $args['id'] . ']',
414
+ 'echo' => 0,
415
+ );
416
+ $html = wp_dropdown_pages( $dropdown_args );
417
+ echo $html;
418
+ }
419
+
420
+ /**
421
+ * Sanitize callback for Settings API
422
+ *
423
+ * @return mixed
424
+ */
425
+ function sanitize_options( $options ) {
426
+
427
+ if ( ! $options ) {
428
+ return $options;
429
+ }
430
+
431
+ foreach ( $options as $option_slug => $option_value ) {
432
+ $sanitize_callback = $this->get_sanitize_callback( $option_slug );
433
+
434
+ // If callback is set, call it
435
+ if ( $sanitize_callback ) {
436
+ $options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
437
+ continue;
438
+ }
439
+ }
440
+
441
+ return $options;
442
+ }
443
+
444
+ /**
445
+ * Get sanitization callback for given option slug
446
+ *
447
+ * @param string $slug option slug
448
+ *
449
+ * @return mixed string or bool false
450
+ */
451
+ function get_sanitize_callback( $slug = '' ) {
452
+ if ( empty( $slug ) ) {
453
+ return false;
454
+ }
455
+
456
+ // Iterate over registered fields and see if we can find proper callback
457
+ foreach ( $this->settings_fields as $section => $options ) {
458
+ foreach ( $options as $option ) {
459
+ if ( $option['name'] != $slug ) {
460
+ continue;
461
+ }
462
+
463
+ // Return the callback name
464
+ return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
465
+ }
466
+ }
467
+
468
+ return false;
469
+ }
470
+
471
+ /**
472
+ * Get the value of a settings field
473
+ *
474
+ * @param string $option settings field name
475
+ * @param string $section the section name this field belongs to
476
+ * @param string $default default text if it's not found
477
+ * @return string
478
+ */
479
+ function get_option( $option, $section, $default = '' ) {
480
+
481
+ $options = get_option( $section );
482
+
483
+ if ( isset( $options[ $option ] ) ) {
484
+ return $options[ $option ];
485
+ }
486
+
487
+ return $default;
488
+ }
489
+
490
+ /**
491
+ * Show navigations as tab
492
+ *
493
+ * Shows all the settings section labels as tab
494
+ */
495
+ function show_navigation() {
496
+ $html = '<h2 class="nav-tab-wrapper">';
497
+
498
+ $count = count( $this->settings_sections );
499
+
500
+ // don't show the navigation if only one section exists
501
+ if ( $count === 1 ) {
502
+ return;
503
+ }
504
+
505
+ foreach ( $this->settings_sections as $tab ) {
506
+ $html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
507
+ }
508
+
509
+ $html .= '</h2>';
510
+
511
+ echo $html;
512
+ }
513
+
514
+ /**
515
+ * Displays a 2 colspan subheading field for a settings field
516
+ *
517
+ * @param array $args settings field args
518
+ */
519
+ function callback_subheading( $args ) {
520
+
521
+ $html = '<h3 class="setting_subheading_title">' . $args['name'] . '</h3>';
522
+ $html .= $this->get_field_description( $args );
523
+
524
+ echo $html;
525
+ }
526
+
527
+ /**
528
+ * Show the section settings forms
529
+ *
530
+ * This function displays every sections in a different form
531
+ */
532
+ function show_forms() {
533
+ ?>
534
+ <div id="poststuff" class="dsm-settings-panel">
535
+ <div id="post-body" class="metabox-holder columns-2">
536
+ <div id="post-body-content">
537
+ <div class="meta-box-sortables ui-sortable">
538
+ <?php foreach ( $this->settings_sections as $form ) { ?>
539
+ <div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
540
+ <form method="post" action="options.php">
541
+ <?php
542
+ do_action( 'wsa_form_top_' . $form['id'], $form );
543
+ settings_fields( $form['id'] );
544
+ do_settings_sections( $form['id'] );
545
+ do_action( 'wsa_form_bottom_' . $form['id'], $form );
546
+ if ( isset( $this->settings_fields[ $form['id'] ] ) ) :
547
+ ?>
548
+ <div>
549
+ <?php submit_button(); ?>
550
+ </div>
551
+ <?php endif; ?>
552
+ </form>
553
+ </div>
554
+ <?php } ?>
555
+ </div>
556
+ </div>
557
+ <?php $this->divi_supreme_settings(); ?>
558
+ </div>
559
+ </div>
560
+ <?php
561
+ $this->script();
562
+ }
563
+
564
+ function divi_supreme_settings() {
565
+ ?>
566
+ <div id="postbox-container-1" class="postbox-container">
567
+ <div class="meta-box-sortables">
568
+ <div class="postbox">
569
+ <h3 class="activity-block"><span class="dashicons dashicons-star-filled"></span> <?php _e( 'Go Pro', 'dsm-supreme-modules-for-divi' ); ?></h3>
570
+ <div class="inside">
571
+ <p><?php _e( 'Get more Divi Modules and Divi Extensions by upgrading to Pro.', 'dsm-supreme-modules-for-divi' ); ?></p>
572
+ <a href="https://divisupreme.com/features/" class="button button-primary" target="_blank"><?php _e( 'Learn More', 'dsm-supreme-modules-for-divi' ); ?></a>
573
+ </div>
574
+ </div>
575
+ </div>
576
+ <div class="meta-box-sortables">
577
+ <div class="postbox">
578
+ <h3 class="activity-block"><span class="dashicons dashicons-media-document"></span> <?php _e( 'Documentation', 'dsm-supreme-modules-for-divi' ); ?></h3>
579
+ <div class="inside">
580
+ <p><?php _e( 'Get started by spending some time with the documentation to get familiar with Divi Supreme Pro. The Documentation will cover all the information needed when using our Divi Supreme to build an amazing website, as well as some helpful tips and tricks that will make your experience working with our Divi modules and extensions easier and more enjoyable.', 'dsm-supreme-modules-for-divi' ); ?></p>
581
+ <a href="https://docs.divisupreme.com/" class="button button-primary" target="_blank"><?php _e( 'Documentation', 'dsm-supreme-modules-for-divi' ); ?></a>
582
+ </div>
583
+ </div>
584
+ </div>
585
+ <div class="meta-box-sortables">
586
+ <div class="postbox">
587
+ <h3 class="activity-block"><span class="dashicons dashicons-sos"></span> <?php _e( 'Need Help?', 'dsm-supreme-modules-for-divi' ); ?></h3>
588
+ <div class="inside">
589
+ <p><?php _e( 'Having issues or difficulties? Get help from the community on our Facebook Divi Supreme Community or contact us through our website contact form.', 'dsm-supreme-modules-for-divi' ); ?></p>
590
+ <p>
591
+ <a href="https://www.facebook.com/groups/261974664518981/" class="button button-primary" target="_blank"><?php _e( 'Join Divi Supreme Community', 'dsm-supreme-modules-for-divi' ); ?></a>
592
+ </p>
593
+ <a href="https://divisupreme.com/contact/" class="button button-primary" target="_blank"><?php _e( 'Contact Support', 'dsm-supreme-modules-for-divi' ); ?></a>
594
+ </div>
595
+ </div>
596
+ </div>
597
+ <div class="meta-box-sortables">
598
+ <div class="postbox">
599
+ <h3 class="activity-block"><span class="dashicons dashicons-heart"></span> <?php _e( 'Motivate us!', 'dsm-supreme-modules-for-divi' ); ?></h3>
600
+ <div class="inside">
601
+ <p><?php _e( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Divi Supreme. ', 'dsm-supreme-modules-for-divi' ); ?></p>
602
+ <p>
603
+ <a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" target="_blank" style="color:#ffb900; text-decoration: none;" class="dsm-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a>
604
+ </p>
605
+ <a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '" class="button button-primary" target="_blank"><?php _e( 'Write a review', 'dsm-supreme-modules-for-divi' ); ?></a>
606
+ </div>
607
+ </div>
608
+ </div>
609
+ </div>
610
+ <?php
611
+ }
612
+
613
+ /**
614
+ * Tabbable JavaScript codes & Initiate Color Picker
615
+ *
616
+ * This code uses localstorage for displaying active tabs
617
+ */
618
+ function script() {
619
+ ?>
620
+ <script>
621
+ jQuery(document).ready(function($) {
622
+ //Initiate Color Picker
623
+ $('.wp-color-picker-field').wpColorPicker();
624
+
625
+ // Switches option sections
626
+ $('.group').hide();
627
+ var activetab = '';
628
+ if (typeof(localStorage) != 'undefined' ) {
629
+ activetab = localStorage.getItem("activetab");
630
+ }
631
+
632
+ //if url has section id as hash then set it as active or override the current local storage value
633
+ if(window.location.hash){
634
+ activetab = window.location.hash;
635
+ if (typeof(localStorage) != 'undefined' ) {
636
+ localStorage.setItem("activetab", activetab);
637
+ }
638
+ }
639
+
640
+ if (activetab != '' && $(activetab).length ) {
641
+ $(activetab).fadeIn();
642
+ } else {
643
+ $('.group:first').fadeIn();
644
+ }
645
+ $('.group .collapsed').each(function(){
646
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
647
+ function(){
648
+ if ($(this).hasClass('last')) {
649
+ $(this).removeClass('hidden');
650
+ return false;
651
+ }
652
+ $(this).filter('.hidden').removeClass('hidden');
653
+ });
654
+ });
655
+
656
+ if (activetab != '' && $(activetab + '-tab').length ) {
657
+ $(activetab + '-tab').addClass('nav-tab-active');
658
+ }
659
+ else {
660
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
661
+ }
662
+ $('.nav-tab-wrapper a').click(function(evt) {
663
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
664
+ $(this).addClass('nav-tab-active').blur();
665
+ var clicked_group = $(this).attr('href');
666
+ if (typeof(localStorage) !== 'undefined' ) {
667
+ localStorage.setItem("activetab", $(this).attr('href'));
668
+ }
669
+ $('.group').hide();
670
+ $(clicked_group).fadeIn();
671
+ evt.preventDefault();
672
+ });
673
+
674
+ $('.dsm-browse').on('click', function (event) {
675
+ event.preventDefault();
676
+
677
+ var self = $(this);
678
+
679
+ // Create the media frame.
680
+ var file_frame = wp.media.frames.file_frame = wp.media({
681
+ title: self.data('uploader_title'),
682
+ button: {
683
+ text: self.data('uploader_button_text'),
684
+ },
685
+ multiple: false
686
+ });
687
+
688
+ file_frame.on('select', function () {
689
+ attachment = file_frame.state().get('selection').first().toJSON();
690
+ self.prev('.dsm-url').val(attachment.url).change();
691
+ });
692
+
693
+ // Finally, open the modal.
694
+ file_frame.open();
695
+ });
696
+ // Make the subheading single row.
697
+ $('.setting_subheading_title').each(function (index, element) {
698
+ var $element = $(element);
699
+ var $element_parent = $element.parent('td');
700
+ $element_parent.attr('colspan', 2);
701
+ $element_parent.prev('th').remove();
702
+ $element_parent.addClass('setting_subheading');
703
+ });
704
+ });
705
+ </script>
706
+ <?php
707
+ $this->_style_fix();
708
+ }
709
+
710
+ function _style_fix() {
711
+ global $wp_version;
712
+
713
+ if ( version_compare( $wp_version, '3.8', '<=' ) ) :
714
+ ?>
715
+ <style type="text/css">
716
+ /** WordPress 3.8 Fix **/
717
+ .form-table th { padding: 20px 10px; }
718
+ #wpbody-content .metabox-holder { padding-top: 5px; }
719
+ </style>
720
+ <?php
721
+ endif;
722
+ }
723
+
724
+ }
725
 
726
  endif;
public/class-dsm-supreme-modules-for-divi-public.php CHANGED
@@ -71,9 +71,30 @@ class Dsm_Supreme_Modules_For_Divi_Public {
71
  * between the defined hooks and the functions defined in this
72
  * class.
73
  */
74
-
75
- if ( et_core_is_fb_enabled() ) {
76
- wp_enqueue_style( 'dsm-et-admin', plugin_dir_url( __FILE__ ) . 'css/dsm-et-admin.css', array(), DSM_VERSION, 'all' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  }
@@ -106,12 +127,27 @@ class Dsm_Supreme_Modules_For_Divi_Public {
106
  $facebook_lang = 'en_US';
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  wp_register_script( 'dsm-typed', plugin_dir_url( __FILE__ ) . 'js/typed.min.js', array(), DSM_VERSION, true );
110
  wp_register_script( 'dsm-before-after-image', plugin_dir_url( __FILE__ ) . 'js/dsm-before-after-image-slider.js', array( 'jquery' ), DSM_VERSION, true );
111
  wp_register_script( 'dsm-lottie', plugin_dir_url( __FILE__ ) . 'js/lottie.min.js', array(), DSM_VERSION, true );
112
  wp_register_script( 'dsm-facebook', 'https://connect.facebook.net/' . $facebook_lang . '/sdk.js#xfbml=1&version=v6.0' . $facebook_app_id, array(), null, true );
113
  wp_register_script( 'dsm-twitter-embed', 'https://platform.twitter.com/widgets.js', array(), DSM_VERSION, true );
114
-
115
  }
116
 
117
  }
71
  * between the defined hooks and the functions defined in this
72
  * class.
73
  */
74
+ if ( function_exists( 'et_core_is_fb_enabled' ) ) {
75
+ if ( et_core_is_fb_enabled() ) {
76
+ wp_enqueue_style( 'dsm-admin', plugin_dir_url( __FILE__ ) . 'css/dsm-et-admin.css', array(), DSM_VERSION, 'all' );
77
+ }
78
+ }
79
+ $easy_theme_builder = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed'] ) && 'off' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed'] ? true : false;
80
+ if ( $easy_theme_builder === true ) {
81
+ wp_enqueue_style( 'dsm-easy-theme-builder-style', plugin_dir_url( __FILE__ ) . 'css/dsm-easy-tb.css', array(), DSM_VERSION, 'all' );
82
+ $easy_theme_builder_image = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_shrink_image'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_shrink_image'] ? esc_attr( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_shrink_image'] ) : '';
83
+ $easy_theme_builder_section = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] ? esc_attr( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] ) : '';
84
+ $easy_theme_builder_row = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] ? esc_attr( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] ) : '';
85
+ $dsm_tb_header_css = '';
86
+
87
+ if ( '' !== $easy_theme_builder_image ) {
88
+ $dsm_tb_header_css = '.dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header img { max-width: ' . floatval( $easy_theme_builder_image ) . '%; }';
89
+ }
90
+ if ( '' !== $easy_theme_builder_section ) {
91
+ $dsm_tb_header_css .= '.dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_section { padding-top: ' . floatval( $easy_theme_builder_section ) . 'px; padding-bottom: ' . floatval( $easy_theme_builder_section ) . 'px; } ';
92
+ }
93
+ if ( '' !== $easy_theme_builder_row ) {
94
+ $dsm_tb_header_css .= '.dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_section .et_pb_row { padding-top: ' . floatval( $easy_theme_builder_row ) . 'px !important; padding-bottom: ' . floatval( $easy_theme_builder_row ) . 'px !important; } ';
95
+ }
96
+
97
+ wp_add_inline_style( 'dsm-easy-theme-builder-style', $dsm_tb_header_css );
98
  }
99
 
100
  }
127
  $facebook_lang = 'en_US';
128
  }
129
 
130
+ $easy_theme_builder = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed'] ) && 'off' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_fixed'] ? true : false;
131
+ if ( $easy_theme_builder === true ) {
132
+ wp_enqueue_script( 'dsm-easy-theme-builder', plugin_dir_url( __FILE__ ) . 'js/dsm-easy-tb.js', array( 'jquery' ), DSM_VERSION, true );
133
+ $dsm_tb_header_section_padding = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] ? get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_section_padding'] : '';
134
+ $dsm_tb_header_row_padding = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] ? get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_row_padding'] : '';
135
+ $dsm_tb_header_start_threshold = isset( get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_start_threshold'] ) && '' !== get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_start_threshold'] ? get_option( 'dsm_theme_builder' )['dsm_theme_builder_header_start_threshold'] : '150';
136
+
137
+ $dsm_tb_header = array(
138
+ 'section_padding' => $dsm_tb_header_section_padding,
139
+ 'row_padding' => $dsm_tb_header_row_padding,
140
+ 'threshold' => $dsm_tb_header_start_threshold,
141
+ );
142
+
143
+ wp_localize_script( 'dsm-easy-theme-builder', 'dsm_easy_tb_js', $dsm_tb_header );
144
+ }
145
+
146
  wp_register_script( 'dsm-typed', plugin_dir_url( __FILE__ ) . 'js/typed.min.js', array(), DSM_VERSION, true );
147
  wp_register_script( 'dsm-before-after-image', plugin_dir_url( __FILE__ ) . 'js/dsm-before-after-image-slider.js', array( 'jquery' ), DSM_VERSION, true );
148
  wp_register_script( 'dsm-lottie', plugin_dir_url( __FILE__ ) . 'js/lottie.min.js', array(), DSM_VERSION, true );
149
  wp_register_script( 'dsm-facebook', 'https://connect.facebook.net/' . $facebook_lang . '/sdk.js#xfbml=1&version=v6.0' . $facebook_app_id, array(), null, true );
150
  wp_register_script( 'dsm-twitter-embed', 'https://platform.twitter.com/widgets.js', array(), DSM_VERSION, true );
 
151
  }
152
 
153
  }
public/css/dsm-easy-tb.css ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .dsm_fixed_header {
3
+ transition: padding 0.4s ease-in-out;
4
+ -moz-transition: padding 0.4s ease-in-out;
5
+ -webkit-transition: padding 0.4s ease-in-out;
6
+ -o-transition: padding 0.4s ease-in-out;
7
+ }
8
+ .dsm_fixed_header header.et-l--header {
9
+ position: fixed;
10
+ top: 0;
11
+ width: 100%;
12
+ transition: all 0.4s ease-in-out;
13
+ -moz-transition: all 0.4s ease-in-out;
14
+ -webkit-transition: all 0.4s ease-in-out;
15
+ -o-transition: all 0.4s ease-in-out;
16
+ z-index: 99999;
17
+ }
18
+
19
+ body.logged-in.admin-bar.dsm_fixed_header header.et-l--header {
20
+ top: calc(0px + 32px);
21
+ }
22
+ .dsm_fixed_header_shrink header.et-l--header img {
23
+ transition: max-width 0.4s ease-in-out;
24
+ -moz-transition: max-width 0.4s ease-in-out;
25
+ -webkit-transition: max-width 0.4s ease-in-out;
26
+ -o-transition: max-width 0.4s ease-in-out;
27
+ }
28
+ /*Shrink*/
29
+ .dsm_fixed_header_shrink header.et-l--header {
30
+ -webkit-animation-timing-function: cubic-bezier(.075, .82, .165, 1);
31
+ animation-timing-function: cubic-bezier(.075, .82, .165, 1);
32
+ }
33
+ .dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_section,
34
+ .dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_section .et_pb_row,
35
+ .dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_menu__menu>nav>ul>li>a {
36
+ transition: padding 0.4s ease-in-out;
37
+ -moz-transition: padding 0.4s ease-in-out;
38
+ -webkit-transition: padding 0.4s ease-in-out;
39
+ -o-transition: padding 0.4s ease-in-out;
40
+ }
41
+
42
+ .dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header .et_pb_menu__menu>nav>ul>li>a {
43
+ padding: 21px 0;
44
+ }
45
+ .dsm_fixed_header_shrink header.et-l--header img {
46
+ transition: max-width 0.4s ease-in-out;
47
+ -moz-transition: max-width 0.4s ease-in-out;
48
+ -webkit-transition: max-width 0.4s ease-in-out;
49
+ -o-transition: max-width 0.4s ease-in-out;
50
+ }
51
+ .dsm_fixed_header_shrink.dsm_fixed_header_shrink_active header.et-l--header img {
52
+ max-width: 70%;
53
+ transition: max-width 0.4s ease-in-out;
54
+ -moz-transition: max-width 0.4s ease-in-out;
55
+ -webkit-transition: max-width 0.4s ease-in-out;
56
+ -o-transition: max-width 0.4s ease-in-out;
57
+ }
58
+
59
+ @media only screen and (min-width: 981px) {
60
+ .dsm_fixed_header_desktop_disable.dsm_fixed_header header.et-l--header {
61
+ position: relative;
62
+ }
63
+ }
64
+ @media only screen and (max-width: 980px) and (min-width: 768px) {
65
+ .dsm_fixed_header_tablet_disable.dsm_fixed_header header.et-l--header {
66
+ position: relative;
67
+ }
68
+ }
69
+ @media screen and (max-width: 782px) {
70
+ body.logged-in.admin-bar.dsm_fixed_header header.et-l--header {
71
+ top: calc(0px + 46px);
72
+ }
73
+ }
74
+
75
+ @media screen and (max-width: 767px) {
76
+ .dsm_fixed_header_phone_disable.dsm_fixed_header header.et-l--header {
77
+ position: relative;
78
+ }
79
+ }
public/js/dsm-easy-tb.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(e){document.documentElement.className="js";navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/),e("#wpadminbar").height();var d,a=dsm_easy_tb_js.threshold;if(e(".dsm_fixed_header").length){var i=(d=0,function(e,a){clearTimeout(d),d=setTimeout(e,a)});e(".dsm_fixed_header_auto").length&&(e(".dsm_fixed_header_auto").addClass("et-animated-content"),e(".dsm_fixed_header_auto").css("padding-top",e(".et-l--header").height())),e(".dsm_fixed_header_shrink").length&&e(window).scroll(function(){e("body").hasClass("admin-bar")&&(!0===window.matchMedia("(max-width: 768px)").matches?e(document).scrollTop()>10?e(".dsm_fixed_header header").css("top","0"):e(".dsm_fixed_header header").css("top",e("#wpadminbar").height()):!0===window.matchMedia("(min-width: 769px)").matches&&e(".dsm_fixed_header header").css("top","")),e(document).scrollTop()>a?(e(".dsm_fixed_header_shrink").addClass("dsm_fixed_header_shrink_active"),e(".dsm_fixed_header_auto").css("margin-top",-e(".et-l--header").height()/2)):(e(".dsm_fixed_header_shrink").removeClass("dsm_fixed_header_shrink_active"),e(".dsm_fixed_header_auto").css("margin-top","-1px"))}),e(window).resize(function(){i(function(){e(".dsm_fixed_header_auto").length&&e(".dsm_fixed_header_auto").css("padding-top",e(".et-l--header").height()),e("body").hasClass("admin-bar")&&(!0===window.matchMedia("(max-width: 768px)").matches?e(document).scrollTop()>10?e(".dsm_fixed_header header").css("top","0"):e(".dsm_fixed_header header").css("top",e("#wpadminbar").height()):!0===window.matchMedia("(min-width: 769px)").matches&&e(".dsm_fixed_header header").css("top",""))},88)})}});
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: divisupreme, kenng87
3
  Tags: Divi, Divi Module, Divi Page Builder, divi theme, divi builder, Divi Extensions
4
  Donate link: https://suprememodules.com/
5
  Requires at least: 4.5
6
- Tested up to: 5.4
7
  Requires PHP: 5.6
8
- Stable tag: 2.1.3
9
  License: GPLv2
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -44,6 +44,8 @@ Divi Supreme Extentions
44
  - Divi Scheduled Element Visibility - This will extend the Visibility option in the the Section/Row's custom setting to allow you to show or hide the section or row with a specify date/time.
45
  - Divi Templates - Designing Divi's footer or 404 page is one of the most challenging thing ever. Without programming background knowledgde, you have to deal with time and the learning process. But with Divi Templates, now you can design your custom footer, 404 and Search No Result page using Visual Builder and assign them. As easy as that, No coding required. Don't spend time finding those layout global module ID because you don't have to. Just 2 easy steps: Create a Template using Visual Builder, then assign them to footer/404. That's it! Save time = Smarter.
46
  - Divi Shortcodes - This will add a shortcode column in the Divi Library. Use that Divi shortcode to display your layout in any Divi module or even your PHP file by using [divi_shortcode id=""].
 
 
47
 
48
  Many more Divi Modules and Extensions coming soon...
49
 
@@ -109,6 +111,11 @@ This is a common question that we get asked here every now and then which is why
109
 
110
 
111
  == Changelog ==
 
 
 
 
 
112
  = 2.1.3 – 28.04.2020 =
113
  * Fixed: Divi Flipbox Module overlapping issue in Firefox Browser.
114
  * Fixed: Divi Flipbox Module flip animation.
3
  Tags: Divi, Divi Module, Divi Page Builder, divi theme, divi builder, Divi Extensions
4
  Donate link: https://suprememodules.com/
5
  Requires at least: 4.5
6
+ Tested up to: 5.4.1
7
  Requires PHP: 5.6
8
+ Stable tag: 2.1.4
9
  License: GPLv2
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
44
  - Divi Scheduled Element Visibility - This will extend the Visibility option in the the Section/Row's custom setting to allow you to show or hide the section or row with a specify date/time.
45
  - Divi Templates - Designing Divi's footer or 404 page is one of the most challenging thing ever. Without programming background knowledgde, you have to deal with time and the learning process. But with Divi Templates, now you can design your custom footer, 404 and Search No Result page using Visual Builder and assign them. As easy as that, No coding required. Don't spend time finding those layout global module ID because you don't have to. Just 2 easy steps: Create a Template using Visual Builder, then assign them to footer/404. That's it! Save time = Smarter.
46
  - Divi Shortcodes - This will add a shortcode column in the Divi Library. Use that Divi shortcode to display your layout in any Divi module or even your PHP file by using [divi_shortcode id=""].
47
+ - Divi Easy Theme Builder (Header) - This will allow you to customize the Theme Builder Header with option such as Fixed Header and Shrink On Scroll.
48
+
49
 
50
  Many more Divi Modules and Extensions coming soon...
51
 
111
 
112
 
113
  == Changelog ==
114
+ = 2.1.4 – 06.05.2020 =
115
+ * Added: Divi Easy Theme Builder Header.
116
+ * Enhanced: Divi Supreme setting page.
117
+ * Enhanced: Check through most files with WordPress Coding Standards to ensures code quality and adherence to coding conventions.
118
+
119
  = 2.1.3 – 28.04.2020 =
120
  * Fixed: Divi Flipbox Module overlapping issue in Firefox Browser.
121
  * Fixed: Divi Flipbox Module flip animation.
supreme-modules-for-divi.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Supreme Modules Lite - Divi Theme, Extra Theme and Divi Builder
4
  * Plugin URI: https://suprememodules.com
5
  * Description: Divi Supreme enhances the experience and features found on Divi and extend with custom creative modules to help you build amazing websites.
6
- * Version: 2.1.3
7
  * Author: Supreme Modules
8
  * Author URI: https://suprememodules.com/about-us/
9
  * License: GPL2
@@ -34,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) {
34
  }
35
 
36
  if ( ! defined( 'DSM_VERSION' ) ) {
37
- define( 'DSM_VERSION', '2.1.3' );
38
  }
39
  if ( ! defined( 'DSM_SHORTCODE' ) ) {
40
  define( 'DSM_SHORTCODE', 'divi_shortcode' );
3
  * Plugin Name: Supreme Modules Lite - Divi Theme, Extra Theme and Divi Builder
4
  * Plugin URI: https://suprememodules.com
5
  * Description: Divi Supreme enhances the experience and features found on Divi and extend with custom creative modules to help you build amazing websites.
6
+ * Version: 2.1.4
7
  * Author: Supreme Modules
8
  * Author URI: https://suprememodules.com/about-us/
9
  * License: GPL2
34
  }
35
 
36
  if ( ! defined( 'DSM_VERSION' ) ) {
37
+ define( 'DSM_VERSION', '2.1.4' );
38
  }
39
  if ( ! defined( 'DSM_SHORTCODE' ) ) {
40
  define( 'DSM_SHORTCODE', 'divi_shortcode' );