Version Description
- 22.05.2019 =
- Improved: Overwrite the plugin and is based on the WordPress Plugin API, Coding Standards, and Documentation Standards.
- Improved: Overall better coding.
- Improved: Compatible with Divi Supreme Pro version even Divi Supreme Free is installed.
Download this release
Release Info
Developer | divisupreme |
Plugin | Supreme Modules Lite – Divi Theme, Extra Theme and Divi Builder |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- admin/class-dsm-supreme-modules-for-divi-admin.php +104 -0
- admin/css/dsm-plugin.css +124 -0
- admin/img/icon-128x128.png +0 -0
- admin/index.php +1 -0
- {includes/admin → admin}/js/dsm-admin.js +0 -0
- admin/js/dsm-supreme-modules-for-divi-admin.js +32 -0
- admin/partials/dsm-supreme-modules-for-divi-admin-display.php +16 -0
- admin/persist-admin-notices-dismissal/dismiss-notice.js +33 -0
- admin/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php +190 -0
- includes/SupremeModulesForDivi.php +19 -0
- includes/SupremeModulesLoader.php +1 -771
- includes/class-dsm-supreme-modules-for-divi-activator.php +44 -0
- includes/class-dsm-supreme-modules-for-divi-deactivator.php +37 -0
- includes/class-dsm-supreme-modules-for-divi-i18n.php +47 -0
- includes/class-dsm-supreme-modules-for-divi-loader.php +129 -0
- includes/class-dsm-supreme-modules-for-divi-review.php +188 -0
- includes/class-dsm-supreme-modules-for-divi.php +992 -0
- includes/class.page-settings.php +2 -2
- public/class-dsm-supreme-modules-for-divi-public.php +109 -0
- public/css/dsm-et-admin.css +71 -0
- public/index.php +1 -0
- public/js/dsm-facebook.js +7 -0
- public/js/dsm-supreme-modules-for-divi-public.js +32 -0
- public/js/typed.min.js +11 -0
- public/partials/dsm-supreme-modules-for-divi-public-display.php +16 -0
- readme.txt +6 -1
- supreme-modules-for-divi.php +62 -118
- uninstall.php +31 -0
admin/class-dsm-supreme-modules-for-divi-admin.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The admin-specific functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link https://suprememodules.com/about-us/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
10 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The admin-specific functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
20 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/admin
|
21 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
22 |
+
*/
|
23 |
+
class Dsm_Supreme_Modules_For_Divi_Admin {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Initialize the class and set its properties.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @param string $plugin_name The name of this plugin.
|
48 |
+
* @param string $version The version of this plugin.
|
49 |
+
*/
|
50 |
+
public function __construct( $plugin_name, $version ) {
|
51 |
+
|
52 |
+
$this->plugin_name = $plugin_name;
|
53 |
+
$this->version = $version;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Register the stylesheets for the admin area.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*/
|
62 |
+
public function enqueue_styles() {
|
63 |
+
|
64 |
+
/**
|
65 |
+
* This function is provided for demonstration purposes only.
|
66 |
+
*
|
67 |
+
* An instance of this class should be passed to the run() function
|
68 |
+
* defined in Dsm_Supreme_Modules_For_Divi_Loader as all of the hooks are defined
|
69 |
+
* in that particular class.
|
70 |
+
*
|
71 |
+
* The Dsm_Supreme_Modules_For_Divi_Loader will then create the relationship
|
72 |
+
* between the defined hooks and the functions defined in this
|
73 |
+
* class.
|
74 |
+
*/
|
75 |
+
|
76 |
+
//wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/dsm-supreme-modules-for-divi-admin.css', array(), $this->version, 'all' );
|
77 |
+
wp_enqueue_style('dsm-plugin', plugin_dir_url( __FILE__ ) . 'css/dsm-plugin.css', array(), $this->version, 'all' );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Register the JavaScript for the admin area.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
*/
|
86 |
+
public function enqueue_scripts() {
|
87 |
+
|
88 |
+
/**
|
89 |
+
* This function is provided for demonstration purposes only.
|
90 |
+
*
|
91 |
+
* An instance of this class should be passed to the run() function
|
92 |
+
* defined in Dsm_Supreme_Modules_For_Divi_Loader as all of the hooks are defined
|
93 |
+
* in that particular class.
|
94 |
+
*
|
95 |
+
* The Dsm_Supreme_Modules_For_Divi_Loader will then create the relationship
|
96 |
+
* between the defined hooks and the functions defined in this
|
97 |
+
* class.
|
98 |
+
*/
|
99 |
+
|
100 |
+
//wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/dsm-supreme-modules-for-divi-admin.js', array( 'jquery' ), $this->version, false );
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
admin/css/dsm-plugin.css
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#toplevel_page_divi_supreme_settings .wp-menu-image img {
|
2 |
+
width: 20px;
|
3 |
+
height: 20px;
|
4 |
+
padding: 7px 0 0;
|
5 |
+
opacity: 1;
|
6 |
+
filter: alpha(opacity=100);
|
7 |
+
}
|
8 |
+
|
9 |
+
.dsm-section-subtitle th {
|
10 |
+
padding: 0;
|
11 |
+
}
|
12 |
+
|
13 |
+
.dsm-section-subtitle h3 {
|
14 |
+
margin: 0;
|
15 |
+
}
|
16 |
+
#dsm_general th {
|
17 |
+
white-space: nowrap;
|
18 |
+
}
|
19 |
+
#dsm_general .form-table {
|
20 |
+
padding: 23px 15px;
|
21 |
+
border: 1px solid #e5e5e5;
|
22 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
|
23 |
+
background: #fff;
|
24 |
+
margin-top: 2em;
|
25 |
+
border-collapse: initial;
|
26 |
+
}
|
27 |
+
|
28 |
+
#dsm_general h2 {
|
29 |
+
padding: 9px 0 4px 0;
|
30 |
+
font-size: 1.3em;
|
31 |
+
}
|
32 |
+
|
33 |
+
.dsm-settings-checkbox fieldset label {
|
34 |
+
position: relative;
|
35 |
+
display: inline-block;
|
36 |
+
width: 50px;
|
37 |
+
height: 24px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.dsm-settings-checkbox input {
|
41 |
+
display: none;
|
42 |
+
}
|
43 |
+
|
44 |
+
.dsm-settings-checkbox .slider {
|
45 |
+
position: absolute;
|
46 |
+
cursor: pointer;
|
47 |
+
top: 0;
|
48 |
+
left: 0;
|
49 |
+
right: 0;
|
50 |
+
bottom: 0;
|
51 |
+
background-color: #ccc;
|
52 |
+
-webkit-transition: .4s;
|
53 |
+
transition: .4s;
|
54 |
+
}
|
55 |
+
|
56 |
+
.dsm-settings-checkbox .slider:before {
|
57 |
+
position: absolute;
|
58 |
+
content: "";
|
59 |
+
height: 16px;
|
60 |
+
width: 16px;
|
61 |
+
left: 4px;
|
62 |
+
bottom: 4px;
|
63 |
+
background-color: white;
|
64 |
+
-webkit-transition: .4s;
|
65 |
+
transition: .4s;
|
66 |
+
}
|
67 |
+
|
68 |
+
.dsm-settings-checkbox input:checked+.slider {
|
69 |
+
background-color: #6b09eb;
|
70 |
+
}
|
71 |
+
|
72 |
+
.dsm-settings-checkbox input:focus+.slider {
|
73 |
+
box-shadow: 0 0 1px #6b09eb;
|
74 |
+
}
|
75 |
+
|
76 |
+
.dsm-settings-checkbox input:checked+.slider:before {
|
77 |
+
-webkit-transform: translateX(26px);
|
78 |
+
-ms-transform: translateX(26px);
|
79 |
+
transform: translateX(26px);
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
.dsm-settings-checkbox .round {
|
84 |
+
border-radius: 24px;
|
85 |
+
}
|
86 |
+
|
87 |
+
.dsm-settings-checkbox .round:before {
|
88 |
+
border-radius: 50%;
|
89 |
+
}
|
90 |
+
|
91 |
+
#dsm_general p.submit .button-primary {
|
92 |
+
color: #fff;
|
93 |
+
border-color: #25db92;
|
94 |
+
border-radius: 50px;
|
95 |
+
font-size: 14px;
|
96 |
+
background: #25db92;
|
97 |
+
text-shadow: none;
|
98 |
+
padding: 15px 30px;
|
99 |
+
line-height: 1;
|
100 |
+
box-shadow: none;
|
101 |
+
box-shadow: 0px 12px 18px -6px rgba(0, 0, 0, 0.19);
|
102 |
+
font-weight: 700;
|
103 |
+
height: initial;
|
104 |
+
transition: color 300ms ease 0ms, color 300ms ease 0ms, background-color 300ms ease 0ms, background-color 300ms ease 0ms, border 300ms ease 0ms, border 300ms ease 0ms, border-radius 300ms ease 0ms, border-radius 300ms ease 0ms;
|
105 |
+
}
|
106 |
+
|
107 |
+
#dsm_general p.submit .button-primary:hover,
|
108 |
+
#dsm_general p.submit .button-primary:focus {
|
109 |
+
background: #fff;
|
110 |
+
color: #30323d;
|
111 |
+
border-color: #fff;
|
112 |
+
border-radius: 4px;
|
113 |
+
}
|
114 |
+
|
115 |
+
#dsm_header_footer_meta_box .dsm-header-footer-meta-box.dsm_top_header .dsm-remove-default-footer-meta-box-options,
|
116 |
+
#dsm_header_footer_meta_box .dsm-header-footer-meta-box.dsm_404 .dsm-remove-default-footer-meta-box-options,
|
117 |
+
#dsm_header_footer_meta_box .dsm-header-footer-meta-box.dsm_404 .dsm-conditional-meta-box-options,
|
118 |
+
#dsm_header_footer_meta_box .dsm-header-footer-meta-box.dsm_404 .dsm-css-classes-meta-box-options {
|
119 |
+
display: none;
|
120 |
+
}
|
121 |
+
|
122 |
+
#dsm_header_footer_meta_box p:last-child {
|
123 |
+
margin-bottom: 0;
|
124 |
+
}
|
admin/img/icon-128x128.png
ADDED
Binary file
|
admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
{includes/admin → admin}/js/dsm-admin.js
RENAMED
File without changes
|
admin/js/dsm-supreme-modules-for-divi-admin.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* All of the code for your admin-facing JavaScript source
|
6 |
+
* should reside in this file.
|
7 |
+
*
|
8 |
+
* Note: It has been assumed you will write jQuery code here, so the
|
9 |
+
* $ function reference has been prepared for usage within the scope
|
10 |
+
* of this function.
|
11 |
+
*
|
12 |
+
* This enables you to define handlers, for when the DOM is ready:
|
13 |
+
*
|
14 |
+
* $(function() {
|
15 |
+
*
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* When the window is loaded:
|
19 |
+
*
|
20 |
+
* $( window ).load(function() {
|
21 |
+
*
|
22 |
+
* });
|
23 |
+
*
|
24 |
+
* ...and/or other possibilities.
|
25 |
+
*
|
26 |
+
* Ideally, it is not considered best practise to attach more than a
|
27 |
+
* single DOM-ready or window-load handler for a particular page.
|
28 |
+
* Although scripts in the WordPress core, Plugins and Themes may be
|
29 |
+
* practising this, we should strive to set a better example in our own work.
|
30 |
+
*/
|
31 |
+
|
32 |
+
})( jQuery );
|
admin/partials/dsm-supreme-modules-for-divi-admin-display.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide a admin area view for the plugin
|
5 |
+
*
|
6 |
+
* This file is used to markup the admin-facing aspects of the plugin.
|
7 |
+
*
|
8 |
+
* @link https://suprememodules.com/about-us/
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
12 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/admin/partials
|
13 |
+
*/
|
14 |
+
?>
|
15 |
+
|
16 |
+
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
admin/persist-admin-notices-dismissal/dismiss-notice.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
//shorthand for ready event.
|
3 |
+
$(
|
4 |
+
function () {
|
5 |
+
$( 'div[data-dismissible] button.notice-dismiss' ).click(
|
6 |
+
function (event) {
|
7 |
+
event.preventDefault();
|
8 |
+
var $this = $( this );
|
9 |
+
|
10 |
+
var attr_value, option_name, dismissible_length, data;
|
11 |
+
|
12 |
+
attr_value = $this.parent().attr( 'data-dismissible' ).split( '-' );
|
13 |
+
|
14 |
+
// remove the dismissible length from the attribute value and rejoin the array.
|
15 |
+
dismissible_length = attr_value.pop();
|
16 |
+
|
17 |
+
option_name = attr_value.join( '-' );
|
18 |
+
|
19 |
+
data = {
|
20 |
+
'action': 'dismiss_admin_notice',
|
21 |
+
'option_name': option_name,
|
22 |
+
'dismissible_length': dismissible_length,
|
23 |
+
'nonce': dismissible_notice.nonce
|
24 |
+
};
|
25 |
+
|
26 |
+
// We can also pass the url value separately from ajaxurl for front end AJAX implementations
|
27 |
+
$.post( ajaxurl, data );
|
28 |
+
}
|
29 |
+
);
|
30 |
+
}
|
31 |
+
)
|
32 |
+
|
33 |
+
}(jQuery));
|
admin/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Persist Admin notices Dismissal
|
5 |
+
*
|
6 |
+
* Copyright (C) 2016 Collins Agbonghama <http://w3guy.com>
|
7 |
+
*
|
8 |
+
* This program is free software: you can redistribute it and/or modify
|
9 |
+
* it under the terms of the GNU General Public License as published by
|
10 |
+
* the Free Software Foundation, either version 3 of the License, or
|
11 |
+
* (at your option) any later version.
|
12 |
+
*
|
13 |
+
* This program is distributed in the hope that it will be useful,
|
14 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
* GNU General Public License for more details.
|
17 |
+
*
|
18 |
+
* You should have received a copy of the GNU General Public License
|
19 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
+
*
|
21 |
+
* @package Persist Admin notices Dismissal
|
22 |
+
* @author Collins Agbonghama
|
23 |
+
* @author Andy Fragen
|
24 |
+
* @license http://www.gnu.org/licenses GNU General Public License
|
25 |
+
* @version 1.4.3
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Exit if called directly.
|
30 |
+
*/
|
31 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
+
die;
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! class_exists( 'DSM_NOTICE' ) ) {
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Class PAnD
|
39 |
+
*/
|
40 |
+
class DSM_NOTICE {
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Init hooks.
|
44 |
+
*/
|
45 |
+
public static function init() {
|
46 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
|
47 |
+
add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Filter to activate another filter providing a simpler use case.
|
51 |
+
*
|
52 |
+
* @since 1.4.3
|
53 |
+
*
|
54 |
+
* @param bool
|
55 |
+
*/
|
56 |
+
if ( apply_filters( 'pand_theme_loader', false ) ) {
|
57 |
+
add_filter(
|
58 |
+
'pand_dismiss_notice_js_url',
|
59 |
+
function( $js_url, $composer_path ) {
|
60 |
+
return get_stylesheet_directory_uri() . $composer_path;
|
61 |
+
},
|
62 |
+
10,
|
63 |
+
2
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Enqueue javascript and variables.
|
70 |
+
*/
|
71 |
+
public static function load_script() {
|
72 |
+
|
73 |
+
if ( is_customize_preview() ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
$js_url = plugins_url( 'dismiss-notice.js', __FILE__ );
|
78 |
+
$composer_path = '/vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js';
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Filter dismiss-notice.js URL.
|
82 |
+
*
|
83 |
+
* @since 1.4.3
|
84 |
+
*
|
85 |
+
* @param string $js_url URL to the Javascript file.
|
86 |
+
* @param string $composer_path Relative path of Javascript file from composer install.
|
87 |
+
*/
|
88 |
+
$js_url = apply_filters( 'pand_dismiss_notice_js_url', $js_url, $composer_path );
|
89 |
+
wp_enqueue_script(
|
90 |
+
'dismissible-notices',
|
91 |
+
$js_url,
|
92 |
+
array( 'jquery', 'common' ),
|
93 |
+
false,
|
94 |
+
true
|
95 |
+
);
|
96 |
+
|
97 |
+
wp_localize_script(
|
98 |
+
'dismissible-notices',
|
99 |
+
'dismissible_notice',
|
100 |
+
array(
|
101 |
+
'nonce' => wp_create_nonce( 'dismissible-notice' ),
|
102 |
+
)
|
103 |
+
);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Handles Ajax request to persist notices dismissal.
|
108 |
+
* Uses check_ajax_referer to verify nonce.
|
109 |
+
*/
|
110 |
+
public static function dismiss_admin_notice() {
|
111 |
+
$option_name = sanitize_text_field( $_POST['option_name'] );
|
112 |
+
$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
|
113 |
+
|
114 |
+
if ( 'forever' != $dismissible_length ) {
|
115 |
+
// If $dismissible_length is not an integer default to 1
|
116 |
+
$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
|
117 |
+
$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
|
118 |
+
}
|
119 |
+
|
120 |
+
check_ajax_referer( 'dismissible-notice', 'nonce' );
|
121 |
+
self::set_admin_notice_cache( $option_name, $dismissible_length );
|
122 |
+
wp_die();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Is admin notice active?
|
127 |
+
*
|
128 |
+
* @param string $arg data-dismissible content of notice.
|
129 |
+
*
|
130 |
+
* @return bool
|
131 |
+
*/
|
132 |
+
public static function is_admin_notice_active( $arg ) {
|
133 |
+
$array = explode( '-', $arg );
|
134 |
+
$length = array_pop( $array );
|
135 |
+
$option_name = implode( '-', $array );
|
136 |
+
$db_record = self::get_admin_notice_cache( $option_name );
|
137 |
+
|
138 |
+
if ( 'forever' == $db_record ) {
|
139 |
+
return false;
|
140 |
+
} elseif ( absint( $db_record ) >= time() ) {
|
141 |
+
return false;
|
142 |
+
} else {
|
143 |
+
return true;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Returns admin notice cached timeout.
|
149 |
+
*
|
150 |
+
* @access public
|
151 |
+
*
|
152 |
+
* @param string|bool $id admin notice name or false.
|
153 |
+
*
|
154 |
+
* @return array|bool The timeout. False if expired.
|
155 |
+
*/
|
156 |
+
public static function get_admin_notice_cache( $id = false ) {
|
157 |
+
if ( ! $id ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
$cache_key = 'pand-' . md5( $id );
|
161 |
+
$timeout = get_site_option( $cache_key );
|
162 |
+
$timeout = 'forever' === $timeout ? time() + 60 : $timeout;
|
163 |
+
|
164 |
+
if ( empty( $timeout ) || time() > $timeout ) {
|
165 |
+
return false;
|
166 |
+
}
|
167 |
+
|
168 |
+
return $timeout;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Sets admin notice timeout in site option.
|
173 |
+
*
|
174 |
+
* @access public
|
175 |
+
*
|
176 |
+
* @param string $id Data Identifier.
|
177 |
+
* @param string|bool $timeout Timeout for admin notice.
|
178 |
+
*
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
+
public static function set_admin_notice_cache( $id, $timeout ) {
|
182 |
+
$cache_key = 'pand-' . md5( $id );
|
183 |
+
update_site_option( $cache_key, $timeout );
|
184 |
+
|
185 |
+
return true;
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
includes/SupremeModulesForDivi.php
CHANGED
@@ -41,6 +41,25 @@ class DSM_SupremeModulesForDivi extends DiviExtension {
|
|
41 |
|
42 |
parent::__construct( $name, $args );
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
new DSM_SupremeModulesForDivi;
|
41 |
|
42 |
parent::__construct( $name, $args );
|
43 |
}
|
44 |
+
/**
|
45 |
+
* Enqueues non-minified, hot reloaded javascript bundles.
|
46 |
+
*
|
47 |
+
* @since 3.1
|
48 |
+
*/
|
49 |
+
protected function _enqueue_debug_bundles() {
|
50 |
+
// Frontend Bundle
|
51 |
+
$site_url = wp_parse_url( get_site_url() );
|
52 |
+
$hot_bundle_url = "http://localhost:3000/static/js/frontend-bundle.js";
|
53 |
+
|
54 |
+
wp_enqueue_script( "{$this->name}-frontend-bundle", $hot_bundle_url, $this->_bundle_dependencies['frontend'], $this->version, true );
|
55 |
+
|
56 |
+
if ( et_core_is_fb_enabled() ) {
|
57 |
+
// Builder Bundle
|
58 |
+
$hot_bundle_url = "http://localhost:3000/static/js/builder-bundle.js";
|
59 |
+
|
60 |
+
wp_enqueue_script( "{$this->name}-builder-bundle", $hot_bundle_url, $this->_bundle_dependencies['builder'], $this->version, true );
|
61 |
+
}
|
62 |
+
}
|
63 |
}
|
64 |
|
65 |
new DSM_SupremeModulesForDivi;
|
includes/SupremeModulesLoader.php
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
<?php
|
2 |
-
require_once plugin_dir_path( __FILE__ ) . 'class.settings-api.php';
|
3 |
-
require_once plugin_dir_path( __FILE__ ) . 'class.page-settings.php';
|
4 |
-
|
5 |
/*Temporary fix*/
|
6 |
if ( ! function_exists( 'et_core_is_fb_enabled' ) ):
|
7 |
function et_core_is_fb_enabled() {
|
@@ -26,771 +23,4 @@ function et_divi_divider_style_choices() {
|
|
26 |
) );
|
27 |
}
|
28 |
endif;
|
29 |
-
/*End of Temporary fix*/
|
30 |
-
|
31 |
-
function dsm_setting_get_option( $option, $section, $default = '' ) {
|
32 |
-
|
33 |
-
$options = get_option( $section );
|
34 |
-
|
35 |
-
if ( isset( $options[$option] ) ) {
|
36 |
-
return $options[$option];
|
37 |
-
}
|
38 |
-
|
39 |
-
return $default;
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( dsm_setting_get_option( 'dsm_use_scheduled_content', 'dsm_general' ) == 'on' ) {
|
43 |
-
add_filter('et_pb_all_fields_unprocessed_et_pb_section', 'dsm_add_section_setting');
|
44 |
-
function dsm_add_section_setting($fields_unprocessed) {
|
45 |
-
$fields = [];
|
46 |
-
$fields['dsm_section_schedule_visibility'] = array(
|
47 |
-
'label' => esc_html__( 'Use Scheduled Content Visibility', 'dsm-supreme-modules-for-divi' ),
|
48 |
-
'type' => 'yes_no_button',
|
49 |
-
'option_category' => 'configuration',
|
50 |
-
'options' => array(
|
51 |
-
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
52 |
-
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
53 |
-
),
|
54 |
-
'default_on_front' => 'off',
|
55 |
-
'tab_slug' => 'custom_css',
|
56 |
-
'toggle_slug' => 'visibility',
|
57 |
-
'description' => esc_html__( 'Here you can choose whether your Section will show or hide depending on the given date/time.', 'dsm-supreme-modules-for-divi' ),
|
58 |
-
);
|
59 |
-
$fields['dsm_section_schedule_show_hide'] = array(
|
60 |
-
'label' => esc_html__( 'Show or Hide Section', 'dsm-supreme-modules-for-divi' ),
|
61 |
-
'type' => 'select',
|
62 |
-
'option_category' => 'configuration',
|
63 |
-
'options' => array(
|
64 |
-
'start' => esc_html__( 'Show', 'dsm-supreme-modules-for-divi' ),
|
65 |
-
'end' => esc_html__( 'Hide', 'dsm-supreme-modules-for-divi' ),
|
66 |
-
),
|
67 |
-
'default_on_front' => 'start',
|
68 |
-
'tab_slug' => 'custom_css',
|
69 |
-
'toggle_slug' => 'visibility',
|
70 |
-
'show_if' => array(
|
71 |
-
'dsm_section_schedule_visibility' => 'on',
|
72 |
-
),
|
73 |
-
);
|
74 |
-
$fields['dsm_section_schedule_after_datetime'] = array(
|
75 |
-
'default' => '',
|
76 |
-
'label' => esc_html__( 'Schedule a Date/Time', 'dsm-supreme-modules-for-divi' ),
|
77 |
-
'type' => 'date_picker',
|
78 |
-
'tab_slug' => 'custom_css',
|
79 |
-
'toggle_slug' => 'visibility',
|
80 |
-
'show_if' => array(
|
81 |
-
'dsm_section_schedule_visibility' => 'on',
|
82 |
-
),
|
83 |
-
);
|
84 |
-
return array_merge($fields_unprocessed, $fields);
|
85 |
-
}
|
86 |
-
|
87 |
-
add_filter( 'et_module_shortcode_output', 'output_section', 10, 3 );
|
88 |
-
function output_section( $output, $render_slug, $module ) {
|
89 |
-
if ('et_pb_section' !== $render_slug) {
|
90 |
-
return $output;
|
91 |
-
} else if ('on' !== $module->props['dsm_section_schedule_visibility']) {
|
92 |
-
return $output;
|
93 |
-
} else {
|
94 |
-
$dsm_section_schedule_visibility = $module->props['dsm_section_schedule_visibility'];
|
95 |
-
$dsm_section_schedule_show_hide = $module->props['dsm_section_schedule_show_hide'];
|
96 |
-
$dsm_section_schedule_after_datetime = $module->props['dsm_section_schedule_after_datetime'];
|
97 |
-
|
98 |
-
$dsm_section_class_output = '';
|
99 |
-
if ($dsm_section_schedule_visibility == 'on') {
|
100 |
-
$dsm_section_class_output .= ' dsm_schedule_visibility';
|
101 |
-
}
|
102 |
-
$output = str_replace('class="et_pb_section ', 'data-dsm-' . esc_html($dsm_section_schedule_show_hide) . '="' . esc_html($dsm_section_schedule_after_datetime) . '" class="et_pb_section'. $dsm_section_class_output .' ', $output);
|
103 |
-
return $output;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
add_filter('et_pb_all_fields_unprocessed_et_pb_row', 'dsm_add_row_setting');
|
108 |
-
function dsm_add_row_setting($fields_unprocessed) {
|
109 |
-
$fields = [];
|
110 |
-
$fields['dsm_row_schedule_visibility'] = array(
|
111 |
-
'label' => esc_html__( 'Use Scheduled Content Visibility', 'dsm-supreme-modules-for-divi' ),
|
112 |
-
'type' => 'yes_no_button',
|
113 |
-
'option_category' => 'configuration',
|
114 |
-
'options' => array(
|
115 |
-
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
116 |
-
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
117 |
-
),
|
118 |
-
'default_on_front' => 'off',
|
119 |
-
'tab_slug' => 'custom_css',
|
120 |
-
'toggle_slug' => 'visibility',
|
121 |
-
'description' => esc_html__( 'Here you can choose whether your Row will show/hide depending on the given date/time.', 'dsm-supreme-modules-for-divi' ),
|
122 |
-
);
|
123 |
-
$fields['dsm_row_schedule_show_hide'] = array(
|
124 |
-
'label' => esc_html__( 'Show or Hide Row', 'dsm-supreme-modules-for-divi' ),
|
125 |
-
'type' => 'select',
|
126 |
-
'option_category' => 'configuration',
|
127 |
-
'options' => array(
|
128 |
-
'start' => esc_html__( 'Show', 'dsm-supreme-modules-for-divi' ),
|
129 |
-
'end' => esc_html__( 'Hide', 'dsm-supreme-modules-for-divi' ),
|
130 |
-
),
|
131 |
-
'default_on_front' => 'start',
|
132 |
-
'tab_slug' => 'custom_css',
|
133 |
-
'toggle_slug' => 'visibility',
|
134 |
-
'show_if' => array(
|
135 |
-
'dsm_row_schedule_visibility' => 'on',
|
136 |
-
),
|
137 |
-
);
|
138 |
-
$fields['dsm_row_schedule_after_datetime'] = array(
|
139 |
-
'default' => '',
|
140 |
-
'label' => esc_html__( 'Schedule a Date/Time', 'dsm-supreme-modules-for-divi' ),
|
141 |
-
'type' => 'date_picker',
|
142 |
-
'tab_slug' => 'custom_css',
|
143 |
-
'toggle_slug' => 'visibility',
|
144 |
-
'show_if' => array(
|
145 |
-
'dsm_row_schedule_visibility' => 'on',
|
146 |
-
),
|
147 |
-
);
|
148 |
-
return array_merge($fields_unprocessed, $fields);
|
149 |
-
}
|
150 |
-
|
151 |
-
add_filter( 'et_module_shortcode_output', 'output_row', 10, 3 );
|
152 |
-
function output_row( $output, $render_slug, $module ) {
|
153 |
-
if ('et_pb_row' !== $render_slug) {
|
154 |
-
return $output;
|
155 |
-
} else if ('on' !== $module->props['dsm_row_schedule_visibility']) {
|
156 |
-
return $output;
|
157 |
-
} else {
|
158 |
-
$dsm_row_schedule_visibility = $module->props['dsm_row_schedule_visibility'];
|
159 |
-
$dsm_row_schedule_show_hide = $module->props['dsm_row_schedule_show_hide'];
|
160 |
-
$dsm_row_schedule_after_datetime = $module->props['dsm_row_schedule_after_datetime'];
|
161 |
-
|
162 |
-
$dsm_row_class_output = '';
|
163 |
-
if ($dsm_row_schedule_visibility == 'on') {
|
164 |
-
$dsm_row_class_output .= ' dsm_schedule_visibility';
|
165 |
-
}
|
166 |
-
$output = str_replace('class="et_pb_row ', 'data-dsm-' . esc_html($dsm_row_schedule_show_hide) . '="' . esc_html($dsm_row_schedule_after_datetime) . '" class="et_pb_row'. $dsm_row_class_output .' ', $output);
|
167 |
-
return $output;
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
}
|
172 |
-
// Load custom CF
|
173 |
-
if( ! function_exists( 'dsm_et_builder_load_actions' )) {
|
174 |
-
function dsm_et_builder_load_actions( $actions ) {
|
175 |
-
$actions[] = 'dsm_load_caldera_forms';
|
176 |
-
|
177 |
-
return $actions;
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
add_filter( 'et_builder_load_actions', 'dsm_et_builder_load_actions' );
|
182 |
-
|
183 |
-
if( ! function_exists( 'dsm_load_caldera_forms' )) {
|
184 |
-
function dsm_load_caldera_forms() {
|
185 |
-
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
|
186 |
-
wp_die();
|
187 |
-
}
|
188 |
-
echo do_shortcode( '[caldera_form id="' . $_POST['cf_library'] . '"]' );
|
189 |
-
wp_die();
|
190 |
-
}
|
191 |
-
}
|
192 |
-
add_action( 'wp_ajax_nopriv_dsm_load_caldera_forms', 'dsm_load_caldera_forms' );
|
193 |
-
add_action( 'wp_ajax_dsm_load_caldera_forms', 'dsm_load_caldera_forms' );
|
194 |
-
|
195 |
-
// Load custom CF7
|
196 |
-
if( ! function_exists( 'dsm_et_builder_load_actions' )) {
|
197 |
-
function dsm_et_builder_load_actions( $actions ) {
|
198 |
-
$actions[] = 'dsm_load_cf7_library';
|
199 |
-
|
200 |
-
return $actions;
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
add_filter( 'et_builder_load_actions', 'dsm_et_builder_load_actions' );
|
205 |
-
|
206 |
-
if( ! function_exists( 'dsm_load_cf7_library' )) {
|
207 |
-
function dsm_load_cf7_library() {
|
208 |
-
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
|
209 |
-
wp_die();
|
210 |
-
}
|
211 |
-
echo do_shortcode( '[contact-form-7 id="' . $_POST['cf7_library'] . '"]' );
|
212 |
-
wp_die();
|
213 |
-
}
|
214 |
-
}
|
215 |
-
add_action( 'wp_ajax_nopriv_dsm_load_cf7_library', 'dsm_load_cf7_library' );
|
216 |
-
add_action( 'wp_ajax_dsm_load_cf7_library', 'dsm_load_cf7_library' );
|
217 |
-
|
218 |
-
/* Removing default submit tag */
|
219 |
-
remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_submit' );
|
220 |
-
//remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit', 20 );
|
221 |
-
add_action( 'wpcf7_init', 'dsm_wpcf7_add_form_tag_submit' );
|
222 |
-
if ( !function_exists('dsm_wpcf7_add_form_tag_submit') ) {
|
223 |
-
function dsm_wpcf7_add_form_tag_submit() {
|
224 |
-
wpcf7_add_form_tag( 'submit', 'dsm_wpcf7_submit_form_tag_handler' );
|
225 |
-
}
|
226 |
-
}
|
227 |
-
|
228 |
-
if ( !function_exists('dsm_wpcf7_submit_form_tag_handler') ) {
|
229 |
-
function dsm_wpcf7_submit_form_tag_handler( $tag ) {
|
230 |
-
$class = wpcf7_form_controls_class( $tag->type . ' et_pb_button' );
|
231 |
-
|
232 |
-
$atts = array();
|
233 |
-
|
234 |
-
$atts['class'] = $tag->get_class_option( $class );
|
235 |
-
$atts['id'] = $tag->get_id_option();
|
236 |
-
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
237 |
-
|
238 |
-
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
|
239 |
-
|
240 |
-
if ( empty( $value ) ) {
|
241 |
-
$value = __( 'Send', 'contact-form-7' );
|
242 |
-
}
|
243 |
-
|
244 |
-
$atts['type'] = 'submit';
|
245 |
-
$atts['value'] = $value;
|
246 |
-
|
247 |
-
$atts = wpcf7_format_atts( $atts );
|
248 |
-
|
249 |
-
$html = '<button ' . $atts . '>' . esc_attr( $value ) . '</button>';
|
250 |
-
|
251 |
-
return $html;
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_select', 20 );
|
256 |
-
add_action( 'wpcf7_init', 'dsm_wpcf7_add_form_tag_select' );
|
257 |
-
|
258 |
-
function dsm_wpcf7_add_form_tag_select() {
|
259 |
-
wpcf7_add_form_tag( array( 'select', 'select*' ),
|
260 |
-
'dsm_wpcf7_select_form_tag_handler',
|
261 |
-
array(
|
262 |
-
'name-attr' => true,
|
263 |
-
'selectable-values' => true,
|
264 |
-
)
|
265 |
-
);
|
266 |
-
}
|
267 |
-
|
268 |
-
function dsm_wpcf7_select_form_tag_handler( $tag ) {
|
269 |
-
if ( empty( $tag->name ) ) {
|
270 |
-
return '';
|
271 |
-
}
|
272 |
-
|
273 |
-
$validation_error = wpcf7_get_validation_error( $tag->name );
|
274 |
-
|
275 |
-
$class = wpcf7_form_controls_class( $tag->type );
|
276 |
-
|
277 |
-
if ( $validation_error ) {
|
278 |
-
$class .= ' wpcf7-not-valid';
|
279 |
-
}
|
280 |
-
|
281 |
-
$atts = array();
|
282 |
-
|
283 |
-
$atts['class'] = $tag->get_class_option( $class . ' et_pb_contact_select input' );
|
284 |
-
$atts['id'] = $tag->get_id_option();
|
285 |
-
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
286 |
-
|
287 |
-
if ( $tag->is_required() ) {
|
288 |
-
$atts['aria-required'] = 'true';
|
289 |
-
}
|
290 |
-
|
291 |
-
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
|
292 |
-
|
293 |
-
$multiple = $tag->has_option( 'multiple' );
|
294 |
-
$include_blank = $tag->has_option( 'include_blank' );
|
295 |
-
$first_as_label = $tag->has_option( 'first_as_label' );
|
296 |
-
|
297 |
-
if ( $tag->has_option( 'size' ) ) {
|
298 |
-
$size = $tag->get_option( 'size', 'int', true );
|
299 |
-
|
300 |
-
if ( $size ) {
|
301 |
-
$atts['size'] = $size;
|
302 |
-
} elseif ( $multiple ) {
|
303 |
-
$atts['size'] = 4;
|
304 |
-
} else {
|
305 |
-
$atts['size'] = 1;
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
$values = $tag->values;
|
310 |
-
$labels = $tag->labels;
|
311 |
-
|
312 |
-
if ( $data = (array) $tag->get_data_option() ) {
|
313 |
-
$values = array_merge( $values, array_values( $data ) );
|
314 |
-
$labels = array_merge( $labels, array_values( $data ) );
|
315 |
-
}
|
316 |
-
|
317 |
-
$default_choice = $tag->get_default_option( null, array(
|
318 |
-
'multiple' => $multiple,
|
319 |
-
'shifted' => $include_blank,
|
320 |
-
) );
|
321 |
-
|
322 |
-
if ( $include_blank || empty( $values ) ) {
|
323 |
-
array_unshift( $labels, '---' );
|
324 |
-
array_unshift( $values, '' );
|
325 |
-
} elseif ( $first_as_label ) {
|
326 |
-
$values[0] = '';
|
327 |
-
}
|
328 |
-
|
329 |
-
$html = '';
|
330 |
-
$hangover = wpcf7_get_hangover( $tag->name );
|
331 |
-
|
332 |
-
foreach ( $values as $key => $value ) {
|
333 |
-
if ( $hangover ) {
|
334 |
-
$selected = in_array( $value, (array) $hangover, true );
|
335 |
-
} else {
|
336 |
-
$selected = in_array( $value, (array) $default_choice, true );
|
337 |
-
}
|
338 |
-
|
339 |
-
$item_atts = array(
|
340 |
-
'value' => $value,
|
341 |
-
'selected' => $selected ? 'selected' : '',
|
342 |
-
);
|
343 |
-
|
344 |
-
$item_atts = wpcf7_format_atts( $item_atts );
|
345 |
-
|
346 |
-
$label = isset( $labels[$key] ) ? $labels[$key] : $value;
|
347 |
-
|
348 |
-
$html .= sprintf( '<option %1$s>%2$s</option>',
|
349 |
-
$item_atts, esc_html( $label ) );
|
350 |
-
}
|
351 |
-
|
352 |
-
if ( $multiple ) {
|
353 |
-
$atts['multiple'] = 'multiple';
|
354 |
-
}
|
355 |
-
|
356 |
-
$atts['name'] = $tag->name . ( $multiple ? '[]' : '' );
|
357 |
-
|
358 |
-
$atts = wpcf7_format_atts( $atts );
|
359 |
-
|
360 |
-
$html = sprintf(
|
361 |
-
'<span class="wpcf7-form-control-wrap dsm-contact-form-7-select %1$s"><select %2$s>%3$s</select>%4$s</span>',
|
362 |
-
sanitize_html_class( $tag->name ), $atts, $html, $validation_error );
|
363 |
-
|
364 |
-
return $html;
|
365 |
-
}
|
366 |
-
|
367 |
-
function dsm_admin_footer_text( $footer_text ) {
|
368 |
-
$current_screen = get_current_screen();
|
369 |
-
$is_divi_supreme_screen = ( $current_screen && false !== strpos( $current_screen->id, 'toplevel_page_divi_supreme_settings' ) );
|
370 |
-
|
371 |
-
if ( $is_divi_supreme_screen ) {
|
372 |
-
$footer_text = sprintf(
|
373 |
-
__( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'dsm-supreme-modules-for-divi' ),
|
374 |
-
sprintf( '<strong>%s</strong>', esc_html__( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ) ),
|
375 |
-
'<a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" target="_blank" class="dsm-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '">★★★★★</a>'
|
376 |
-
);
|
377 |
-
}
|
378 |
-
|
379 |
-
return $footer_text;
|
380 |
-
}
|
381 |
-
|
382 |
-
add_filter('admin_footer_text', 'dsm_admin_footer_text');
|
383 |
-
|
384 |
-
if ( dsm_setting_get_option( 'dsm_use_header_footer', 'dsm_general' ) == 'on' ) {
|
385 |
-
if ( ! function_exists( 'dsm_header_footer_posttypes' ) ) :
|
386 |
-
function dsm_header_footer_posttypes() {
|
387 |
-
$labels = array(
|
388 |
-
'name' => esc_html__( 'Divi Templates', 'dsm-supreme-modules-for-divi' ),
|
389 |
-
'singular_name' => esc_html__( 'Divi Template', 'dsm-supreme-modules-for-divi' ),
|
390 |
-
'add_new' => esc_html__( 'Add New', 'dsm-supreme-modules-for-divi' ),
|
391 |
-
'add_new_item' => esc_html__( 'Add New Template', 'dsm-supreme-modules-for-divi' ),
|
392 |
-
'edit_item' => esc_html__( 'Edit Template', 'dsm-supreme-modules-for-divi' ),
|
393 |
-
'new_item' => esc_html__( 'New Template', 'dsm-supreme-modules-for-divi' ),
|
394 |
-
'all_items' => esc_html__( 'All Templates', 'dsm-supreme-modules-for-divi' ),
|
395 |
-
'view_item' => esc_html__( 'View Template', 'dsm-supreme-modules-for-divi' ),
|
396 |
-
'search_items' => esc_html__( 'Search Templates', 'dsm-supreme-modules-for-divi' ),
|
397 |
-
'not_found' => esc_html__( 'Nothing found', 'dsm-supreme-modules-for-divi' ),
|
398 |
-
'not_found_in_trash' => esc_html__( 'Nothing found in Trash', 'dsm-supreme-modules-for-divi' ),
|
399 |
-
'parent_item_colon' => '',
|
400 |
-
);
|
401 |
-
|
402 |
-
$args = array(
|
403 |
-
'labels' => $labels,
|
404 |
-
'public' => false,
|
405 |
-
'publicly_queryable' => true,
|
406 |
-
'show_in_menu' => false,
|
407 |
-
'show_ui' => true,
|
408 |
-
'can_export' => true,
|
409 |
-
'show_in_nav_menus' => true,
|
410 |
-
'has_archive' => true,
|
411 |
-
'rewrite' => array(
|
412 |
-
'slug' => 'header-footer',
|
413 |
-
'with_front' => false
|
414 |
-
),
|
415 |
-
'capability_type' => 'post',
|
416 |
-
'hierarchical' => false,
|
417 |
-
'menu_position' => null,
|
418 |
-
'supports' => array( 'title', 'author', 'editor', 'thumbnail', 'revisions', 'custom-fields' ),
|
419 |
-
);
|
420 |
-
|
421 |
-
register_post_type( 'dsm_header_footer', $args );
|
422 |
-
}
|
423 |
-
endif;
|
424 |
-
add_action( 'init', 'dsm_header_footer_posttypes', 0 );
|
425 |
-
|
426 |
-
function dsm_load_headerfooter_template($template) {
|
427 |
-
global $post;
|
428 |
-
|
429 |
-
if ($post->post_type == 'dsm_header_footer' && $template !== locate_template(array('page-template-blank.php'))){
|
430 |
-
return plugin_dir_path( __FILE__ ) . 'templates/page-template-blank.php';
|
431 |
-
}
|
432 |
-
|
433 |
-
return $template;
|
434 |
-
}
|
435 |
-
|
436 |
-
add_filter('single_template', 'dsm_load_headerfooter_template');
|
437 |
-
|
438 |
-
|
439 |
-
function dsm_header_footer_meta_box_options($post) {
|
440 |
-
wp_nonce_field( 'dsm-header-footer-meta-box-nonce', 'dsm-header-footer-meta-box-nonce' );
|
441 |
-
?>
|
442 |
-
<div class="dsm-header-footer-meta-box dsm_<?php echo get_post_meta($post->ID, 'dsm-header-footer-meta-box-options', true); ?>">
|
443 |
-
<p class="dsm-header-footer-meta-box-options">
|
444 |
-
<label for="dsm-header-footer-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">Assign template to:</label>
|
445 |
-
<select name="dsm-header-footer-meta-box-options">
|
446 |
-
<?php
|
447 |
-
$option_values = array(
|
448 |
-
'footer' => __( 'Footer', 'dsm-supreme-modules-for-divi' ),
|
449 |
-
'404' => __( '404', 'dsm-supreme-modules-for-divi' ),
|
450 |
-
//'header' => __( 'Header (Not available)', 'dsm-supreme-modules-for-divi' ),
|
451 |
-
);
|
452 |
-
|
453 |
-
foreach($option_values as $key => $value) {
|
454 |
-
if($key == get_post_meta($post->ID, 'dsm-header-footer-meta-box-options', true)) {
|
455 |
-
?>
|
456 |
-
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
|
457 |
-
<?php
|
458 |
-
}
|
459 |
-
else {
|
460 |
-
?>
|
461 |
-
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
462 |
-
<?php
|
463 |
-
}
|
464 |
-
}
|
465 |
-
?>
|
466 |
-
</select>
|
467 |
-
</p>
|
468 |
-
<p class="dsm-css-classes-meta-box-options">
|
469 |
-
<label for="dsm-css-classes-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">CSS Classes:</label>
|
470 |
-
<input name="dsm-css-classes-meta-box-options" style="width:100%;" type="text" value="<?php echo get_post_meta($post->ID, 'dsm-css-classes-meta-box-options', true); ?>">
|
471 |
-
</p>
|
472 |
-
<p class="dsm-remove-default-footer-meta-box-options">
|
473 |
-
<label for="dsm-remove-default-footer-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">Remove default Divi footer</label>
|
474 |
-
<select name="dsm-remove-default-footer-meta-box-options">
|
475 |
-
<?php
|
476 |
-
$option_values = array(
|
477 |
-
'no' => __( 'No', 'dsm-supreme-modules-for-divi' ),
|
478 |
-
'yes' => __( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
479 |
-
);
|
480 |
-
|
481 |
-
foreach($option_values as $key => $value) {
|
482 |
-
if($key == get_post_meta($post->ID, 'dsm-remove-default-footer-meta-box-options', true)) {
|
483 |
-
?>
|
484 |
-
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
|
485 |
-
<?php
|
486 |
-
}
|
487 |
-
else {
|
488 |
-
?>
|
489 |
-
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
490 |
-
<?php
|
491 |
-
}
|
492 |
-
}
|
493 |
-
?>
|
494 |
-
</select>
|
495 |
-
</p>
|
496 |
-
<!--p>
|
497 |
-
<label for="dsm-embed-footer-in-vb" style="display: block; font-weight: bold; margin-bottom: 5px;">Embed Footer in Visual Builder</label>
|
498 |
-
<span style="display:block; margin-bottom: 5px;">This will show the footer when using Visual Builder in other pages/post/custom post type.</span>
|
499 |
-
<select name="dsm-embed-footer-in-vb"-->
|
500 |
-
<?php
|
501 |
-
/**
|
502 |
-
$option_values = array(
|
503 |
-
'no' => __( 'No', 'dsm-supreme-modules-for-divi' ),
|
504 |
-
'yes' => __( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
505 |
-
);
|
506 |
-
|
507 |
-
foreach($option_values as $key => $value) {
|
508 |
-
if($key == get_post_meta($post->ID, 'dsm-embed-footer-in-vb', true)) {
|
509 |
-
?>
|
510 |
-
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
|
511 |
-
<?php
|
512 |
-
}
|
513 |
-
else {
|
514 |
-
?>
|
515 |
-
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
516 |
-
<?php
|
517 |
-
}
|
518 |
-
}**/
|
519 |
-
?>
|
520 |
-
<!--/select>
|
521 |
-
</p-->
|
522 |
-
<p><?php _e( 'Note: Footer Template will only show up on the frontend.', 'dsm-supreme-modules-for-divi' ); ?></p>
|
523 |
-
</div>
|
524 |
-
<?php
|
525 |
-
}
|
526 |
-
|
527 |
-
|
528 |
-
if ( ! function_exists( 'dsm_add_header_footer_meta_box' ) ) :
|
529 |
-
function dsm_add_header_footer_meta_box() {
|
530 |
-
add_meta_box('dsm_header_footer_meta_box', 'Divi Templates', 'dsm_header_footer_meta_box_options', 'dsm_header_footer', 'side', 'high', null);
|
531 |
-
remove_meta_box( 'et_settings_meta_box', 'dsm_header_footer', 'side', 'high' );
|
532 |
-
}
|
533 |
-
endif;
|
534 |
-
|
535 |
-
add_action("add_meta_boxes", "dsm_add_header_footer_meta_box", 11);
|
536 |
-
|
537 |
-
function dsm_save_header_footer_meta_box($post_id, $post, $update) {
|
538 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
539 |
-
return;
|
540 |
-
}
|
541 |
-
|
542 |
-
if ( ! isset( $_POST['dsm-header-footer-meta-box-nonce'] ) || ! wp_verify_nonce( $_POST['dsm-header-footer-meta-box-nonce'], 'dsm-header-footer-meta-box-nonce' ) ) {
|
543 |
-
return;
|
544 |
-
}
|
545 |
-
|
546 |
-
if ( ! current_user_can( 'edit_posts' ) ) {
|
547 |
-
return;
|
548 |
-
}
|
549 |
-
|
550 |
-
$slug = 'dsm_header_footer';
|
551 |
-
if ( $slug != $post->post_type ) {
|
552 |
-
return $post_id;
|
553 |
-
}
|
554 |
-
|
555 |
-
if ( isset( $_POST['dsm-header-footer-meta-box-options'] ) ) {
|
556 |
-
update_post_meta( $post_id, 'dsm-header-footer-meta-box-options', esc_attr( $_POST['dsm-header-footer-meta-box-options'] ) );
|
557 |
-
}
|
558 |
-
|
559 |
-
if ( isset( $_POST['dsm-css-classes-meta-box-options'] ) ) {
|
560 |
-
update_post_meta( $post_id, 'dsm-css-classes-meta-box-options', sanitize_text_field( $_POST['dsm-css-classes-meta-box-options'] ) );
|
561 |
-
}
|
562 |
-
|
563 |
-
if ( isset( $_POST['dsm-remove-default-footer-meta-box-options'] ) ) {
|
564 |
-
update_post_meta( $post_id, 'dsm-remove-default-footer-meta-box-options', esc_attr( $_POST['dsm-remove-default-footer-meta-box-options'] ) );
|
565 |
-
}
|
566 |
-
/*
|
567 |
-
if ( isset( $_POST['dsm-embed-footer-in-vb'] ) ) {
|
568 |
-
update_post_meta( $post_id, 'dsm-embed-footer-in-vb', sanitize_text_field( $_POST['dsm-embed-footer-in-vb'] ) );
|
569 |
-
}*/
|
570 |
-
}
|
571 |
-
|
572 |
-
add_action('save_post', 'dsm_save_header_footer_meta_box', 10, 3);
|
573 |
-
|
574 |
-
function dsm_custom_footer() {
|
575 |
-
$footer_args = array(
|
576 |
-
'post_type' => 'dsm_header_footer',
|
577 |
-
'meta_key' => 'dsm-header-footer-meta-box-options',
|
578 |
-
'meta_value' => 'footer',
|
579 |
-
'meta_type' => 'post',
|
580 |
-
'meta_query' => array(
|
581 |
-
array(
|
582 |
-
'key' => 'dsm-header-footer-meta-box-options',
|
583 |
-
'value' => 'footer',
|
584 |
-
'compare' => '==',
|
585 |
-
'type' => 'post',
|
586 |
-
),
|
587 |
-
),
|
588 |
-
);
|
589 |
-
|
590 |
-
$footer_template = new WP_Query(
|
591 |
-
$footer_args
|
592 |
-
);
|
593 |
-
|
594 |
-
$footer_css_args = array(
|
595 |
-
'post_type' => 'dsm_header_footer',
|
596 |
-
'meta_key' => 'dsm-css-classes-meta-box-options',
|
597 |
-
'value' => '',
|
598 |
-
'meta_type' => 'post',
|
599 |
-
'meta_query' => array(
|
600 |
-
array(
|
601 |
-
'key' => 'dsm-css-classes-meta-box-options',
|
602 |
-
'value' => '',
|
603 |
-
'compare' => '!=',
|
604 |
-
'type' => 'post',
|
605 |
-
),
|
606 |
-
),
|
607 |
-
);
|
608 |
-
|
609 |
-
$footer_css_template = new WP_Query(
|
610 |
-
$footer_css_args
|
611 |
-
);
|
612 |
-
|
613 |
-
if ( $footer_template->have_posts() ) {
|
614 |
-
$footer_template_ID = $footer_template->post->ID;
|
615 |
-
$footer_template_shortcode = apply_filters('the_content', get_post_field('post_content', $footer_template_ID));
|
616 |
-
$footer_template_css = get_post_custom($footer_template_ID);
|
617 |
-
|
618 |
-
if ( $footer_template_css['dsm-css-classes-meta-box-options'][0] != '' ) {
|
619 |
-
$footer_template_css_output = get_post_meta( $footer_css_template->post->ID, 'dsm-css-classes-meta-box-options', true );
|
620 |
-
} else {
|
621 |
-
$footer_template_css_output = '';
|
622 |
-
}
|
623 |
-
|
624 |
-
if ( !et_core_is_fb_enabled() ) {
|
625 |
-
$footer_output = sprintf(
|
626 |
-
'<footer id="dsm-footer" class="dsm-footer" itemscope="itemscope" itemtype="https://schema.org/WPFooter">%1$s</footer>
|
627 |
-
',
|
628 |
-
$footer_template_shortcode
|
629 |
-
);
|
630 |
-
echo $footer_output;
|
631 |
-
}
|
632 |
-
}
|
633 |
-
}
|
634 |
-
|
635 |
-
add_action('et_after_main_content', 'dsm_custom_footer');
|
636 |
-
|
637 |
-
if ( ! function_exists( 'dsm_redirect_404' ) ) :
|
638 |
-
function dsm_redirect_404() {
|
639 |
-
$dsm_four_zero_four_args = array(
|
640 |
-
'post_type' => 'dsm_header_footer',
|
641 |
-
'meta_key' => 'dsm-header-footer-meta-box-options',
|
642 |
-
'meta_value' => '404',
|
643 |
-
'meta_type' => 'post',
|
644 |
-
'meta_query' => array(
|
645 |
-
array(
|
646 |
-
'key' => 'dsm-header-footer-meta-box-options',
|
647 |
-
'value' => '404',
|
648 |
-
'compare' => '==',
|
649 |
-
'type' => 'post',
|
650 |
-
),
|
651 |
-
),
|
652 |
-
);
|
653 |
-
|
654 |
-
$dsm_four_zero_four_template = new WP_Query(
|
655 |
-
$dsm_four_zero_four_args
|
656 |
-
);
|
657 |
-
|
658 |
-
if ( $dsm_four_zero_four_template->have_posts() ) {
|
659 |
-
if ( is_404() ) :
|
660 |
-
include( plugin_dir_path( __FILE__ ) . 'templates/page-template-404.php' );
|
661 |
-
exit;
|
662 |
-
endif;
|
663 |
-
}
|
664 |
-
}
|
665 |
-
endif;
|
666 |
-
|
667 |
-
add_action( 'template_redirect', 'dsm_redirect_404' );
|
668 |
-
|
669 |
-
function dsm_custom_footer_settings() {
|
670 |
-
$footer_args = array(
|
671 |
-
'post_type' => 'dsm_header_footer',
|
672 |
-
'meta_key' => 'dsm-header-footer-meta-box-options',
|
673 |
-
'meta_value' => 'footer',
|
674 |
-
'meta_type' => 'post',
|
675 |
-
'meta_query' => array(
|
676 |
-
array(
|
677 |
-
'key' => 'dsm-header-footer-meta-box-options',
|
678 |
-
'value' => 'footer',
|
679 |
-
'compare' => '==',
|
680 |
-
'type' => 'post',
|
681 |
-
),
|
682 |
-
),
|
683 |
-
);
|
684 |
-
|
685 |
-
$footer_template = new WP_Query(
|
686 |
-
$footer_args
|
687 |
-
);
|
688 |
-
|
689 |
-
if ( $footer_template->have_posts() ) {
|
690 |
-
$footer_template_ID = $footer_template->post->ID;
|
691 |
-
$footer_template_css = get_post_custom($footer_template_ID);
|
692 |
-
|
693 |
-
if ( $footer_template_css['dsm-remove-default-footer-meta-box-options'][0] == 'yes' ) {
|
694 |
-
echo '<style id="dsm-footer-css" type="text/css">footer#main-footer { display: none; }</style>';
|
695 |
-
}
|
696 |
-
}
|
697 |
-
}
|
698 |
-
|
699 |
-
add_action( 'wp_print_scripts', 'dsm_custom_footer_settings', 30 );
|
700 |
-
|
701 |
-
/*
|
702 |
-
function dsm_embed_footer_vb() {
|
703 |
-
$show_footer_args = array(
|
704 |
-
'post_type' => 'dsm_header_footer',
|
705 |
-
'meta_key' => 'dsm-embed-footer-in-vb',
|
706 |
-
'meta_value' => 'yes',
|
707 |
-
'meta_type' => 'post',
|
708 |
-
'meta_query' => array(
|
709 |
-
array(
|
710 |
-
'key' => 'dsm-embed-footer-in-vb',
|
711 |
-
'value' => 'yes',
|
712 |
-
'compare' => '==',
|
713 |
-
'type' => 'post',
|
714 |
-
),
|
715 |
-
),
|
716 |
-
);
|
717 |
-
|
718 |
-
$show_footer_template = new WP_Query(
|
719 |
-
$show_footer_args
|
720 |
-
);
|
721 |
-
|
722 |
-
if ( $show_footer_template->have_posts() ) {
|
723 |
-
$footer_template_ID = $show_footer_template->post->ID;
|
724 |
-
$footer_template_vb = get_post_custom($footer_template_ID);
|
725 |
-
|
726 |
-
if ( $footer_template_vb['dsm-embed-footer-in-vb'][0] == 'yes' ) {
|
727 |
-
if ( et_core_is_fb_enabled() ) {
|
728 |
-
if ( 'dsm_header_footer' !== get_post_type( get_the_ID() ) ) {
|
729 |
-
wp_enqueue_script('dsm-header-footer');
|
730 |
-
}
|
731 |
-
}
|
732 |
-
}
|
733 |
-
}
|
734 |
-
}
|
735 |
-
add_action( 'et_after_main_content', 'dsm_embed_footer_vb' );
|
736 |
-
*/
|
737 |
-
|
738 |
-
function dsm_header_footer_admin_notice($post) {
|
739 |
-
$current_screen = get_current_screen();
|
740 |
-
|
741 |
-
if ( $current_screen->post_type === 'dsm_header_footer' ) { ?>
|
742 |
-
<div class="notice notice-info">
|
743 |
-
<p><?php _e( 'Notice: For first time user, please re-save your <a href="'. get_admin_url() .'options-permalink.php" target="_blank">Permalinks</a> again to flush the rewrite rules in order view them in Visual Builder. This will only work for the Divi Theme. Once ElegantThemes updated their Template Hook on Extra Theme, this feature will also be available. Currently only the footer and 404 template is available you. Please create one template and assign to the footer or 404. If you do not see Divi Builder here, remember to <a href="'. get_admin_url() .'admin.php?page=et_divi_options#wrap-builder" target="_blank">Enable Divi Builder On Post Types</a> in the Divi Options.', 'dsm-supreme-modules-for-divi' ); ?></p>
|
744 |
-
</div>
|
745 |
-
<?php }
|
746 |
-
}
|
747 |
-
add_action('admin_notices', 'dsm_header_footer_admin_notice');
|
748 |
-
|
749 |
-
//Template load admin script
|
750 |
-
if ( ! function_exists( 'dsm_admin_load_enqueue' ) ) :
|
751 |
-
function dsm_admin_load_enqueue( $hook_suffix ){
|
752 |
-
if( in_array($hook_suffix, array('post.php', 'post-new.php') ) ){
|
753 |
-
$screen = get_current_screen();
|
754 |
-
|
755 |
-
if( is_object( $screen ) && 'dsm_header_footer' == $screen->post_type ){
|
756 |
-
wp_enqueue_script( 'dsm-admin-js', plugins_url( 'includes/admin/js/dsm-admin.js' , dirname(__FILE__) ) );
|
757 |
-
}
|
758 |
-
}
|
759 |
-
}
|
760 |
-
endif;
|
761 |
-
add_action( 'admin_enqueue_scripts', 'dsm_admin_load_enqueue');
|
762 |
-
}
|
763 |
-
|
764 |
-
if ( dsm_setting_get_option( 'dsm_use_shortcode', 'dsm_general' ) == 'on' ) {
|
765 |
-
if ( ! function_exists( 'dsm_divi_shortcode' ) ) :
|
766 |
-
function dsm_divi_shortcode($divi_shortcode = []) {
|
767 |
-
if ( empty( $divi_shortcode['id'] ) ) {
|
768 |
-
return '';
|
769 |
-
}
|
770 |
-
return do_shortcode('[et_pb_section global_module="'.$divi_shortcode['id'].'"][/et_pb_section]');
|
771 |
-
}
|
772 |
-
endif;
|
773 |
-
add_shortcode(DSM_SHORTCODE, 'dsm_divi_shortcode');
|
774 |
-
|
775 |
-
if ( ! function_exists( 'dsm_divi_shortcode_post_columns_header' ) ) :
|
776 |
-
function dsm_divi_shortcode_post_columns_header($columns) {
|
777 |
-
$columns['shortcode'] = __( 'Shortcode', 'dsm-supreme-modules-for-divi' );
|
778 |
-
return $columns;
|
779 |
-
}
|
780 |
-
endif;
|
781 |
-
add_filter('manage_edit-et_pb_layout_columns', 'dsm_divi_shortcode_post_columns_header');
|
782 |
-
|
783 |
-
if ( ! function_exists( 'dsm_divi_shortcode_post_columns_content' ) ) :
|
784 |
-
function dsm_divi_shortcode_post_columns_content($column_name) {
|
785 |
-
global $post;
|
786 |
-
switch ($column_name) {
|
787 |
-
case 'shortcode':
|
788 |
-
$shortcode = esc_attr( sprintf( '[%s id="%d"]', DSM_SHORTCODE, $post->ID ) );
|
789 |
-
printf( '<input class="dsm-shortcode-input" type="text" readonly onfocus="this.select()" value="%s" style="width:100%%" />', $shortcode );
|
790 |
-
break;
|
791 |
-
}
|
792 |
-
}
|
793 |
-
endif;
|
794 |
-
add_action('manage_et_pb_layout_posts_custom_column', 'dsm_divi_shortcode_post_columns_content');
|
795 |
-
}
|
796 |
-
//End
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/*Temporary fix*/
|
3 |
if ( ! function_exists( 'et_core_is_fb_enabled' ) ):
|
4 |
function et_core_is_fb_enabled() {
|
23 |
) );
|
24 |
}
|
25 |
endif;
|
26 |
+
/*End of Temporary fix*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-dsm-supreme-modules-for-divi-activator.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin activation
|
5 |
+
*
|
6 |
+
* @link https://suprememodules.com/about-us/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
10 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin activation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's activation.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
20 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
21 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
22 |
+
*/
|
23 |
+
class Dsm_Supreme_Modules_For_Divi_Activator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
public static function activate() {
|
36 |
+
flush_rewrite_rules();
|
37 |
+
if ( ! get_option( 'dsm_flush_rewrite_rules_flag' ) ) {
|
38 |
+
add_option( 'dsm_flush_rewrite_rules_flag', true );
|
39 |
+
}
|
40 |
+
|
41 |
+
Dsm_Supreme_Modules_For_Divi_Review::insert_install_date();
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
includes/class-dsm-supreme-modules-for-divi-deactivator.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin deactivation
|
5 |
+
*
|
6 |
+
* @link https://suprememodules.com/about-us/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
10 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin deactivation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's deactivation.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
20 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
21 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
22 |
+
*/
|
23 |
+
class Dsm_Supreme_Modules_For_Divi_Deactivator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
public static function deactivate() {
|
33 |
+
delete_site_option( 'dsm-supreme-modules-for-divi-no-bug' );
|
34 |
+
delete_site_option( 'dsm-supreme-modules-for-divi-activation-date' );
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
includes/class-dsm-supreme-modules-for-divi-i18n.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Define the internationalization functionality
|
5 |
+
*
|
6 |
+
* Loads and defines the internationalization files for this plugin
|
7 |
+
* so that it is ready for translation.
|
8 |
+
*
|
9 |
+
* @link https://suprememodules.com/about-us/
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
13 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Define the internationalization functionality.
|
18 |
+
*
|
19 |
+
* Loads and defines the internationalization files for this plugin
|
20 |
+
* so that it is ready for translation.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
24 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
25 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
26 |
+
*/
|
27 |
+
class Dsm_Supreme_Modules_For_Divi_i18n {
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Load the plugin text domain for translation.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*/
|
35 |
+
public function load_plugin_textdomain() {
|
36 |
+
|
37 |
+
load_plugin_textdomain(
|
38 |
+
'dsm-supreme-modules-for-divi',
|
39 |
+
false,
|
40 |
+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
41 |
+
);
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
}
|
includes/class-dsm-supreme-modules-for-divi-loader.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all actions and filters for the plugin
|
5 |
+
*
|
6 |
+
* @link https://suprememodules.com/about-us/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
10 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register all actions and filters for the plugin.
|
15 |
+
*
|
16 |
+
* Maintain a list of all hooks that are registered throughout
|
17 |
+
* the plugin, and register them with the WordPress API. Call the
|
18 |
+
* run function to execute the list of actions and filters.
|
19 |
+
*
|
20 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
21 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
22 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
23 |
+
*/
|
24 |
+
class Dsm_Supreme_Modules_For_Divi_Loader {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The array of actions registered with WordPress.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @access protected
|
31 |
+
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
32 |
+
*/
|
33 |
+
protected $actions;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of filters registered with WordPress.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @access protected
|
40 |
+
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
41 |
+
*/
|
42 |
+
protected $filters;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize the collections used to maintain the actions and filters.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
*/
|
49 |
+
public function __construct() {
|
50 |
+
|
51 |
+
$this->actions = array();
|
52 |
+
$this->filters = array();
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add a new action to the collection to be registered with WordPress.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @param string $hook The name of the WordPress action that is being registered.
|
61 |
+
* @param object $component A reference to the instance of the object on which the action is defined.
|
62 |
+
* @param string $callback The name of the function definition on the $component.
|
63 |
+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
64 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
65 |
+
*/
|
66 |
+
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
67 |
+
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add a new filter to the collection to be registered with WordPress.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
75 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
76 |
+
* @param string $callback The name of the function definition on the $component.
|
77 |
+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
78 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
79 |
+
*/
|
80 |
+
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
81 |
+
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* A utility function that is used to register the actions and hooks into a single
|
86 |
+
* collection.
|
87 |
+
*
|
88 |
+
* @since 1.0.0
|
89 |
+
* @access private
|
90 |
+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
91 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
92 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
93 |
+
* @param string $callback The name of the function definition on the $component.
|
94 |
+
* @param int $priority The priority at which the function should be fired.
|
95 |
+
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
96 |
+
* @return array The collection of actions and filters registered with WordPress.
|
97 |
+
*/
|
98 |
+
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
99 |
+
|
100 |
+
$hooks[] = array(
|
101 |
+
'hook' => $hook,
|
102 |
+
'component' => $component,
|
103 |
+
'callback' => $callback,
|
104 |
+
'priority' => $priority,
|
105 |
+
'accepted_args' => $accepted_args
|
106 |
+
);
|
107 |
+
|
108 |
+
return $hooks;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Register the filters and actions with WordPress.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
*/
|
117 |
+
public function run() {
|
118 |
+
|
119 |
+
foreach ( $this->filters as $hook ) {
|
120 |
+
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
121 |
+
}
|
122 |
+
|
123 |
+
foreach ( $this->actions as $hook ) {
|
124 |
+
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
includes/class-dsm-supreme-modules-for-divi-review.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the core plugin class
|
5 |
+
*
|
6 |
+
* A class definition that includes attributes and functions used across both the
|
7 |
+
* public-facing side of the site and the admin area.
|
8 |
+
*
|
9 |
+
* @link https://suprememodules.com/about-us/
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
13 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The core plugin class.
|
18 |
+
*
|
19 |
+
* This is used to define internationalization, admin-specific hooks, and
|
20 |
+
* public-facing site hooks.
|
21 |
+
*
|
22 |
+
* Also maintains the unique identifier of this plugin as well as the current
|
23 |
+
* version of the plugin.
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
27 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
28 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
29 |
+
*/
|
30 |
+
if ( ! class_exists( 'Dsm_Supreme_Modules_For_Divi_Review' ) ) :
|
31 |
+
class Dsm_Supreme_Modules_For_Divi_Review {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Private variables.
|
35 |
+
*
|
36 |
+
* These should be customised for each project.
|
37 |
+
*/
|
38 |
+
private $slug; // The plugin slug
|
39 |
+
private $name; // The plugin name
|
40 |
+
private $time_limit; // The time limit at which notice is shown
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Variables.
|
44 |
+
*/
|
45 |
+
public $nobug_option;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Fire the constructor up :)
|
49 |
+
*/
|
50 |
+
public function __construct( $args ) {
|
51 |
+
$this->slug = $args['slug'];
|
52 |
+
$this->name = $args['name'];
|
53 |
+
if ( isset( $args['time_limit'] ) ) {
|
54 |
+
$this->time_limit = $args['time_limit'];
|
55 |
+
} else {
|
56 |
+
$this->time_limit = WEEK_IN_SECONDS;
|
57 |
+
}
|
58 |
+
$this->nobug_option = $this->slug . '-no-bug';
|
59 |
+
// Loading main functionality
|
60 |
+
add_action( 'admin_init', array( $this, 'check_installation_date' ) );
|
61 |
+
add_action( 'admin_init', array( $this, 'set_no_bug' ), 5 );
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* Seconds to words.
|
65 |
+
*/
|
66 |
+
public function seconds_to_words( $seconds ) {
|
67 |
+
// Get the years
|
68 |
+
$years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
|
69 |
+
if ( $years > 1 ) {
|
70 |
+
return sprintf( __( '%s years', $this->slug ), $years );
|
71 |
+
} elseif ( $years > 0) {
|
72 |
+
return __( 'a year', $this->slug );
|
73 |
+
}
|
74 |
+
// Get the weeks
|
75 |
+
$weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
|
76 |
+
if ( $weeks > 1 ) {
|
77 |
+
return sprintf( __( '%s weeks', $this->slug ), $weeks );
|
78 |
+
} elseif ( $weeks > 0) {
|
79 |
+
return __( 'a week', $this->slug );
|
80 |
+
}
|
81 |
+
// Get the days
|
82 |
+
$days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
|
83 |
+
if ( $days > 1 ) {
|
84 |
+
return sprintf( __( '%s days', $this->slug ), $days );
|
85 |
+
} elseif ( $days > 0) {
|
86 |
+
return __( 'a day', $this->slug );
|
87 |
+
}
|
88 |
+
// Get the hours
|
89 |
+
$hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24;
|
90 |
+
if ( $hours > 1 ) {
|
91 |
+
return sprintf( __( '%s hours', $this->slug ), $hours );
|
92 |
+
} elseif ( $hours > 0) {
|
93 |
+
return __( 'an hour', $this->slug );
|
94 |
+
}
|
95 |
+
// Get the minutes
|
96 |
+
$minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60;
|
97 |
+
if ( $minutes > 1 ) {
|
98 |
+
return sprintf( __( '%s minutes', $this->slug ), $minutes );
|
99 |
+
} elseif ( $minutes > 0) {
|
100 |
+
return __( 'a minute', $this->slug );
|
101 |
+
}
|
102 |
+
// Get the seconds
|
103 |
+
$seconds = intval( $seconds ) % 60;
|
104 |
+
if ( $seconds > 1 ) {
|
105 |
+
return sprintf( __( '%s seconds', $this->slug ), $seconds );
|
106 |
+
} elseif ( $seconds > 0) {
|
107 |
+
return __( 'a second', $this->slug );
|
108 |
+
}
|
109 |
+
return;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Insert the install date
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public static function insert_install_date() {
|
118 |
+
add_site_option( 'dsm-supreme-modules-for-divi-activation-date', time() );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Check date on admin initiation and add to admin notice if it was more than the time limit.
|
123 |
+
*/
|
124 |
+
public function check_installation_date() {
|
125 |
+
if ( true != get_site_option( $this->nobug_option ) ) {
|
126 |
+
// If not installation date set, then add it
|
127 |
+
$install_date = get_site_option( $this->slug . '-activation-date' );
|
128 |
+
if ( '' == $install_date ) {
|
129 |
+
add_site_option( $this->slug . '-activation-date', time() );
|
130 |
+
}
|
131 |
+
// If difference between install date and now is greater than time limit, then display notice
|
132 |
+
if ( ( time() - $install_date ) >= $this->time_limit ) {
|
133 |
+
add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Display Admin Notice, asking for a review.
|
140 |
+
*/
|
141 |
+
public function display_admin_notice() {
|
142 |
+
|
143 |
+
$screen = get_current_screen();
|
144 |
+
if ( isset( $screen->base ) && 'plugins' == $screen->base ) {
|
145 |
+
|
146 |
+
$no_bug_url = wp_nonce_url( admin_url( '?' . $this->nobug_option . '=true' ), 'review-nonce' );
|
147 |
+
$time = $this->seconds_to_words( time() - get_site_option( $this->slug . '-activation-date' ) );
|
148 |
+
|
149 |
+
echo '
|
150 |
+
<div class="updated">
|
151 |
+
<p>' . sprintf( __( 'You have been using the %s plugin for %s now, do you like it? If so, please do us a favor by leaving us a 5-stars rating with your feedback on WordPress.org. A huge thanks in advance!<div class="dsm-admin-go-pro" style="display: flex; align-items: center; padding-top: 10px;"><a onclick="location.href=\'' . esc_url( $no_bug_url ) . '\';" class="button button-primary" href="' . esc_url( 'https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post' ) . '" target="_blank">' . __( 'Leave A Review', 'dsm-supreme-modules-for-divi' ) . '</a><span style="padding-left: 7px;">or</span><span class="dashicons dashicons-cart" style="font-size: 1.4em;padding-left: 7px; padding-right: 3px;"></span><a href="https://divisupreme.com/?coupon=SUPREMEJOURNEYTOPRO10" target="_blank">Get Divi Supreme Pro</a> with 10%% off applied automatically to your cart.</div>', 'dsm-supreme-modules-for-divi' ), $this->name, $time ) . '
|
152 |
+
<br />
|
153 |
+
<a href="' . esc_url( $no_bug_url ) . '">' . __( 'No thanks.', 'dsm-supreme-modules-for-divi' ) . '</a>
|
154 |
+
</p>
|
155 |
+
</div>';
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Set the plugin to no longer bug users if user asks not to be.
|
163 |
+
*/
|
164 |
+
public function set_no_bug() {
|
165 |
+
|
166 |
+
// Bail out if not on correct page
|
167 |
+
if (
|
168 |
+
! isset( $_GET['_wpnonce'] )
|
169 |
+
||
|
170 |
+
(
|
171 |
+
! wp_verify_nonce( $_GET['_wpnonce'], 'review-nonce' )
|
172 |
+
||
|
173 |
+
! is_admin()
|
174 |
+
||
|
175 |
+
! isset( $_GET[$this->nobug_option] )
|
176 |
+
||
|
177 |
+
! current_user_can( 'manage_options' )
|
178 |
+
)
|
179 |
+
) {
|
180 |
+
return;
|
181 |
+
}
|
182 |
+
|
183 |
+
add_site_option( $this->nobug_option, true );
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
endif;
|
includes/class-dsm-supreme-modules-for-divi.php
ADDED
@@ -0,0 +1,992 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
3 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
4 |
+
}
|
5 |
+
/**
|
6 |
+
* The file that defines the core plugin class
|
7 |
+
*
|
8 |
+
* A class definition that includes attributes and functions used across both the
|
9 |
+
* public-facing side of the site and the admin area.
|
10 |
+
*
|
11 |
+
* @link https://suprememodules.com/about-us/
|
12 |
+
* @since 1.0.0
|
13 |
+
*
|
14 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
15 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The core plugin class.
|
20 |
+
*
|
21 |
+
* This is used to define internationalization, admin-specific hooks, and
|
22 |
+
* public-facing site hooks.
|
23 |
+
*
|
24 |
+
* Also maintains the unique identifier of this plugin as well as the current
|
25 |
+
* version of the plugin.
|
26 |
+
*
|
27 |
+
* @since 1.0.0
|
28 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
29 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/includes
|
30 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
31 |
+
*/
|
32 |
+
class Dsm_Supreme_Modules_For_Divi {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The loader that's responsible for maintaining and registering all hooks that power
|
36 |
+
* the plugin.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @access protected
|
40 |
+
* @var Dsm_Supreme_Modules_For_Divi_Loader $loader Maintains and registers all hooks for the plugin.
|
41 |
+
*/
|
42 |
+
protected $loader;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The unique identifier of this plugin.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @access protected
|
49 |
+
* @var string $plugin_name The string used to uniquely identify this plugin.
|
50 |
+
*/
|
51 |
+
protected $plugin_name;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The current version of the plugin.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
* @access protected
|
58 |
+
* @var string $version The current version of the plugin.
|
59 |
+
*/
|
60 |
+
protected $version;
|
61 |
+
|
62 |
+
private $settings_api;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Define the core functionality of the plugin.
|
66 |
+
*
|
67 |
+
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
68 |
+
* Load the dependencies, define the locale, and set the hooks for the admin area and
|
69 |
+
* the public-facing side of the site.
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
*/
|
73 |
+
public function __construct() {
|
74 |
+
if ( defined( 'DSM_VERSION' ) ) {
|
75 |
+
$this->version = DSM_VERSION;
|
76 |
+
} else {
|
77 |
+
$this->version = '1.0.0';
|
78 |
+
}
|
79 |
+
$this->plugin_name = 'dsm-supreme-modules-for-divi';
|
80 |
+
|
81 |
+
$this->load_dependencies();
|
82 |
+
$this->set_locale();
|
83 |
+
$this->define_admin_hooks();
|
84 |
+
$this->define_public_hooks();
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Load the required dependencies for this plugin.
|
90 |
+
*
|
91 |
+
* Include the following files that make up the plugin:
|
92 |
+
*
|
93 |
+
* - Dsm_Supreme_Modules_For_Divi_Loader. Orchestrates the hooks of the plugin.
|
94 |
+
* - Dsm_Supreme_Modules_For_Divi_i18n. Defines internationalization functionality.
|
95 |
+
* - Dsm_Supreme_Modules_For_Divi_Admin. Defines all hooks for the admin area.
|
96 |
+
* - Dsm_Supreme_Modules_For_Divi_Public. Defines all hooks for the public side of the site.
|
97 |
+
*
|
98 |
+
* Create an instance of the loader which will be used to register the hooks
|
99 |
+
* with WordPress.
|
100 |
+
*
|
101 |
+
* @since 1.0.0
|
102 |
+
* @access private
|
103 |
+
*/
|
104 |
+
private function load_dependencies() {
|
105 |
+
|
106 |
+
/**
|
107 |
+
* The class responsible for orchestrating the actions and filters of the
|
108 |
+
* core plugin.
|
109 |
+
*/
|
110 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-dsm-supreme-modules-for-divi-loader.php';
|
111 |
+
|
112 |
+
/**
|
113 |
+
* The class responsible for defining internationalization functionality
|
114 |
+
* of the plugin.
|
115 |
+
*/
|
116 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-dsm-supreme-modules-for-divi-i18n.php';
|
117 |
+
|
118 |
+
/**
|
119 |
+
* The class responsible for defining all actions that occur in the admin area.
|
120 |
+
*/
|
121 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-dsm-supreme-modules-for-divi-admin.php';
|
122 |
+
|
123 |
+
/**
|
124 |
+
* The class responsible for defining all actions that occur in the public-facing
|
125 |
+
* side of the site.
|
126 |
+
*/
|
127 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-dsm-supreme-modules-for-divi-public.php';
|
128 |
+
|
129 |
+
/**
|
130 |
+
* The class responsible for defining all actions that occur in Divi Supreme
|
131 |
+
* side of the site.
|
132 |
+
*/
|
133 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class.settings-api.php';
|
134 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class.page-settings.php';
|
135 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-dsm-supreme-modules-for-divi-review.php';
|
136 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/SupremeModulesLoader.php';
|
137 |
+
|
138 |
+
$this->loader = new Dsm_Supreme_Modules_For_Divi_Loader();
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Define the locale for this plugin for internationalization.
|
144 |
+
*
|
145 |
+
* Uses the Dsm_Supreme_Modules_For_Divi_i18n class in order to set the domain and to register the hook
|
146 |
+
* with WordPress.
|
147 |
+
*
|
148 |
+
* @since 1.0.0
|
149 |
+
* @access private
|
150 |
+
*/
|
151 |
+
private function set_locale() {
|
152 |
+
|
153 |
+
$plugin_i18n = new Dsm_Supreme_Modules_For_Divi_i18n();
|
154 |
+
|
155 |
+
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Register all of the hooks related to the admin area functionality
|
161 |
+
* of the plugin.
|
162 |
+
*
|
163 |
+
* @since 1.0.0
|
164 |
+
* @access private
|
165 |
+
*/
|
166 |
+
private function define_admin_hooks() {
|
167 |
+
|
168 |
+
$plugin_admin = new Dsm_Supreme_Modules_For_Divi_Admin( $this->get_plugin_name(), $this->get_version() );
|
169 |
+
|
170 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
171 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
|
172 |
+
|
173 |
+
//Load page settings
|
174 |
+
$this->settings_api = new DSM_Settings_API;
|
175 |
+
|
176 |
+
add_action( 'divi_extensions_init', array( $this, 'dsm_initialize_extension' ) );
|
177 |
+
//Plugin Admin
|
178 |
+
add_filter( 'admin_footer_text', array( $this, 'dsm_admin_footer_text' ) );
|
179 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'dsm_admin_load_enqueue' ) );
|
180 |
+
new Dsm_Supreme_Modules_For_Divi_Review( array(
|
181 |
+
'slug' => $this->get_plugin_name(),
|
182 |
+
'name' => 'Divi Supreme Pro',
|
183 |
+
'time_limit' => intval('864000'),
|
184 |
+
) );
|
185 |
+
|
186 |
+
//Plugin links
|
187 |
+
add_filter( 'plugin_action_links_supreme-modules-for-divi/supreme-modules-for-divi.php', array( $this, 'dsm_plugin_action_links' ), 10, 5 );
|
188 |
+
add_filter( 'plugin_action_links', array( $this, 'dsm_add_action_plugin' ), 10, 5 );
|
189 |
+
add_filter( 'plugin_row_meta', array( $this, 'dsm_plugin_row_meta' ), 10, 2 );
|
190 |
+
|
191 |
+
//Divi Template
|
192 |
+
add_action( 'init', array( $this, 'dsm_flush_rewrite_rules' ), 20 );
|
193 |
+
if ( $this->settings_api->get_option( 'dsm_use_header_footer', 'dsm_general' ) == 'on' ) {
|
194 |
+
add_action( 'init', array( $this, 'dsm_header_footer_posttypes' ), 0 );
|
195 |
+
add_filter( 'single_template', array( $this, 'dsm_load_headerfooter_template' ) );
|
196 |
+
add_action( 'add_meta_boxes', array( $this, 'dsm_add_header_footer_meta_box' ), 11 );
|
197 |
+
add_action( 'save_post', array( $this, 'dsm_save_header_footer_meta_box' ), 10, 3 );
|
198 |
+
add_action( 'et_after_main_content', array( $this, 'dsm_custom_footer' ) );
|
199 |
+
add_action( 'template_redirect', array( $this, 'dsm_redirect_404' ) );
|
200 |
+
add_action( 'wp_print_scripts', array( $this, 'dsm_custom_footer_settings' ), 30 );
|
201 |
+
add_action( 'admin_notices', array( $this, 'dsm_header_footer_admin_notice' ) );
|
202 |
+
}
|
203 |
+
|
204 |
+
//Scheduled content
|
205 |
+
if ( $this->settings_api->get_option( 'dsm_use_scheduled_content', 'dsm_general' ) == 'on' ) {
|
206 |
+
add_filter( 'et_pb_all_fields_unprocessed_et_pb_section', array( $this, 'dsm_add_section_setting' ) );
|
207 |
+
add_filter( 'et_module_shortcode_output', array( $this, 'output_section' ), 10, 3 );
|
208 |
+
add_filter( 'et_pb_all_fields_unprocessed_et_pb_row', array( $this, 'dsm_add_row_setting' ) );
|
209 |
+
add_filter( 'et_module_shortcode_output', array( $this, 'output_row' ), 10, 3 );
|
210 |
+
}
|
211 |
+
|
212 |
+
//Divi shortcode
|
213 |
+
if ( $this->settings_api->get_option( 'dsm_use_shortcode', 'dsm_general' ) == 'on' ) {
|
214 |
+
add_shortcode( DSM_SHORTCODE, array( $this, 'dsm_divi_shortcode' ) );
|
215 |
+
add_filter('manage_edit-et_pb_layout_columns', array( $this, 'dsm_divi_shortcode_post_columns_header' ) );
|
216 |
+
add_action('manage_et_pb_layout_posts_custom_column', array( $this, 'dsm_divi_shortcode_post_columns_content' ) );
|
217 |
+
}
|
218 |
+
|
219 |
+
//ContactForm7
|
220 |
+
if ( class_exists( 'WPCF7' ) ) {
|
221 |
+
add_filter( 'et_builder_load_actions', array( $this, 'dsm_et_builder_load_cf7' ) );
|
222 |
+
add_action( 'wp_ajax_nopriv_dsm_load_cf7_library', array( $this, 'dsm_load_cf7_library' ) );
|
223 |
+
add_action( 'wp_ajax_dsm_load_cf7_library', array( $this, 'dsm_load_cf7_library' ) );
|
224 |
+
remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit', 20 );
|
225 |
+
add_action( 'wpcf7_init', array( $this, 'dsm_wpcf7_add_form_tag_submit' ) );
|
226 |
+
remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_select', 20 );
|
227 |
+
add_action( 'wpcf7_init', array( $this, 'dsm_wpcf7_add_form_tag_select' ) );
|
228 |
+
}
|
229 |
+
|
230 |
+
//Caldera
|
231 |
+
if ( class_exists( 'Caldera_Forms' ) ) {
|
232 |
+
add_filter( 'et_builder_load_actions', array( $this, 'dsm_et_builder_load_caldera_forms' ) );
|
233 |
+
add_action( 'wp_ajax_nopriv_dsm_load_caldera_forms', array( $this, 'dsm_load_caldera_forms' ) );
|
234 |
+
add_action( 'wp_ajax_dsm_load_caldera_forms', array( $this, 'dsm_load_caldera_forms' ) );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Register all of the hooks related to the public-facing functionality
|
240 |
+
* of the plugin.
|
241 |
+
*
|
242 |
+
* @since 1.0.0
|
243 |
+
* @access private
|
244 |
+
*/
|
245 |
+
private function define_public_hooks() {
|
246 |
+
|
247 |
+
$plugin_public = new Dsm_Supreme_Modules_For_Divi_Public( $this->get_plugin_name(), $this->get_version() );
|
248 |
+
|
249 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
250 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
|
251 |
+
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Run the loader to execute all of the hooks with WordPress.
|
256 |
+
*
|
257 |
+
* @since 1.0.0
|
258 |
+
*/
|
259 |
+
public function run() {
|
260 |
+
$this->loader->run();
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* The name of the plugin used to uniquely identify it within the context of
|
265 |
+
* WordPress and to define internationalization functionality.
|
266 |
+
*
|
267 |
+
* @since 1.0.0
|
268 |
+
* @return string The name of the plugin.
|
269 |
+
*/
|
270 |
+
public function get_plugin_name() {
|
271 |
+
return $this->plugin_name;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* The reference to the class that orchestrates the hooks with the plugin.
|
276 |
+
*
|
277 |
+
* @since 1.0.0
|
278 |
+
* @return Dsm_Supreme_Modules_For_Divi_Loader Orchestrates the hooks of the plugin.
|
279 |
+
*/
|
280 |
+
public function get_loader() {
|
281 |
+
return $this->loader;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Retrieve the version number of the plugin.
|
286 |
+
*
|
287 |
+
* @since 1.0.0
|
288 |
+
* @return string The version number of the plugin.
|
289 |
+
*/
|
290 |
+
public function get_version() {
|
291 |
+
return $this->version;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Creates the extension's main class instance.
|
296 |
+
*
|
297 |
+
* @since 1.0.0
|
298 |
+
*/
|
299 |
+
public function dsm_initialize_extension() {
|
300 |
+
//require_once plugin_dir_path( __FILE__ ) . 'includes/SupremeModulesForDivi.php';
|
301 |
+
require_once plugin_dir_path( __FILE__ ) . 'SupremeModulesForDivi.php';
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Flush Rules for Divi Template.
|
306 |
+
*
|
307 |
+
* @since 1.0.0
|
308 |
+
*/
|
309 |
+
public function dsm_flush_rewrite_rules() {
|
310 |
+
if ( get_option( 'dsm_flush_rewrite_rules_flag' ) ) {
|
311 |
+
flush_rewrite_rules();
|
312 |
+
delete_option( 'dsm_flush_rewrite_rules_flag' );
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Creates the plugin action links.
|
318 |
+
*
|
319 |
+
* @since 1.0.0
|
320 |
+
*/
|
321 |
+
public function dsm_plugin_action_links( $links ) {
|
322 |
+
$dsm_go_pro = sprintf(
|
323 |
+
__( '<a href="' . esc_url( 'https://divisupreme.com/features/' ) . '"" target="_blank" class="dsm-plugin-gopro">%1$s</a>', 'dsm-supreme-modules-for-divi' ),
|
324 |
+
sprintf( '%s', esc_html__( 'Go Pro', 'dsm-supreme-modules-for-divi' ) )
|
325 |
+
);
|
326 |
+
|
327 |
+
$links[] = $dsm_go_pro;
|
328 |
+
return $links;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Creates the plugin action links.
|
333 |
+
*
|
334 |
+
* @since 1.0.0
|
335 |
+
*/
|
336 |
+
public function dsm_add_action_plugin( $actions, $plugin_file ) {
|
337 |
+
static $plugin;
|
338 |
+
if (!isset($plugin))
|
339 |
+
$plugin = 'supreme-modules-for-divi/supreme-modules-for-divi.php';
|
340 |
+
|
341 |
+
if ( $plugin == $plugin_file ) {
|
342 |
+
$settings = array('settings' => '<a href="'. esc_url( get_admin_url(null, 'options-general.php?page=divi_supreme_settings') ) .'">' . __('Settings', 'dsm-supreme-modules-for-divi') . '</a>');
|
343 |
+
|
344 |
+
$actions = array_merge($settings, $actions);
|
345 |
+
|
346 |
+
}
|
347 |
+
return $actions;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Creates the plugin action links.
|
352 |
+
*
|
353 |
+
* @since 1.0.0
|
354 |
+
*/
|
355 |
+
public function dsm_plugin_row_meta( $links, $file ) {
|
356 |
+
if ( 'supreme-modules-for-divi/supreme-modules-for-divi.php' == $file ) {
|
357 |
+
$row_meta = array(
|
358 |
+
'docs' => '<a href="' . esc_url( 'https://docs.divisupreme.com/' ) . '" target="_blank" aria-label="' . esc_attr__( 'Divi Supreme Documentation', 'dsm-supreme-modules-for-divi' ) . '">' . esc_html__( 'Documentation', 'dsm-supreme-modules-for-divi' ) . '</a>',
|
359 |
+
'support' => '<a href="' . esc_url( 'https://divisupreme.com/contact/' ) . '" target="_blank" aria-label="' . esc_attr__( 'Get Support', 'dsm-supreme-modules-for-divi' ) . '">' . esc_html__( 'Get Support', 'dsm-supreme-modules-for-divi' ) . '</a>'
|
360 |
+
);
|
361 |
+
|
362 |
+
return array_merge( $links, $row_meta );
|
363 |
+
}
|
364 |
+
return (array) $links;
|
365 |
+
}
|
366 |
+
|
367 |
+
//Template load admin script
|
368 |
+
public function dsm_admin_footer_text( $footer_text ) {
|
369 |
+
$current_screen = get_current_screen();
|
370 |
+
$is_divi_supreme_screen = ( $current_screen && false !== strpos( $current_screen->id, 'toplevel_page_divi_supreme_settings' ) );
|
371 |
+
|
372 |
+
if ( $is_divi_supreme_screen ) {
|
373 |
+
$footer_text = sprintf(
|
374 |
+
__( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'dsm-supreme-modules-for-divi' ),
|
375 |
+
sprintf( '<strong>%s</strong>', esc_html__( 'Divi Supreme', 'dsm-supreme-modules-for-divi' ) ),
|
376 |
+
'<a href="https://wordpress.org/support/plugin/supreme-modules-for-divi/reviews/?rate=5#new-post" target="_blank" class="dsm-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'dsm-supreme-modules-for-divi' ) . '">★★★★★</a>'
|
377 |
+
);
|
378 |
+
}
|
379 |
+
|
380 |
+
return $footer_text;
|
381 |
+
}
|
382 |
+
public function dsm_admin_load_enqueue( $hook_suffix ){
|
383 |
+
if( in_array($hook_suffix, array('post.php', 'post-new.php') ) ) {
|
384 |
+
$screen = get_current_screen();
|
385 |
+
|
386 |
+
if( is_object( $screen ) && 'dsm_header_footer' == $screen->post_type ) {
|
387 |
+
wp_enqueue_script( 'dsm-admin-js', plugins_url( 'admin/js/dsm-admin.js' , dirname(__FILE__) ) );
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Creates the Divi Template
|
394 |
+
*
|
395 |
+
* @since 1.0.0
|
396 |
+
*/
|
397 |
+
public function dsm_header_footer_posttypes() {
|
398 |
+
$labels = array(
|
399 |
+
'name' => esc_html__( 'Divi Templates', 'dsm-supreme-modules-for-divi' ),
|
400 |
+
'singular_name' => esc_html__( 'Divi Template', 'dsm-supreme-modules-for-divi' ),
|
401 |
+
'add_new' => esc_html__( 'Add New', 'dsm-supreme-modules-for-divi' ),
|
402 |
+
'add_new_item' => esc_html__( 'Add New Template', 'dsm-supreme-modules-for-divi' ),
|
403 |
+
'edit_item' => esc_html__( 'Edit Template', 'dsm-supreme-modules-for-divi' ),
|
404 |
+
'new_item' => esc_html__( 'New Template', 'dsm-supreme-modules-for-divi' ),
|
405 |
+
'all_items' => esc_html__( 'All Templates', 'dsm-supreme-modules-for-divi' ),
|
406 |
+
'view_item' => esc_html__( 'View Template', 'dsm-supreme-modules-for-divi' ),
|
407 |
+
'search_items' => esc_html__( 'Search Templates', 'dsm-supreme-modules-for-divi' ),
|
408 |
+
'not_found' => esc_html__( 'Nothing found', 'dsm-supreme-modules-for-divi' ),
|
409 |
+
'not_found_in_trash' => esc_html__( 'Nothing found in Trash', 'dsm-supreme-modules-for-divi' ),
|
410 |
+
'parent_item_colon' => '',
|
411 |
+
);
|
412 |
+
|
413 |
+
$args = array(
|
414 |
+
'labels' => $labels,
|
415 |
+
'public' => false,
|
416 |
+
'publicly_queryable' => true,
|
417 |
+
'show_in_menu' => false,
|
418 |
+
'show_ui' => true,
|
419 |
+
'can_export' => true,
|
420 |
+
'show_in_nav_menus' => true,
|
421 |
+
'has_archive' => true,
|
422 |
+
'rewrite' => array(
|
423 |
+
'slug' => 'header-footer',
|
424 |
+
'with_front' => false
|
425 |
+
),
|
426 |
+
'capability_type' => 'post',
|
427 |
+
'hierarchical' => false,
|
428 |
+
'menu_position' => null,
|
429 |
+
'supports' => array( 'title', 'author', 'editor', 'thumbnail', 'revisions', 'custom-fields' ),
|
430 |
+
);
|
431 |
+
|
432 |
+
register_post_type( 'dsm_header_footer', $args );
|
433 |
+
}
|
434 |
+
public function dsm_load_headerfooter_template($template) {
|
435 |
+
global $post;
|
436 |
+
|
437 |
+
if ($post->post_type == 'dsm_header_footer' && $template !== locate_template(array('page-template-blank.php'))){
|
438 |
+
return plugin_dir_path( __FILE__ ) . 'templates/page-template-blank.php';
|
439 |
+
}
|
440 |
+
|
441 |
+
return $template;
|
442 |
+
}
|
443 |
+
public function dsm_header_footer_meta_box_options($post) {
|
444 |
+
wp_nonce_field( 'dsm-header-footer-meta-box-nonce', 'dsm-header-footer-meta-box-nonce' );
|
445 |
+
?>
|
446 |
+
<div class="dsm-header-footer-meta-box dsm_<?php echo get_post_meta($post->ID, 'dsm-header-footer-meta-box-options', true); ?>">
|
447 |
+
<p class="dsm-header-footer-meta-box-options">
|
448 |
+
<label for="dsm-header-footer-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">Assign template to:</label>
|
449 |
+
<select name="dsm-header-footer-meta-box-options">
|
450 |
+
<?php
|
451 |
+
$option_values = array(
|
452 |
+
'footer' => __( 'Footer', 'dsm-supreme-modules-for-divi' ),
|
453 |
+
'404' => __( '404', 'dsm-supreme-modules-for-divi' ),
|
454 |
+
//'header' => __( 'Header (Not available)', 'dsm-supreme-modules-for-divi' ),
|
455 |
+
);
|
456 |
+
|
457 |
+
foreach($option_values as $key => $value) {
|
458 |
+
if($key == get_post_meta($post->ID, 'dsm-header-footer-meta-box-options', true)) {
|
459 |
+
?>
|
460 |
+
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
|
461 |
+
<?php
|
462 |
+
}
|
463 |
+
else {
|
464 |
+
?>
|
465 |
+
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
466 |
+
<?php
|
467 |
+
}
|
468 |
+
}
|
469 |
+
?>
|
470 |
+
</select>
|
471 |
+
</p>
|
472 |
+
<p class="dsm-css-classes-meta-box-options">
|
473 |
+
<label for="dsm-css-classes-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">CSS Classes:</label>
|
474 |
+
<input name="dsm-css-classes-meta-box-options" style="width:100%;" type="text" value="<?php echo get_post_meta($post->ID, 'dsm-css-classes-meta-box-options', true); ?>">
|
475 |
+
</p>
|
476 |
+
<p class="dsm-remove-default-footer-meta-box-options">
|
477 |
+
<label for="dsm-remove-default-footer-meta-box-options" style="display: block; font-weight: bold; margin-bottom: 5px;">Remove default Divi footer</label>
|
478 |
+
<select name="dsm-remove-default-footer-meta-box-options">
|
479 |
+
<?php
|
480 |
+
$option_values = array(
|
481 |
+
'no' => __( 'No', 'dsm-supreme-modules-for-divi' ),
|
482 |
+
'yes' => __( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
483 |
+
);
|
484 |
+
|
485 |
+
foreach($option_values as $key => $value) {
|
486 |
+
if($key == get_post_meta($post->ID, 'dsm-remove-default-footer-meta-box-options', true)) {
|
487 |
+
?>
|
488 |
+
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
|
489 |
+
<?php
|
490 |
+
}
|
491 |
+
else {
|
492 |
+
?>
|
493 |
+
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
494 |
+
<?php
|
495 |
+
}
|
496 |
+
}
|
497 |
+
?>
|
498 |
+
</select>
|
499 |
+
</p>
|
500 |
+
<p><?php _e( 'Note: Footer Template will only show up on the frontend.', 'dsm-supreme-modules-for-divi' ); ?></p>
|
501 |
+
</div>
|
502 |
+
<?php
|
503 |
+
}
|
504 |
+
public function dsm_add_header_footer_meta_box() {
|
505 |
+
add_meta_box('dsm_header_footer_meta_box', 'Divi Templates', array( $this, 'dsm_header_footer_meta_box_options' ), 'dsm_header_footer', 'side', 'high', null);
|
506 |
+
remove_meta_box( 'et_settings_meta_box', 'dsm_header_footer', 'side', 'high' );
|
507 |
+
}
|
508 |
+
public function dsm_save_header_footer_meta_box($post_id, $post, $update) {
|
509 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
510 |
+
return;
|
511 |
+
}
|
512 |
+
|
513 |
+
if ( ! isset( $_POST['dsm-header-footer-meta-box-nonce'] ) || ! wp_verify_nonce( $_POST['dsm-header-footer-meta-box-nonce'], 'dsm-header-footer-meta-box-nonce' ) ) {
|
514 |
+
return;
|
515 |
+
}
|
516 |
+
|
517 |
+
if ( ! current_user_can( 'edit_posts' ) ) {
|
518 |
+
return;
|
519 |
+
}
|
520 |
+
|
521 |
+
$slug = 'dsm_header_footer';
|
522 |
+
if ( $slug != $post->post_type ) {
|
523 |
+
return $post_id;
|
524 |
+
}
|
525 |
+
|
526 |
+
if ( isset( $_POST['dsm-header-footer-meta-box-options'] ) ) {
|
527 |
+
update_post_meta( $post_id, 'dsm-header-footer-meta-box-options', esc_attr( $_POST['dsm-header-footer-meta-box-options'] ) );
|
528 |
+
}
|
529 |
+
|
530 |
+
if ( isset( $_POST['dsm-css-classes-meta-box-options'] ) ) {
|
531 |
+
update_post_meta( $post_id, 'dsm-css-classes-meta-box-options', sanitize_text_field( $_POST['dsm-css-classes-meta-box-options'] ) );
|
532 |
+
}
|
533 |
+
|
534 |
+
if ( isset( $_POST['dsm-remove-default-footer-meta-box-options'] ) ) {
|
535 |
+
update_post_meta( $post_id, 'dsm-remove-default-footer-meta-box-options', esc_attr( $_POST['dsm-remove-default-footer-meta-box-options'] ) );
|
536 |
+
}
|
537 |
+
/*
|
538 |
+
if ( isset( $_POST['dsm-embed-footer-in-vb'] ) ) {
|
539 |
+
update_post_meta( $post_id, 'dsm-embed-footer-in-vb', sanitize_text_field( $_POST['dsm-embed-footer-in-vb'] ) );
|
540 |
+
}*/
|
541 |
+
}
|
542 |
+
public function dsm_custom_footer() {
|
543 |
+
$footer_args = array(
|
544 |
+
'post_type' => 'dsm_header_footer',
|
545 |
+
'meta_key' => 'dsm-header-footer-meta-box-options',
|
546 |
+
'meta_value' => 'footer',
|
547 |
+
'meta_type' => 'post',
|
548 |
+
'meta_query' => array(
|
549 |
+
array(
|
550 |
+
'key' => 'dsm-header-footer-meta-box-options',
|
551 |
+
'value' => 'footer',
|
552 |
+
'compare' => '==',
|
553 |
+
'type' => 'post',
|
554 |
+
),
|
555 |
+
),
|
556 |
+
);
|
557 |
+
|
558 |
+
$footer_template = new WP_Query(
|
559 |
+
$footer_args
|
560 |
+
);
|
561 |
+
|
562 |
+
$footer_css_args = array(
|
563 |
+
'post_type' => 'dsm_header_footer',
|
564 |
+
'meta_key' => 'dsm-css-classes-meta-box-options',
|
565 |
+
'value' => '',
|
566 |
+
'meta_type' => 'post',
|
567 |
+
'meta_query' => array(
|
568 |
+
array(
|
569 |
+
'key' => 'dsm-css-classes-meta-box-options',
|
570 |
+
'value' => '',
|
571 |
+
'compare' => '!=',
|
572 |
+
'type' => 'post',
|
573 |
+
),
|
574 |
+
),
|
575 |
+
);
|
576 |
+
|
577 |
+
$footer_css_template = new WP_Query(
|
578 |
+
$footer_css_args
|
579 |
+
);
|
580 |
+
|
581 |
+
if ( $footer_template->have_posts() ) {
|
582 |
+
$footer_template_ID = $footer_template->post->ID;
|
583 |
+
$footer_template_shortcode = apply_filters('the_content', get_post_field('post_content', $footer_template_ID));
|
584 |
+
$footer_template_css = get_post_custom($footer_template_ID);
|
585 |
+
|
586 |
+
if ( $footer_template_css['dsm-css-classes-meta-box-options'][0] != '' ) {
|
587 |
+
$footer_template_css_output = get_post_meta( $footer_css_template->post->ID, 'dsm-css-classes-meta-box-options', true );
|
588 |
+
} else {
|
589 |
+
$footer_template_css_output = '';
|
590 |
+
}
|
591 |
+
|
592 |
+
if ( !et_core_is_fb_enabled() ) {
|
593 |
+
$footer_output = sprintf(
|
594 |
+
'<footer id="dsm-footer" class="dsm-footer" itemscope="itemscope" itemtype="https://schema.org/WPFooter">%1$s</footer>
|
595 |
+
',
|
596 |
+
$footer_template_shortcode
|
597 |
+
);
|
598 |
+
echo $footer_output;
|
599 |
+
}
|
600 |
+
}
|
601 |
+
}
|
602 |
+
public function dsm_redirect_404() {
|
603 |
+
$dsm_four_zero_four_args = array(
|
604 |
+
'post_type' => 'dsm_header_footer',
|
605 |
+
'meta_key' => 'dsm-header-footer-meta-box-options',
|
606 |
+
'meta_value' => '404',
|
607 |
+
'meta_type' => 'post',
|
608 |
+
'meta_query' => array(
|
609 |
+
array(
|
610 |
+
'key' => 'dsm-header-footer-meta-box-options',
|
611 |
+
'value' => '404',
|
612 |
+
'compare' => '==',
|
613 |
+
'type' => 'post',
|
614 |
+
),
|
615 |
+
),
|
616 |
+
);
|
617 |
+
|
618 |
+
$dsm_four_zero_four_template = new WP_Query(
|
619 |
+
$dsm_four_zero_four_args
|
620 |
+
);
|
621 |
+
|
622 |
+
if ( $dsm_four_zero_four_template->have_posts() ) {
|
623 |
+
if ( is_404() ) :
|
624 |
+
include( plugin_dir_path( __FILE__ ) . 'templates/page-template-404.php' );
|
625 |
+
exit;
|
626 |
+
endif;
|
627 |
+
}
|
628 |
+
}
|
629 |
+
public function dsm_custom_footer_settings() {
|
630 |
+
$footer_args = array(
|
631 |
+
'post_type' => 'dsm_header_footer',
|
632 |
+
'meta_key' => 'dsm-header-footer-meta-box-options',
|
633 |
+
'meta_value' => 'footer',
|
634 |
+
'meta_type' => 'post',
|
635 |
+
'meta_query' => array(
|
636 |
+
array(
|
637 |
+
'key' => 'dsm-header-footer-meta-box-options',
|
638 |
+
'value' => 'footer',
|
639 |
+
'compare' => '==',
|
640 |
+
'type' => 'post',
|
641 |
+
),
|
642 |
+
),
|
643 |
+
);
|
644 |
+
|
645 |
+
$footer_template = new WP_Query(
|
646 |
+
$footer_args
|
647 |
+
);
|
648 |
+
|
649 |
+
if ( $footer_template->have_posts() ) {
|
650 |
+
$footer_template_ID = $footer_template->post->ID;
|
651 |
+
$footer_template_css = get_post_custom($footer_template_ID);
|
652 |
+
|
653 |
+
if ( $footer_template_css['dsm-remove-default-footer-meta-box-options'][0] == 'yes' ) {
|
654 |
+
echo '<style id="dsm-footer-css" type="text/css">footer#main-footer { display: none; }</style>';
|
655 |
+
}
|
656 |
+
}
|
657 |
+
}
|
658 |
+
public function dsm_header_footer_admin_notice($post) {
|
659 |
+
$current_screen = get_current_screen();
|
660 |
+
|
661 |
+
if ( $current_screen->post_type === 'dsm_header_footer' ) { ?>
|
662 |
+
<div class="notice notice-info">
|
663 |
+
<p><?php _e( 'Notice: For first time user, please re-save your <a href="'. get_admin_url() .'options-permalink.php" target="_blank">Permalinks</a> again to flush the rewrite rules in order view them in Visual Builder. This will only work for the Divi Theme. Once ElegantThemes updated their Template Hook on Extra Theme, this feature will also be available. Currently only the footer and 404 template is available you. Please create one template and assign to the footer or 404. If you do not see Divi Builder here, remember to <a href="'. get_admin_url() .'admin.php?page=et_divi_options#wrap-builder" target="_blank">Enable Divi Builder On Post Types</a> in the Divi Options.', 'dsm-supreme-modules-for-divi' ); ?></p>
|
664 |
+
</div>
|
665 |
+
<?php }
|
666 |
+
}
|
667 |
+
|
668 |
+
/**
|
669 |
+
* Creates the Divi Supreme Scheduled Content
|
670 |
+
*
|
671 |
+
* @since 1.0.0
|
672 |
+
*/
|
673 |
+
public function dsm_add_section_setting($fields_unprocessed) {
|
674 |
+
$fields = [];
|
675 |
+
$fields['dsm_section_schedule_visibility'] = array(
|
676 |
+
'label' => esc_html__( 'Use Scheduled Content Visibility', 'dsm-supreme-modules-for-divi' ),
|
677 |
+
'type' => 'yes_no_button',
|
678 |
+
'option_category' => 'configuration',
|
679 |
+
'options' => array(
|
680 |
+
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
681 |
+
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
682 |
+
),
|
683 |
+
'default_on_front' => 'off',
|
684 |
+
'tab_slug' => 'custom_css',
|
685 |
+
'toggle_slug' => 'visibility',
|
686 |
+
'description' => esc_html__( 'Here you can choose whether your Section will show or hide depending on the given date/time.', 'dsm-supreme-modules-for-divi' ),
|
687 |
+
);
|
688 |
+
$fields['dsm_section_schedule_show_hide'] = array(
|
689 |
+
'label' => esc_html__( 'Show or Hide Section', 'dsm-supreme-modules-for-divi' ),
|
690 |
+
'type' => 'select',
|
691 |
+
'option_category' => 'configuration',
|
692 |
+
'options' => array(
|
693 |
+
'start' => esc_html__( 'Show', 'dsm-supreme-modules-for-divi' ),
|
694 |
+
'end' => esc_html__( 'Hide', 'dsm-supreme-modules-for-divi' ),
|
695 |
+
),
|
696 |
+
'default_on_front' => 'start',
|
697 |
+
'tab_slug' => 'custom_css',
|
698 |
+
'toggle_slug' => 'visibility',
|
699 |
+
'show_if' => array(
|
700 |
+
'dsm_section_schedule_visibility' => 'on',
|
701 |
+
),
|
702 |
+
);
|
703 |
+
$fields['dsm_section_schedule_after_datetime'] = array(
|
704 |
+
'default' => '',
|
705 |
+
'label' => esc_html__( 'Schedule a Date/Time', 'dsm-supreme-modules-for-divi' ),
|
706 |
+
'type' => 'date_picker',
|
707 |
+
'tab_slug' => 'custom_css',
|
708 |
+
'toggle_slug' => 'visibility',
|
709 |
+
'show_if' => array(
|
710 |
+
'dsm_section_schedule_visibility' => 'on',
|
711 |
+
),
|
712 |
+
);
|
713 |
+
return array_merge($fields_unprocessed, $fields);
|
714 |
+
}
|
715 |
+
|
716 |
+
public function output_section( $output, $render_slug, $module ) {
|
717 |
+
if ('et_pb_section' !== $render_slug) {
|
718 |
+
return $output;
|
719 |
+
} else if ('on' !== $module->props['dsm_section_schedule_visibility']) {
|
720 |
+
return $output;
|
721 |
+
} else {
|
722 |
+
$dsm_section_schedule_visibility = $module->props['dsm_section_schedule_visibility'];
|
723 |
+
$dsm_section_schedule_show_hide = $module->props['dsm_section_schedule_show_hide'];
|
724 |
+
$dsm_section_schedule_after_datetime = $module->props['dsm_section_schedule_after_datetime'];
|
725 |
+
|
726 |
+
$dsm_section_class_output = '';
|
727 |
+
if ($dsm_section_schedule_visibility == 'on') {
|
728 |
+
$dsm_section_class_output .= ' dsm_schedule_visibility';
|
729 |
+
}
|
730 |
+
$output = str_replace('class="et_pb_section ', 'data-dsm-' . esc_html($dsm_section_schedule_show_hide) . '="' . esc_html($dsm_section_schedule_after_datetime) . '" class="et_pb_section'. $dsm_section_class_output .' ', $output);
|
731 |
+
return $output;
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
public function dsm_add_row_setting($fields_unprocessed) {
|
736 |
+
$fields = [];
|
737 |
+
$fields['dsm_row_schedule_visibility'] = array(
|
738 |
+
'label' => esc_html__( 'Use Scheduled Content Visibility', 'dsm-supreme-modules-for-divi' ),
|
739 |
+
'type' => 'yes_no_button',
|
740 |
+
'option_category' => 'configuration',
|
741 |
+
'options' => array(
|
742 |
+
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
743 |
+
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
744 |
+
),
|
745 |
+
'default_on_front' => 'off',
|
746 |
+
'tab_slug' => 'custom_css',
|
747 |
+
'toggle_slug' => 'visibility',
|
748 |
+
'description' => esc_html__( 'Here you can choose whether your Row will show/hide depending on the given date/time.', 'dsm-supreme-modules-for-divi' ),
|
749 |
+
);
|
750 |
+
$fields['dsm_row_schedule_show_hide'] = array(
|
751 |
+
'label' => esc_html__( 'Show or Hide Row', 'dsm-supreme-modules-for-divi' ),
|
752 |
+
'type' => 'select',
|
753 |
+
'option_category' => 'configuration',
|
754 |
+
'options' => array(
|
755 |
+
'start' => esc_html__( 'Show', 'dsm-supreme-modules-for-divi' ),
|
756 |
+
'end' => esc_html__( 'Hide', 'dsm-supreme-modules-for-divi' ),
|
757 |
+
),
|
758 |
+
'default_on_front' => 'start',
|
759 |
+
'tab_slug' => 'custom_css',
|
760 |
+
'toggle_slug' => 'visibility',
|
761 |
+
'show_if' => array(
|
762 |
+
'dsm_row_schedule_visibility' => 'on',
|
763 |
+
),
|
764 |
+
);
|
765 |
+
$fields['dsm_row_schedule_after_datetime'] = array(
|
766 |
+
'default' => '',
|
767 |
+
'label' => esc_html__( 'Schedule a Date/Time', 'dsm-supreme-modules-for-divi' ),
|
768 |
+
'type' => 'date_picker',
|
769 |
+
'tab_slug' => 'custom_css',
|
770 |
+
'toggle_slug' => 'visibility',
|
771 |
+
'show_if' => array(
|
772 |
+
'dsm_row_schedule_visibility' => 'on',
|
773 |
+
),
|
774 |
+
);
|
775 |
+
return array_merge($fields_unprocessed, $fields);
|
776 |
+
}
|
777 |
+
|
778 |
+
public function output_row( $output, $render_slug, $module ) {
|
779 |
+
if ('et_pb_row' !== $render_slug) {
|
780 |
+
return $output;
|
781 |
+
} else if ('on' !== $module->props['dsm_row_schedule_visibility']) {
|
782 |
+
return $output;
|
783 |
+
} else {
|
784 |
+
$dsm_row_schedule_visibility = $module->props['dsm_row_schedule_visibility'];
|
785 |
+
$dsm_row_schedule_show_hide = $module->props['dsm_row_schedule_show_hide'];
|
786 |
+
$dsm_row_schedule_after_datetime = $module->props['dsm_row_schedule_after_datetime'];
|
787 |
+
|
788 |
+
$dsm_row_class_output = '';
|
789 |
+
if ($dsm_row_schedule_visibility == 'on') {
|
790 |
+
$dsm_row_class_output .= ' dsm_schedule_visibility';
|
791 |
+
}
|
792 |
+
$output = str_replace('class="et_pb_row ', 'data-dsm-' . esc_html($dsm_row_schedule_show_hide) . '="' . esc_html($dsm_row_schedule_after_datetime) . '" class="et_pb_row'. $dsm_row_class_output .' ', $output);
|
793 |
+
return $output;
|
794 |
+
}
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* Creates the Divi Supreme Shortcodes.
|
799 |
+
*
|
800 |
+
* @since 1.0.0
|
801 |
+
*/
|
802 |
+
public function dsm_divi_shortcode($divi_shortcode = []) {
|
803 |
+
if ( empty( $divi_shortcode['id'] ) ) {
|
804 |
+
return '';
|
805 |
+
}
|
806 |
+
return do_shortcode('[et_pb_section global_module="'.$divi_shortcode['id'].'"][/et_pb_section]');
|
807 |
+
}
|
808 |
+
public function dsm_divi_shortcode_post_columns_header($columns) {
|
809 |
+
$columns['shortcode'] = __( 'Shortcode', 'dsm-supreme-modules-for-divi' );
|
810 |
+
return $columns;
|
811 |
+
}
|
812 |
+
public function dsm_divi_shortcode_post_columns_content($column_name) {
|
813 |
+
global $post;
|
814 |
+
switch ($column_name) {
|
815 |
+
case 'shortcode':
|
816 |
+
$shortcode = esc_attr( sprintf( '[%s id="%d"]', DSM_SHORTCODE, $post->ID ) );
|
817 |
+
printf( '<input class="dsm-shortcode-input" type="text" readonly onfocus="this.select()" value="%s" style="width:100%%" />', $shortcode );
|
818 |
+
break;
|
819 |
+
}
|
820 |
+
}
|
821 |
+
|
822 |
+
/**
|
823 |
+
* Load Custom CF7
|
824 |
+
*
|
825 |
+
* @since 1.0.0
|
826 |
+
*/
|
827 |
+
public function dsm_et_builder_load_cf7( $actions ) {
|
828 |
+
$actions[] = 'dsm_load_cf7_library';
|
829 |
+
|
830 |
+
return $actions;
|
831 |
+
}
|
832 |
+
public function dsm_load_cf7_library() {
|
833 |
+
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
|
834 |
+
wp_die();
|
835 |
+
}
|
836 |
+
echo do_shortcode( '[contact-form-7 id="' . $_POST['cf7_library'] . '"]' );
|
837 |
+
wp_die();
|
838 |
+
}
|
839 |
+
public function dsm_wpcf7_add_form_tag_submit() {
|
840 |
+
wpcf7_add_form_tag( 'submit', array( $this, 'dsm_wpcf7_submit_form_tag_handler' ) );
|
841 |
+
}
|
842 |
+
public function dsm_wpcf7_submit_form_tag_handler( $tag ) {
|
843 |
+
$class = wpcf7_form_controls_class( $tag->type . ' et_pb_button' );
|
844 |
+
|
845 |
+
$atts = array();
|
846 |
+
|
847 |
+
$atts['class'] = $tag->get_class_option( $class );
|
848 |
+
$atts['id'] = $tag->get_id_option();
|
849 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
850 |
+
|
851 |
+
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
|
852 |
+
|
853 |
+
if ( empty( $value ) ) {
|
854 |
+
$value = __( 'Send', 'contact-form-7' );
|
855 |
+
}
|
856 |
+
|
857 |
+
$atts['type'] = 'submit';
|
858 |
+
$atts['value'] = $value;
|
859 |
+
|
860 |
+
$atts = wpcf7_format_atts( $atts );
|
861 |
+
|
862 |
+
$html = '<button ' . $atts . '>' . esc_attr( $value ) . '</button>';
|
863 |
+
|
864 |
+
return $html;
|
865 |
+
}
|
866 |
+
public function dsm_wpcf7_add_form_tag_select() {
|
867 |
+
wpcf7_add_form_tag( array( 'select', 'select*' ),
|
868 |
+
array( $this, 'dsm_wpcf7_select_form_tag_handler' ),
|
869 |
+
array(
|
870 |
+
'name-attr' => true,
|
871 |
+
'selectable-values' => true,
|
872 |
+
)
|
873 |
+
);
|
874 |
+
}
|
875 |
+
public function dsm_wpcf7_select_form_tag_handler( $tag ) {
|
876 |
+
if ( empty( $tag->name ) ) {
|
877 |
+
return '';
|
878 |
+
}
|
879 |
+
|
880 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
881 |
+
|
882 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
883 |
+
|
884 |
+
if ( $validation_error ) {
|
885 |
+
$class .= ' wpcf7-not-valid';
|
886 |
+
}
|
887 |
+
|
888 |
+
$atts = array();
|
889 |
+
|
890 |
+
$atts['class'] = $tag->get_class_option( $class . ' et_pb_contact_select input' );
|
891 |
+
$atts['id'] = $tag->get_id_option();
|
892 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
893 |
+
|
894 |
+
if ( $tag->is_required() ) {
|
895 |
+
$atts['aria-required'] = 'true';
|
896 |
+
}
|
897 |
+
|
898 |
+
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
|
899 |
+
|
900 |
+
$multiple = $tag->has_option( 'multiple' );
|
901 |
+
$include_blank = $tag->has_option( 'include_blank' );
|
902 |
+
$first_as_label = $tag->has_option( 'first_as_label' );
|
903 |
+
|
904 |
+
if ( $tag->has_option( 'size' ) ) {
|
905 |
+
$size = $tag->get_option( 'size', 'int', true );
|
906 |
+
|
907 |
+
if ( $size ) {
|
908 |
+
$atts['size'] = $size;
|
909 |
+
} elseif ( $multiple ) {
|
910 |
+
$atts['size'] = 4;
|
911 |
+
} else {
|
912 |
+
$atts['size'] = 1;
|
913 |
+
}
|
914 |
+
}
|
915 |
+
|
916 |
+
$values = $tag->values;
|
917 |
+
$labels = $tag->labels;
|
918 |
+
|
919 |
+
if ( $data = (array) $tag->get_data_option() ) {
|
920 |
+
$values = array_merge( $values, array_values( $data ) );
|
921 |
+
$labels = array_merge( $labels, array_values( $data ) );
|
922 |
+
}
|
923 |
+
|
924 |
+
$default_choice = $tag->get_default_option( null, array(
|
925 |
+
'multiple' => $multiple,
|
926 |
+
'shifted' => $include_blank,
|
927 |
+
) );
|
928 |
+
|
929 |
+
if ( $include_blank || empty( $values ) ) {
|
930 |
+
array_unshift( $labels, '---' );
|
931 |
+
array_unshift( $values, '' );
|
932 |
+
} elseif ( $first_as_label ) {
|
933 |
+
$values[0] = '';
|
934 |
+
}
|
935 |
+
|
936 |
+
$html = '';
|
937 |
+
$hangover = wpcf7_get_hangover( $tag->name );
|
938 |
+
|
939 |
+
foreach ( $values as $key => $value ) {
|
940 |
+
if ( $hangover ) {
|
941 |
+
$selected = in_array( $value, (array) $hangover, true );
|
942 |
+
} else {
|
943 |
+
$selected = in_array( $value, (array) $default_choice, true );
|
944 |
+
}
|
945 |
+
|
946 |
+
$item_atts = array(
|
947 |
+
'value' => $value,
|
948 |
+
'selected' => $selected ? 'selected' : '',
|
949 |
+
);
|
950 |
+
|
951 |
+
$item_atts = wpcf7_format_atts( $item_atts );
|
952 |
+
|
953 |
+
$label = isset( $labels[$key] ) ? $labels[$key] : $value;
|
954 |
+
|
955 |
+
$html .= sprintf( '<option %1$s>%2$s</option>',
|
956 |
+
$item_atts, esc_html( $label ) );
|
957 |
+
}
|
958 |
+
|
959 |
+
if ( $multiple ) {
|
960 |
+
$atts['multiple'] = 'multiple';
|
961 |
+
}
|
962 |
+
|
963 |
+
$atts['name'] = $tag->name . ( $multiple ? '[]' : '' );
|
964 |
+
|
965 |
+
$atts = wpcf7_format_atts( $atts );
|
966 |
+
|
967 |
+
$html = sprintf(
|
968 |
+
'<span class="wpcf7-form-control-wrap dsm-contact-form-7-select %1$s"><select %2$s>%3$s</select>%4$s</span>',
|
969 |
+
sanitize_html_class( $tag->name ), $atts, $html, $validation_error );
|
970 |
+
|
971 |
+
return $html;
|
972 |
+
}
|
973 |
+
|
974 |
+
/**
|
975 |
+
* Load Custom CF
|
976 |
+
*
|
977 |
+
* @since 1.0.0
|
978 |
+
*/
|
979 |
+
public function dsm_et_builder_load_caldera_forms( $actions ) {
|
980 |
+
$actions[] = 'dsm_load_caldera_forms';
|
981 |
+
|
982 |
+
return $actions;
|
983 |
+
}
|
984 |
+
public function dsm_load_caldera_forms() {
|
985 |
+
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
|
986 |
+
wp_die();
|
987 |
+
}
|
988 |
+
echo do_shortcode( '[caldera_form id="' . $_POST['cf_library'] . '"]' );
|
989 |
+
wp_die();
|
990 |
+
}
|
991 |
+
|
992 |
+
}
|
includes/class.page-settings.php
CHANGED
@@ -27,8 +27,8 @@ class DSM_Settings {
|
|
27 |
}
|
28 |
|
29 |
function admin_menu() {
|
30 |
-
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/
|
31 |
-
if (
|
32 |
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' );
|
33 |
}
|
34 |
}
|
27 |
}
|
28 |
|
29 |
function admin_menu() {
|
30 |
+
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 );
|
31 |
+
if ( $this->settings_api->get_option( 'dsm_use_header_footer', 'dsm_general' ) == 'on' ) {
|
32 |
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' );
|
33 |
}
|
34 |
}
|
public/class-dsm-supreme-modules-for-divi-public.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The public-facing functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link https://suprememodules.com/about-us/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
10 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/public
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The public-facing functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the public-facing stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
20 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/public
|
21 |
+
* @author Supreme Modules <hello@divisupreme.com>
|
22 |
+
*/
|
23 |
+
class Dsm_Supreme_Modules_For_Divi_Public {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Initialize the class and set its properties.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @param string $plugin_name The name of the plugin.
|
48 |
+
* @param string $version The version of this plugin.
|
49 |
+
*/
|
50 |
+
public function __construct( $plugin_name, $version ) {
|
51 |
+
|
52 |
+
$this->plugin_name = $plugin_name;
|
53 |
+
$this->version = $version;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Register the stylesheets for the public-facing side of the site.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*/
|
62 |
+
public function enqueue_styles() {
|
63 |
+
|
64 |
+
/**
|
65 |
+
* This function is provided for demonstration purposes only.
|
66 |
+
*
|
67 |
+
* An instance of this class should be passed to the run() function
|
68 |
+
* defined in Dsm_Supreme_Modules_For_Divi_Loader as all of the hooks are defined
|
69 |
+
* in that particular class.
|
70 |
+
*
|
71 |
+
* The Dsm_Supreme_Modules_For_Divi_Loader will then create the relationship
|
72 |
+
* between the defined hooks and the functions defined in this
|
73 |
+
* class.
|
74 |
+
*/
|
75 |
+
|
76 |
+
//wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/dsm-supreme-modules-for-divi-public.css', array(), $this->version, 'all' );
|
77 |
+
if ( et_core_is_fb_enabled() ) {
|
78 |
+
wp_enqueue_style( 'dsm-et-admin', plugin_dir_url( __FILE__ ) . 'css/dsm-et-admin.css' );
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Register the JavaScript for the public-facing side of the site.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
*/
|
88 |
+
public function enqueue_scripts() {
|
89 |
+
|
90 |
+
/**
|
91 |
+
* This function is provided for demonstration purposes only.
|
92 |
+
*
|
93 |
+
* An instance of this class should be passed to the run() function
|
94 |
+
* defined in Dsm_Supreme_Modules_For_Divi_Loader as all of the hooks are defined
|
95 |
+
* in that particular class.
|
96 |
+
*
|
97 |
+
* The Dsm_Supreme_Modules_For_Divi_Loader will then create the relationship
|
98 |
+
* between the defined hooks and the functions defined in this
|
99 |
+
* class.
|
100 |
+
*/
|
101 |
+
|
102 |
+
//wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/dsm-supreme-modules-for-divi-public.js', array( 'jquery' ), $this->version, false );
|
103 |
+
wp_register_script('dsm-typed', plugin_dir_url( __FILE__ ) . 'js/typed.min.js', array(), DSM_VERSION, true );
|
104 |
+
wp_register_script('dsm-facebook', plugin_dir_url( __FILE__ ) . 'js/dsm-facebook.js', array(), DSM_VERSION, true );
|
105 |
+
wp_register_script('dsm-twitter-embed', 'https://platform.twitter.com/widgets.js', array(), DSM_VERSION, true );
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
public/css/dsm-et-admin.css
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_flipbox,
|
2 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_perspective_image,
|
3 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_divider,
|
4 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_typing_effect,
|
5 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_gradient_text,
|
6 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_button,
|
7 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_feed,
|
8 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_comments,
|
9 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_contact_form_7,
|
10 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_google_map,
|
11 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_twitter_timeline,
|
12 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_badges,
|
13 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_menu,
|
14 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_pricelist {
|
15 |
+
background: #6b09eb;
|
16 |
+
color: #fff;
|
17 |
+
font-size: 10px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_typing_effect:before,
|
21 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_feed:before,
|
22 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_twitter_timeline:before,
|
23 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_badges:before {
|
24 |
+
font-family: ETmodules !important;
|
25 |
+
}
|
26 |
+
|
27 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_flipbox:hover,
|
28 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_perspective_image:hover,
|
29 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_divider:hover,
|
30 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_typing_effect:hover,
|
31 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_gradient_text:hover,
|
32 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_button:hover,
|
33 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_feed:hover,
|
34 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_comments:hover,
|
35 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_contact_form_7:hover,
|
36 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_google_map:hover,
|
37 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_twitter_timeline:hover,
|
38 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_badges:hover,
|
39 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_menu:hover,
|
40 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_pricelist:hover,
|
41 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_flipbox:active,
|
42 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_perspective_image:active,
|
43 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_divider:active,
|
44 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_typing_effect:active,
|
45 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_gradient_text:active,
|
46 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_button:active,
|
47 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_feed:active,
|
48 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_comments:active,
|
49 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_contact_form_7:active,
|
50 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_google_map:active,
|
51 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_twitter_timeline:active,
|
52 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_badges:active,
|
53 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_menu:active,
|
54 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_pricelist:active,
|
55 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_flipbox:focus,
|
56 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_perspective_image:focus,
|
57 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_divider:focus,
|
58 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_typing_effect:focus,
|
59 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_gradient_text:focus,
|
60 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_button:focus,
|
61 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_feed:focus,
|
62 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_facebook_comments:focus,
|
63 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_contact_form_7:focus,
|
64 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_google_map:focus,
|
65 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_embed_twitter_timeline:focus,
|
66 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_text_badges:focus,
|
67 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_menu:focus,
|
68 |
+
.et-db #et-boc .et-fb-modules-list li.dsm_pricelist:focus {
|
69 |
+
background: rgba(107, 9, 235, 0.78);
|
70 |
+
color: #fff;
|
71 |
+
}
|
public/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
public/js/dsm-facebook.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(d, s, id) {
|
2 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
3 |
+
if (d.getElementById(id)) return;
|
4 |
+
js = d.createElement(s); js.id = id;
|
5 |
+
js.src = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v3.1&appId='+dsm_facebook_data_var.appID+'&autoLogAppEvents=1';
|
6 |
+
fjs.parentNode.insertBefore(js, fjs);
|
7 |
+
}(document, 'script', 'facebook-jssdk'));
|
public/js/dsm-supreme-modules-for-divi-public.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* All of the code for your public-facing JavaScript source
|
6 |
+
* should reside in this file.
|
7 |
+
*
|
8 |
+
* Note: It has been assumed you will write jQuery code here, so the
|
9 |
+
* $ function reference has been prepared for usage within the scope
|
10 |
+
* of this function.
|
11 |
+
*
|
12 |
+
* This enables you to define handlers, for when the DOM is ready:
|
13 |
+
*
|
14 |
+
* $(function() {
|
15 |
+
*
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* When the window is loaded:
|
19 |
+
*
|
20 |
+
* $( window ).load(function() {
|
21 |
+
*
|
22 |
+
* });
|
23 |
+
*
|
24 |
+
* ...and/or other possibilities.
|
25 |
+
*
|
26 |
+
* Ideally, it is not considered best practise to attach more than a
|
27 |
+
* single DOM-ready or window-load handler for a particular page.
|
28 |
+
* Although scripts in the WordPress core, Plugins and Themes may be
|
29 |
+
* practising this, we should strive to set a better example in our own work.
|
30 |
+
*/
|
31 |
+
|
32 |
+
})( jQuery );
|
public/js/typed.min.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
*
|
3 |
+
* typed.js - A JavaScript Typing Animation Library
|
4 |
+
* Author: Matt Boldt <me@mattboldt.com>
|
5 |
+
* Version: v2.0.9
|
6 |
+
* Url: https://github.com/mattboldt/typed.js
|
7 |
+
* License(s): MIT
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Typed=e():t.Typed=e()})(this,function(){return function(t){function e(n){if(s[n])return s[n].exports;var i=s[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),r=s(1),o=s(3),a=function(){function t(e,s){n(this,t),r.initializer.load(this,s,e),this.begin()}return i(t,[{key:"toggle",value:function(){this.pause.status?this.start():this.stop()}},{key:"stop",value:function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))}},{key:"start",value:function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))}},{key:"destroy",value:function(){this.reset(!1),this.options.onDestroy(this)}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]||arguments[0];clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())}},{key:"begin",value:function(){var t=this;this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.currentElContent&&0!==t.currentElContent.length?t.backspace(t.currentElContent,t.currentElContent.length):t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)}},{key:"typewrite",value:function(t,e){var s=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var n=this.humanizer(this.typeSpeed),i=1;return this.pause.status===!0?void this.setPauseStatus(t,e,!0):void(this.timeout=setTimeout(function(){e=o.htmlParser.typeHtmlChars(t,e,s);var n=0,r=t.substr(e);if("^"===r.charAt(0)&&/^\^\d+/.test(r)){var a=1;r=/\d+/.exec(r)[0],a+=r.length,n=parseInt(r),s.temporaryPause=!0,s.options.onTypingPaused(s.arrayPos,s),t=t.substring(0,e)+t.substring(e+a),s.toggleBlinking(!0)}if("`"===r.charAt(0)){for(;"`"!==t.substr(e+i).charAt(0)&&(i++,!(e+i>t.length)););var u=t.substring(0,e),l=t.substring(u.length+1,e+i),c=t.substring(e+i+1);t=u+l+c,i--}s.timeout=setTimeout(function(){s.toggleBlinking(!1),e>=t.length?s.doneTyping(t,e):s.keepTyping(t,e,i),s.temporaryPause&&(s.temporaryPause=!1,s.options.onTypingResumed(s.arrayPos,s))},n)},n))}},{key:"keepTyping",value:function(t,e,s){0===e&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this)),e+=s;var n=t.substr(0,e);this.replaceText(n),this.typewrite(t,e)}},{key:"doneTyping",value:function(t,e){var s=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){s.backspace(t,e)},this.backDelay))}},{key:"backspace",value:function(t,e){var s=this;if(this.pause.status===!0)return void this.setPauseStatus(t,e,!0);if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var n=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){e=o.htmlParser.backSpaceHtmlChars(t,e,s);var n=t.substr(0,e);if(s.replaceText(n),s.smartBackspace){var i=s.strings[s.arrayPos+1];i&&n===i.substr(0,e)?s.stopNum=e:s.stopNum=0}e>s.stopNum?(e--,s.backspace(t,e)):e<=s.stopNum&&(s.arrayPos++,s.arrayPos===s.strings.length?(s.arrayPos=0,s.options.onLastStringBackspaced(),s.shuffleStringsIfNeeded(),s.begin()):s.typewrite(s.strings[s.sequence[s.arrayPos]],e))},n)}},{key:"complete",value:function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0}},{key:"setPauseStatus",value:function(t,e,s){this.pause.typewrite=s,this.pause.curString=t,this.pause.curStrPos=e}},{key:"toggleBlinking",value:function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))}},{key:"humanizer",value:function(t){return Math.round(Math.random()*t/2)+t}},{key:"shuffleStringsIfNeeded",value:function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))}},{key:"initFadeOut",value:function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)}},{key:"replaceText",value:function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t}},{key:"bindFocusEvents",value:function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(e){t.stop()}),this.el.addEventListener("blur",function(e){t.el.value&&0!==t.el.value.length||t.start()}))}},{key:"insertCursor",value:function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))}}]),t}();e["default"]=a,t.exports=e["default"]},function(t,e,s){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},o=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),a=s(2),u=n(a),l=function(){function t(){i(this,t)}return o(t,[{key:"load",value:function(t,e,s){if("string"==typeof s?t.el=document.querySelector(s):t.el=s,t.options=r({},u["default"],e),t.isInput="input"===t.el.tagName.toLowerCase(),t.attr=t.options.attr,t.bindInputFocusEvents=t.options.bindInputFocusEvents,t.showCursor=!t.isInput&&t.options.showCursor,t.cursorChar=t.options.cursorChar,t.cursorBlinking=!0,t.elContent=t.attr?t.el.getAttribute(t.attr):t.el.textContent,t.contentType=t.options.contentType,t.typeSpeed=t.options.typeSpeed,t.startDelay=t.options.startDelay,t.backSpeed=t.options.backSpeed,t.smartBackspace=t.options.smartBackspace,t.backDelay=t.options.backDelay,t.fadeOut=t.options.fadeOut,t.fadeOutClass=t.options.fadeOutClass,t.fadeOutDelay=t.options.fadeOutDelay,t.isPaused=!1,t.strings=t.options.strings.map(function(t){return t.trim()}),"string"==typeof t.options.stringsElement?t.stringsElement=document.querySelector(t.options.stringsElement):t.stringsElement=t.options.stringsElement,t.stringsElement){t.strings=[],t.stringsElement.style.display="none";var n=Array.prototype.slice.apply(t.stringsElement.children),i=n.length;if(i)for(var o=0;o<i;o+=1){var a=n[o];t.strings.push(a.innerHTML.trim())}}t.strPos=0,t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.sequence=[],t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1;for(var o in t.strings)t.sequence[o]=o;t.currentElContent=this.getCurrentElContent(t),t.autoInsertCss=t.options.autoInsertCss,this.appendAnimationCss(t)}},{key:"getCurrentElContent",value:function(t){var e="";return e=t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent}},{key:"appendAnimationCss",value:function(t){var e="data-typed-js-css";if(t.autoInsertCss&&(t.showCursor||t.fadeOut)&&!document.querySelector("["+e+"]")){var s=document.createElement("style");s.type="text/css",s.setAttribute(e,!0);var n="";t.showCursor&&(n+="\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "),t.fadeOut&&(n+="\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "),0!==s.length&&(s.innerHTML=n,document.body.appendChild(s))}}}]),t}();e["default"]=l;var c=new l;e.initializer=c},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:1/0,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onComplete:function(t){},preStringTyped:function(t,e){},onStringTyped:function(t,e){},onLastStringBackspaced:function(t){},onTypingPaused:function(t,e){},onTypingResumed:function(t,e){},onReset:function(t){},onStop:function(t,e){},onStart:function(t,e){},onDestroy:function(t){}};e["default"]=s,t.exports=e["default"]},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),i=function(){function t(){s(this,t)}return n(t,[{key:"typeHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if("<"===n||"&"===n){var i="";for(i="<"===n?">":";";t.substr(e+1).charAt(0)!==i&&(e++,!(e+1>t.length)););e++}return e}},{key:"backSpaceHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if(">"===n||";"===n){var i="";for(i=">"===n?"<":"&";t.substr(e-1).charAt(0)!==i&&(e--,!(e<0)););e--}return e}}]),t}();e["default"]=i;var r=new i;e.htmlParser=r}])});
|
11 |
+
//# sourceMappingURL=typed.min.js.map
|
public/partials/dsm-supreme-modules-for-divi-public-display.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide a public-facing view for the plugin
|
5 |
+
*
|
6 |
+
* This file is used to markup the public-facing aspects of the plugin.
|
7 |
+
*
|
8 |
+
* @link https://suprememodules.com/about-us/
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
12 |
+
* @subpackage Dsm_Supreme_Modules_For_Divi/public/partials
|
13 |
+
*/
|
14 |
+
?>
|
15 |
+
|
16 |
+
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://suprememodules.com/
|
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 1.5.
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -89,6 +89,11 @@ Divi Builder >= version 2.1
|
|
89 |
PHP version >= 5.6
|
90 |
|
91 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
92 |
= 1.5.3 - 15.05.2019 =
|
93 |
* Added: Custom Radio and Checkbox style to Divi Supreme Caldera Forms Module.
|
94 |
* Improved: Automatically disable Alert Style, Form Styles and Grid Structure on the frontend when using Divi Supreme Caldera Forms Module.
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 1.5.4
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
89 |
PHP version >= 5.6
|
90 |
|
91 |
== Changelog ==
|
92 |
+
= 1.5.4 - 22.05.2019 =
|
93 |
+
* Improved: Overwrite the plugin and is based on the WordPress Plugin API, Coding Standards, and Documentation Standards.
|
94 |
+
* Improved: Overall better coding.
|
95 |
+
* Improved: Compatible with Divi Supreme Pro version even Divi Supreme Free is installed.
|
96 |
+
|
97 |
= 1.5.3 - 15.05.2019 =
|
98 |
* Added: Custom Radio and Checkbox style to Divi Supreme Caldera Forms Module.
|
99 |
* Improved: Automatically disable Alert Style, Form Styles and Grid Structure on the frontend when using Divi Supreme Caldera Forms Module.
|
supreme-modules-for-divi.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Divi Supreme Modules
|
4 |
Plugin URI: https://suprememodules.com
|
5 |
Description: Supreme Modules enhances the experience and features found on Divi and extend with custom creative modules to help you build amazing websites.
|
6 |
-
Version: 1.5.
|
7 |
Author: Supreme Modules
|
8 |
Author URI: https://suprememodules.com/about-us/
|
9 |
License: GPL2
|
@@ -26,123 +26,67 @@ along with Supreme Modules. If not, see https://www.gnu.org/licenses/gpl-2.0.htm
|
|
26 |
*/
|
27 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
if ( version_compare(PHP_VERSION, '5.6', '<') ) {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
38 |
} else {
|
39 |
-
|
40 |
-
define( 'DSM_SHORTCODE', 'divi_shortcode' );
|
41 |
-
|
42 |
-
if ( ! function_exists( 'dsm_initialize_extension' ) ):
|
43 |
-
/**
|
44 |
-
* Creates the extension's main class instance.
|
45 |
-
*
|
46 |
-
* @since 1.0.0
|
47 |
-
*/
|
48 |
-
function dsm_initialize_extension() {
|
49 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/SupremeModulesForDivi.php';
|
50 |
-
}
|
51 |
-
add_action( 'divi_extensions_init', 'dsm_initialize_extension' );
|
52 |
-
endif;
|
53 |
-
|
54 |
-
if ( ! function_exists( 'dsm_supreme_module_loader' ) ):
|
55 |
-
function dsm_supreme_module_loader() {
|
56 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/SupremeModulesLoader.php';
|
57 |
-
}
|
58 |
-
add_action( 'after_setup_theme', 'dsm_supreme_module_loader', 11 );
|
59 |
-
endif;
|
60 |
-
|
61 |
-
function dsm_scripts(){
|
62 |
-
wp_register_script('dsm-typed', plugin_dir_url( __FILE__ ) . 'assets/js/typed.min.js', array(), DSM_VERSION, true );
|
63 |
-
wp_register_script('dsm-facebook', plugin_dir_url( __FILE__ ) . 'assets/js/dsm-facebook.js', array(), DSM_VERSION, true );
|
64 |
-
wp_register_script('dsm-twitter-embed', 'https://platform.twitter.com/widgets.js', array(), DSM_VERSION, true );
|
65 |
-
if ( et_core_is_fb_enabled() ) {
|
66 |
-
wp_enqueue_style('dsm-et-admin', plugin_dir_url( __FILE__ ) . 'assets/css/dsm-et-admin.css' );
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
add_action('wp_enqueue_scripts', 'dsm_scripts');
|
71 |
-
|
72 |
-
function load_custom_wp_admin_style() {
|
73 |
-
wp_enqueue_style('dsm-plugin', plugin_dir_url( __FILE__ ) . 'assets/css/dsm-plugin.css' );
|
74 |
-
}
|
75 |
-
|
76 |
-
add_action('admin_enqueue_scripts', 'load_custom_wp_admin_style');
|
77 |
-
|
78 |
-
register_activation_hook( __FILE__, 'dsm_plugin_activate' );
|
79 |
-
|
80 |
-
if ( ! function_exists( 'dsm_plugin_activate' ) ):
|
81 |
-
function dsm_plugin_activate() {
|
82 |
-
flush_rewrite_rules();
|
83 |
-
if ( ! get_option( 'dsm_flush_rewrite_rules_flag' ) ) {
|
84 |
-
add_option( 'dsm_flush_rewrite_rules_flag', true );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
endif;
|
88 |
-
|
89 |
-
add_action( 'init', 'dsm_flush_rewrite_rules', 20 );
|
90 |
-
|
91 |
-
if ( ! function_exists( 'dsm_flush_rewrite_rules' ) ):
|
92 |
-
function dsm_flush_rewrite_rules() {
|
93 |
-
if ( get_option( 'dsm_flush_rewrite_rules_flag' ) ) {
|
94 |
-
flush_rewrite_rules();
|
95 |
-
delete_option( 'dsm_flush_rewrite_rules_flag' );
|
96 |
-
}
|
97 |
-
}
|
98 |
-
endif;
|
99 |
-
|
100 |
-
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'dsm_plugin_action_links', 10, 5 );
|
101 |
-
|
102 |
-
if ( ! function_exists( 'dsm_plugin_action_links' ) ):
|
103 |
-
function dsm_plugin_action_links( $links ) {
|
104 |
-
$dsm_go_pro = sprintf(
|
105 |
-
__( '<a href="' . esc_url( 'https://divisupreme.com/features/' ) . '"" target="_blank" class="dsm-plugin-gopro">%1$s</a>', 'dsm-supreme-modules-for-divi' ),
|
106 |
-
sprintf( '%s', esc_html__( 'Go Pro', 'dsm-supreme-modules-for-divi' ) )
|
107 |
-
);
|
108 |
-
|
109 |
-
$links[] = $dsm_go_pro;
|
110 |
-
return $links;
|
111 |
-
}
|
112 |
-
endif;
|
113 |
-
|
114 |
-
add_filter( 'plugin_action_links', 'dsm_add_action_plugin', 10, 5 );
|
115 |
-
|
116 |
-
if ( ! function_exists( 'dsm_add_action_plugin' ) ):
|
117 |
-
function dsm_add_action_plugin( $actions, $plugin_file ) {
|
118 |
-
static $plugin;
|
119 |
-
|
120 |
-
if (!isset($plugin))
|
121 |
-
$plugin = plugin_basename(__FILE__);
|
122 |
-
if ($plugin == $plugin_file) {
|
123 |
-
$settings = array('settings' => '<a href="'. esc_url( get_admin_url(null, 'options-general.php?page=divi_supreme_settings') ) .'">' . __('Settings', 'dsm-supreme-modules-for-divi') . '</a>');
|
124 |
-
|
125 |
-
$actions = array_merge($settings, $actions);
|
126 |
-
|
127 |
-
}
|
128 |
-
return $actions;
|
129 |
-
}
|
130 |
-
endif;
|
131 |
-
|
132 |
-
add_filter( 'plugin_row_meta', 'dsm_plugin_row_meta', 10, 2 );
|
133 |
-
|
134 |
-
if ( ! function_exists( 'dsm_plugin_row_meta' ) ):
|
135 |
-
function dsm_plugin_row_meta( $links, $file ) {
|
136 |
-
if ( plugin_basename( __FILE__ ) == $file ) {
|
137 |
-
$row_meta = array(
|
138 |
-
'docs' => '<a href="' . esc_url( 'https://docs.divisupreme.com/' ) . '" target="_blank" aria-label="' . esc_attr__( 'Divi Supreme Documentation', 'dsm-supreme-modules-for-divi' ) . '">' . esc_html__( 'Documentation', 'dsm-supreme-modules-for-divi' ) . '</a>',
|
139 |
-
'support' => '<a href="' . esc_url( 'https://divisupreme.com/contact/' ) . '" target="_blank" aria-label="' . esc_attr__( 'Get Support', 'dsm-supreme-modules-for-divi' ) . '">' . esc_html__( 'Get Support', 'dsm-supreme-modules-for-divi' ) . '</a>'
|
140 |
-
);
|
141 |
-
|
142 |
-
return array_merge( $links, $row_meta );
|
143 |
-
}
|
144 |
-
return (array) $links;
|
145 |
-
}
|
146 |
-
endif;
|
147 |
-
|
148 |
}
|
3 |
Plugin Name: Divi Supreme Modules
|
4 |
Plugin URI: https://suprememodules.com
|
5 |
Description: Supreme Modules enhances the experience and features found on Divi and extend with custom creative modules to help you build amazing websites.
|
6 |
+
Version: 1.5.4
|
7 |
Author: Supreme Modules
|
8 |
Author URI: https://suprememodules.com/about-us/
|
9 |
License: GPL2
|
26 |
*/
|
27 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
28 |
|
29 |
+
if ( ! defined('DSM_VERSION') ) {
|
30 |
+
define( 'DSM_VERSION', '1.5.4' );
|
31 |
+
}
|
32 |
+
if ( ! defined('DSM_SHORTCODE') ) {
|
33 |
+
define( 'DSM_SHORTCODE', 'divi_shortcode' );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The code that runs during plugin activation.
|
38 |
+
* This action is documented in includes/class-dsm-supreme-modules-for-divi-activator.php
|
39 |
+
*/
|
40 |
+
function activate_dsm_supreme_modules_for_divi() {
|
41 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-dsm-supreme-modules-for-divi-activator.php';
|
42 |
+
Dsm_Supreme_Modules_For_Divi_Activator::activate();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The code that runs during plugin deactivation.
|
47 |
+
* This action is documented in includes/class-dsm-supreme-modules-for-divi-deactivator.php
|
48 |
+
*/
|
49 |
+
function deactivate_dsm_supreme_modules_for_divi() {
|
50 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-dsm-supreme-modules-for-divi-deactivator.php';
|
51 |
+
Dsm_Supreme_Modules_For_Divi_Deactivator::deactivate();
|
52 |
+
}
|
53 |
+
|
54 |
+
register_activation_hook( __FILE__, 'activate_dsm_supreme_modules_for_divi' );
|
55 |
+
register_deactivation_hook( __FILE__, 'deactivate_dsm_supreme_modules_for_divi' );
|
56 |
+
|
57 |
+
/**
|
58 |
+
* The core plugin class that is used to define internationalization,
|
59 |
+
* admin-specific hooks, and public-facing site hooks.
|
60 |
+
*/
|
61 |
+
require plugin_dir_path( __FILE__ ) . 'includes/class-dsm-supreme-modules-for-divi.php';
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Begins execution of the plugin.
|
65 |
+
*
|
66 |
+
* Since everything within the plugin is registered via hooks,
|
67 |
+
* then kicking off the plugin from this point in the file does
|
68 |
+
* not affect the page life cycle.
|
69 |
+
*
|
70 |
+
* @since 1.0.0
|
71 |
+
*/
|
72 |
+
function run_dsm_supreme_modules_for_divi() {
|
73 |
+
$plugin = new Dsm_Supreme_Modules_For_Divi();
|
74 |
+
$plugin->run();
|
75 |
+
}
|
76 |
+
if ( is_plugin_active('supreme-modules-pro-for-divi/supreme-modules-pro-for-divi.php') ) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
if ( version_compare(PHP_VERSION, '5.6', '<') ) {
|
80 |
+
if ( ! function_exists( 'dsm_admin_notice__php_version_error' ) ):
|
81 |
+
function dsm_admin_notice__php_version_error() { ?>
|
82 |
+
<div class="notice notice-error">
|
83 |
+
<p><?php _e( "Goodness! Your PHP version is either too old or not recommended to use Divi Supreme! We are not going to load anything on your WordPress unless you update your PHP. Do you know by using Divi Supreme, you can create even more stunning and amazing site with it? Learn more about the WordPress requirements <a href='https://wordpress.org/about/requirements/'>here</a>.<br><br>Current PHP version is: <span style='color:red; font-weight: bold;'>" . PHP_VERSION . "</span><br><span style='color:green; font-weight: bold;''>Recommended PHP version</span>: 7 and above but 5.6 is fine too but why use an older version? Unless you're not living in the future.", 'dsm-supreme-modules-for-divi' ); ?></p>
|
84 |
+
</div>
|
85 |
+
<?php
|
86 |
+
}
|
87 |
+
add_action( 'admin_notices', 'dsm_admin_notice__php_version_error' );
|
88 |
+
return;
|
89 |
+
endif;
|
90 |
} else {
|
91 |
+
run_dsm_supreme_modules_for_divi();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
uninstall.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired when the plugin is uninstalled.
|
5 |
+
*
|
6 |
+
* When populating this file, consider the following flow
|
7 |
+
* of control:
|
8 |
+
*
|
9 |
+
* - This method should be static
|
10 |
+
* - Check if the $_REQUEST content actually is the plugin name
|
11 |
+
* - Run an admin referrer check to make sure it goes through authentication
|
12 |
+
* - Verify the output of $_GET makes sense
|
13 |
+
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
14 |
+
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
15 |
+
*
|
16 |
+
* This file may be updated more in future version of the Boilerplate; however, this is the
|
17 |
+
* general skeleton and outline for how the file should work.
|
18 |
+
*
|
19 |
+
* For more information, see the following discussion:
|
20 |
+
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
21 |
+
*
|
22 |
+
* @link https://suprememodules.com/about-us/
|
23 |
+
* @since 1.0.0
|
24 |
+
*
|
25 |
+
* @package Dsm_Supreme_Modules_For_Divi
|
26 |
+
*/
|
27 |
+
|
28 |
+
// If uninstall not called from WordPress, then exit.
|
29 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
30 |
+
exit;
|
31 |
+
}
|