Version Description
- 18.08.2022 -
- Fixed: strongValidation error on front form ( https://github.com/WPChill/strong-testimonials/issues/326 )
- Added: Advanced settings tab and logging system
Download this release
Release Info
Developer | raldea89 |
Plugin | Strong Testimonials |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.0 to 3.0.1
- admin/class-strong-testimonials-admin-scripts.php +13 -0
- admin/class-strong-testimonials-upsell.php +6 -0
- admin/css/logs.css +15 -0
- admin/img/logo-long.svg +0 -0
- admin/settings/class-strong-testimonials-advanced-settings.php +55 -0
- admin/settings/partials/advanced-settings.php +23 -0
- admin/views.php +3 -0
- changelog.txt +3 -0
- includes/class-strong-testimonials-order.php +3 -0
- includes/class-strong-view-display.php +0 -2
- includes/class-strong-view-slideshow.php +1 -1
- includes/logs/class-strong-testimonials-logger.php +401 -0
- includes/logs/html-strong-testimonials-logs-viewer.php +84 -0
- includes/submodules/banner/assets/css/wpchill-welcome.css +364 -369
- includes/submodules/banner/assets/img/star.svg +12 -12
- includes/submodules/banner/class-wpchill-welcome.php +260 -260
- includes/submodules/banner/readme.txt +1 -1
- public/js/controller.min.js +1 -383
- public/js/lib/form-validation/form-validation.js +247 -244
- public/js/lib/form-validation/form-validation.min.js +1 -1
- readme.txt +955 -2
- strong-testimonials.php +5 -2
admin/class-strong-testimonials-admin-scripts.php
CHANGED
@@ -29,6 +29,7 @@ class Strong_Testimonials_Admin_Scripts {
|
|
29 |
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'admin_settings' ) );
|
30 |
add_action( 'admin_print_styles-wpm-testimonial_page_about-strong-testimonials', array( __CLASS__, 'admin_about' ) );
|
31 |
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-shortcodes', array( __CLASS__, 'admin_shortcodes' ) );
|
|
|
32 |
|
33 |
add_action( 'load-edit.php', array( __CLASS__, 'admin_load_edit' ) );
|
34 |
add_action( 'load-post.php', array( __CLASS__, 'admin_load_post' ) );
|
@@ -229,6 +230,11 @@ class Strong_Testimonials_Admin_Scripts {
|
|
229 |
array( 'jquery' ),
|
230 |
$plugin_version,
|
231 |
true );
|
|
|
|
|
|
|
|
|
|
|
232 |
}
|
233 |
|
234 |
/**
|
@@ -359,6 +365,13 @@ class Strong_Testimonials_Admin_Scripts {
|
|
359 |
}
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
/**
|
363 |
* Categories
|
364 |
*/
|
29 |
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'admin_settings' ) );
|
30 |
add_action( 'admin_print_styles-wpm-testimonial_page_about-strong-testimonials', array( __CLASS__, 'admin_about' ) );
|
31 |
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-shortcodes', array( __CLASS__, 'admin_shortcodes' ) );
|
32 |
+
add_action( 'admin_print_styles-wpm-testimonial_page_strong-testimonials-logs', array( __CLASS__, 'admin_logs_view' ) );
|
33 |
|
34 |
add_action( 'load-edit.php', array( __CLASS__, 'admin_load_edit' ) );
|
35 |
add_action( 'load-post.php', array( __CLASS__, 'admin_load_post' ) );
|
230 |
array( 'jquery' ),
|
231 |
$plugin_version,
|
232 |
true );
|
233 |
+
|
234 |
+
wp_register_style( 'wpmtst-logs-style',
|
235 |
+
WPMTST_ADMIN_URL . 'css/logs.css',
|
236 |
+
array(),
|
237 |
+
$plugin_version );
|
238 |
}
|
239 |
|
240 |
/**
|
365 |
}
|
366 |
}
|
367 |
|
368 |
+
/**
|
369 |
+
* Logs View
|
370 |
+
*/
|
371 |
+
public static function admin_logs_view(){
|
372 |
+
wp_enqueue_style( 'wpmtst-logs-style' );
|
373 |
+
}
|
374 |
+
|
375 |
/**
|
376 |
* Categories
|
377 |
*/
|
admin/class-strong-testimonials-upsell.php
CHANGED
@@ -120,6 +120,12 @@ class Strong_Testimonials_Upsell {
|
|
120 |
|
121 |
|
122 |
if ( ! defined( 'WPMTST_IMPORTER_VERSION' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
add_meta_box(
|
124 |
'wpmtst-importer-upsell', // Unique ID
|
125 |
esc_html__( 'Import', 'strong-testimonials' ), // Title
|
120 |
|
121 |
|
122 |
if ( ! defined( 'WPMTST_IMPORTER_VERSION' ) ) {
|
123 |
+
|
124 |
+
// remove "submitdiv" metabox so we can add it back in desired order.
|
125 |
+
$post_type = 'wpm-testimonial';
|
126 |
+
remove_meta_box( 'post_submit_meta_box', $post_type, 'side' );
|
127 |
+
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $post_type, 'side', 'high' );
|
128 |
+
|
129 |
add_meta_box(
|
130 |
'wpmtst-importer-upsell', // Unique ID
|
131 |
esc_html__( 'Import', 'strong-testimonials' ), // Title
|
admin/css/logs.css
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* The logs view screen
|
2 |
+
-----------------------------------------------*/
|
3 |
+
|
4 |
+
.wrap.wpmtst #log-viewer pre {
|
5 |
+
font-family: monospace;
|
6 |
+
white-space: pre-wrap;
|
7 |
+
word-wrap: break-word;
|
8 |
+
}
|
9 |
+
.wrap.wpmtst #log-viewer {
|
10 |
+
background: #fff;
|
11 |
+
border: 1px solid #e5e5e5;
|
12 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
13 |
+
padding: 5px 20px;
|
14 |
+
margin-top: 6px;
|
15 |
+
}
|
admin/img/logo-long.svg
CHANGED
File without changes
|
admin/settings/class-strong-testimonials-advanced-settings.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Strong_Testimonials_Advanced_Settings{
|
4 |
+
const TAB_NAME = 'Advanced Settings';
|
5 |
+
const OPTION_NAME = 'strong_testimonials_advanced_settings';
|
6 |
+
const GROUP_NAME = 'wpmtst-advanced-settings-group';
|
7 |
+
|
8 |
+
public static function init()
|
9 |
+
{
|
10 |
+
add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
|
11 |
+
add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 90, 2 );
|
12 |
+
add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
|
13 |
+
}
|
14 |
+
/**
|
15 |
+
* Register settings tab.
|
16 |
+
*
|
17 |
+
* @param $active_tab
|
18 |
+
* @param $url
|
19 |
+
*/
|
20 |
+
public static function register_tab( $active_tab, $url ) {
|
21 |
+
printf( '<a href="%s" class="nav-tab %s">%s</a>',
|
22 |
+
esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
|
23 |
+
esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
|
24 |
+
esc_html__( 'Advanced Settings', 'strong-testimonials' )
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Register settings.
|
30 |
+
*/
|
31 |
+
public static function register_settings() {
|
32 |
+
register_setting( self::GROUP_NAME, self::OPTION_NAME );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Register settings page.
|
37 |
+
*
|
38 |
+
* @param $pages
|
39 |
+
*
|
40 |
+
* @return mixed
|
41 |
+
*/
|
42 |
+
public static function register_settings_page( $pages ) {
|
43 |
+
$pages[ self::TAB_NAME ] = array( __CLASS__, 'settings_page' );
|
44 |
+
return $pages;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Print settings page.
|
49 |
+
*/
|
50 |
+
public static function settings_page() {
|
51 |
+
settings_fields( self::GROUP_NAME );
|
52 |
+
include( plugin_dir_path( __FILE__ ) . 'partials/advanced-settings.php' );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
Strong_Testimonials_Advanced_Settings::init();
|
admin/settings/partials/advanced-settings.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$options = get_option( 'strong_testimonials_advanced_settings' );
|
4 |
+
|
5 |
+
?>
|
6 |
+
<div class="row">
|
7 |
+
<table class="form-table">
|
8 |
+
<tbody>
|
9 |
+
<tr valign="top">
|
10 |
+
<th scope="row" valign="top">
|
11 |
+
<?php esc_html_e( 'Debug log', 'strong-testimonials' ); ?>
|
12 |
+
</th>
|
13 |
+
<td>
|
14 |
+
<input id="strong_testimonials_debug_log_enable" name="strong_testimonials_advanced_settings[debug_log]" type="checkbox" <?php echo ( isset($options['debug_log']) && $options['debug_log'] == 'on' ? 'checked' : '') ; ?>/>
|
15 |
+
<label class="description strong-testimonials-license-label" for="strong_testimonials_license_key"> <?php esc_html_e( 'Enable debug log. Off by default.', 'strong-testimonials' ); ?> </label>
|
16 |
+
<p class="description"><?php esc_html_e( 'Creates debug logs for Strong Testimonial module and it \'s addons.', 'strong-testimonials' ); ?> </p>
|
17 |
+
</td>
|
18 |
+
</tr>
|
19 |
+
|
20 |
+
</tbody>
|
21 |
+
</table>
|
22 |
+
<p class="submit-buttons"><input type="submit" name="submit-form" id="submit-form" class="button button-primary" value="<?php esc_html_e( 'Save changes', 'strong-testimonials' ); ?>"></p>
|
23 |
+
</div>
|
admin/views.php
CHANGED
@@ -739,6 +739,9 @@ function wpmtst_form_category_checklist( $view_cats_array ) {
|
|
739 |
* @since 2.22.0
|
740 |
*/
|
741 |
function wpmtst_save_view_sticky() {
|
|
|
|
|
|
|
742 |
$id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
|
743 |
$stickies = get_option( 'wpmtst_sticky_views', array() );
|
744 |
if ( in_array( $id, $stickies ) ) {
|
739 |
* @since 2.22.0
|
740 |
*/
|
741 |
function wpmtst_save_view_sticky() {
|
742 |
+
if( !current_user_can('edit_posts') ){
|
743 |
+
wp_die();
|
744 |
+
}
|
745 |
$id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
|
746 |
$stickies = get_option( 'wpmtst_sticky_views', array() );
|
747 |
if ( in_array( $id, $stickies ) ) {
|
changelog.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
|
2 |
= 3.0.0 - 18.07.2022 -
|
3 |
- Added: Optional parameter to function wpmtst_get_success_message
|
1 |
+
= 3.0.1 - 18.08.2022 -
|
2 |
+
- Fixed: strongValidation error on front form ( https://github.com/WPChill/strong-testimonials/issues/326 )
|
3 |
+
- Added: Advanced settings tab and logging system
|
4 |
|
5 |
= 3.0.0 - 18.07.2022 -
|
6 |
- Added: Optional parameter to function wpmtst_get_success_message
|
includes/class-strong-testimonials-order.php
CHANGED
@@ -257,6 +257,9 @@ class Strong_Testimonials_Order {
|
|
257 |
* Update menu order in back end.
|
258 |
*/
|
259 |
public static function update_menu_order() {
|
|
|
|
|
|
|
260 |
global $wpdb;
|
261 |
|
262 |
parse_str( $_POST['posts'], $data );
|
257 |
* Update menu order in back end.
|
258 |
*/
|
259 |
public static function update_menu_order() {
|
260 |
+
if( !current_user_can('edit_posts') ){
|
261 |
+
wp_die();
|
262 |
+
}
|
263 |
global $wpdb;
|
264 |
|
265 |
parse_str( $_POST['posts'], $data );
|
includes/class-strong-view-display.php
CHANGED
@@ -46,8 +46,6 @@ class Strong_View_Display extends Strong_View {
|
|
46 |
*/
|
47 |
public function reset_view() {
|
48 |
wp_reset_postdata();
|
49 |
-
remove_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) );
|
50 |
-
remove_filter( 'wpmtst_build_query', array( $this, 'query_infinitescroll' ) );
|
51 |
}
|
52 |
|
53 |
/**
|
46 |
*/
|
47 |
public function reset_view() {
|
48 |
wp_reset_postdata();
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
includes/class-strong-view-slideshow.php
CHANGED
@@ -41,7 +41,7 @@ class Strong_View_Slideshow extends Strong_View_Display {
|
|
41 |
// If we can preprocess, we can add the inline style in the <head>.
|
42 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
|
43 |
|
44 |
-
|
45 |
}
|
46 |
|
47 |
/**
|
41 |
// If we can preprocess, we can add the inline style in the <head>.
|
42 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
|
43 |
|
44 |
+
do_action( 'wpmtst_view_processed' );
|
45 |
}
|
46 |
|
47 |
/**
|
includes/logs/class-strong-testimonials-logger.php
ADDED
@@ -0,0 +1,401 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Strong_File_Logging Class
|
11 |
+
*
|
12 |
+
* A general use class for logging events and errors.
|
13 |
+
*
|
14 |
+
* @since 2.51.7
|
15 |
+
*/
|
16 |
+
class Strong_File_Logging {
|
17 |
+
|
18 |
+
public $is_writable = true;
|
19 |
+
private $filename = '';
|
20 |
+
private $file = '';
|
21 |
+
public $is_logging_enabled = false;
|
22 |
+
/**
|
23 |
+
* Holds the class object.
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
*
|
27 |
+
* @var object
|
28 |
+
*/
|
29 |
+
public static $instance;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns the singleton instance of the class.
|
33 |
+
*
|
34 |
+
* @since 2.51.7
|
35 |
+
*
|
36 |
+
* @return object The Strong_File_Logging object.
|
37 |
+
*/
|
38 |
+
public static function get_instance() {
|
39 |
+
|
40 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Strong_File_Logging ) ) {
|
41 |
+
self::$instance = new Strong_File_Logging();
|
42 |
+
}
|
43 |
+
|
44 |
+
return self::$instance;
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
public function __construct() {
|
49 |
+
|
50 |
+
$this->is_logging_enabled();
|
51 |
+
add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
|
52 |
+
add_action( 'admin_init', array( $this, 'handle_actions' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Add submenu page.
|
57 |
+
*
|
58 |
+
* @param $pages
|
59 |
+
*
|
60 |
+
* @return mixed
|
61 |
+
*
|
62 |
+
* @since 2.51.7
|
63 |
+
*/
|
64 |
+
public function add_submenu( $pages ) {
|
65 |
+
$pages[90] = $this->get_submenu();
|
66 |
+
return $pages;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return submenu page parameters.
|
71 |
+
*
|
72 |
+
* @return array
|
73 |
+
*
|
74 |
+
* @since 2.51.7
|
75 |
+
*/
|
76 |
+
public function get_submenu() {
|
77 |
+
return array(
|
78 |
+
'page_title' => esc_html__( 'Logs', 'strong-testimonials' ),
|
79 |
+
'menu_title' => esc_html__( 'Logs', 'strong-testimonials' ),
|
80 |
+
'capability' => 'strong_testimonials_options',
|
81 |
+
'menu_slug' => 'strong-testimonials-logs',
|
82 |
+
'function' => array( $this, 'status_logs_file' ),
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Check if logging is enabled
|
88 |
+
*
|
89 |
+
* @since 2.51.7
|
90 |
+
*/
|
91 |
+
public function is_logging_enabled() {
|
92 |
+
$options = get_option( 'strong_testimonials_advanced_settings' );
|
93 |
+
if ( isset( $options['debug_log'] ) && 'on' === $options['debug_log'] ) {
|
94 |
+
$this->is_logging_enabled = true;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Return the log file handle.
|
100 |
+
*
|
101 |
+
* @param string $filename Filename to get the handle for.
|
102 |
+
* @return string
|
103 |
+
*
|
104 |
+
* @since 2.51.7
|
105 |
+
*/
|
106 |
+
public static function get_log_file_handle( $filename ) {
|
107 |
+
return substr( $filename, 0, strlen( $filename ) > 48 ? strlen( $filename ) - 48 : strlen( $filename ) - 4 );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Scan log files
|
112 |
+
*
|
113 |
+
* @param [type] $path
|
114 |
+
* @return void
|
115 |
+
*
|
116 |
+
* @since 2.51.7
|
117 |
+
*/
|
118 |
+
public static function scan_log_files( $path ) {
|
119 |
+
return @scandir( $path ); // @codingStandardsIgnoreLine
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get all log files in the log directory.
|
124 |
+
*
|
125 |
+
* @return array
|
126 |
+
*
|
127 |
+
* @since 2.51.7
|
128 |
+
*/
|
129 |
+
public function get_log_files() {
|
130 |
+
$files = self::scan_log_files( WPMTST_LOGS );
|
131 |
+
$result = array();
|
132 |
+
|
133 |
+
if ( ! empty( $files ) ) {
|
134 |
+
foreach ( $files as $key => $value ) {
|
135 |
+
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
|
136 |
+
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
|
137 |
+
$result[ sanitize_title( $value ) ] = $value;
|
138 |
+
} elseif ( is_dir( WPMTST_LOGS . $value ) ) {
|
139 |
+
$subfiles = self::scan_log_files( WPMTST_LOGS . $value );
|
140 |
+
if ( ! empty( $subfiles ) ) {
|
141 |
+
foreach ( $subfiles as $key => $subvalue ) {
|
142 |
+
if ( ! in_array( $subvalue, array( '.', '..' ), true ) ) {
|
143 |
+
if ( ! is_dir( $subvalue ) && strstr( $subvalue, '.log' ) ) {
|
144 |
+
$result[ sanitize_title( $subvalue ) ] = $value . '/' . $subvalue;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
return $result;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Handles the delete log and download log actions.
|
159 |
+
*
|
160 |
+
* @since 2.51.7
|
161 |
+
*/
|
162 |
+
public function handle_actions() {
|
163 |
+
|
164 |
+
if ( ! empty( $_REQUEST['remove'] ) ) { // phpcs:ignore input var ok, CSRF ok.
|
165 |
+
$this->remove_log();
|
166 |
+
}
|
167 |
+
|
168 |
+
if ( ! empty( $_REQUEST['download'] ) ) { // phpcs:ignore input var ok, CSRF ok.
|
169 |
+
$this->download_log();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Show the log page contents for file log handler.
|
175 |
+
*
|
176 |
+
* @since 2.51.7
|
177 |
+
*/
|
178 |
+
public function status_logs_file() {
|
179 |
+
$logs = $this->get_log_files();
|
180 |
+
|
181 |
+
if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ] ) ) { // phpcs:ignore input var ok, CSRF ok.
|
182 |
+
$viewed_log = $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ]; // phpcs:ignore input var ok, CSRF ok.
|
183 |
+
} elseif ( ! empty( $logs ) ) {
|
184 |
+
$viewed_log = current( $logs );
|
185 |
+
}
|
186 |
+
|
187 |
+
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
|
188 |
+
|
189 |
+
include_once __DIR__ . '/html-strong-testimonials-logs-viewer.php';
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Remove/delete the chosen file and it's directory.
|
194 |
+
*
|
195 |
+
* @since 2.51.7
|
196 |
+
*/
|
197 |
+
public function remove_log() {
|
198 |
+
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'remove_log' ) ) { // phpcs:ignore input var ok, sanitization ok.
|
199 |
+
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'strong-testimonials' ) );
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( ! empty( $_REQUEST['remove'] ) ) { // phpcs:ignore input var ok.
|
203 |
+
$this->remove( wp_unslash( $_REQUEST['remove'] ), wp_unslash( $_REQUEST['subdir'] ) ); // phpcs:ignore input var ok, sanitization ok.
|
204 |
+
}
|
205 |
+
|
206 |
+
wp_safe_redirect( esc_url_raw( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-logs' ) ) );
|
207 |
+
exit();
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Remove/delete the chosen file and it's directory.
|
212 |
+
*
|
213 |
+
* @param string $handle Log handle.
|
214 |
+
*
|
215 |
+
* @return bool
|
216 |
+
*
|
217 |
+
* @since 2.51.7
|
218 |
+
*/
|
219 |
+
public function remove( $handle, $subdir ) {
|
220 |
+
$removed = false;
|
221 |
+
$logs = $this->get_log_files();
|
222 |
+
$handle = sanitize_title( $handle );
|
223 |
+
$subdir = sanitize_title( $subdir );
|
224 |
+
|
225 |
+
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
|
226 |
+
$file = realpath( trailingslashit( WPMTST_LOGS ) . $logs[ $handle ] );
|
227 |
+
if ( 0 === stripos( $file, realpath( trailingslashit( WPMTST_LOGS ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
228 |
+
$removed = unlink( $file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
|
229 |
+
if ( $subdir != '' ) {
|
230 |
+
rmdir( dirname( $file ) );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
return $removed;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Download the chosen file.
|
239 |
+
*
|
240 |
+
* @since 2.51.7
|
241 |
+
*/
|
242 |
+
public function download_log() {
|
243 |
+
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'download_log' ) ) { // phpcs:ignore input var ok, sanitization ok.
|
244 |
+
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'strong-testimonials' ) );
|
245 |
+
}
|
246 |
+
|
247 |
+
if ( ! empty( $_REQUEST['download'] ) ) { // phpcs:ignore input var ok.
|
248 |
+
$this->download( wp_unslash( $_REQUEST['download'] ), wp_unslash( $_REQUEST['subdir'] ) ); // phpcs:ignore input var ok, sanitization ok.
|
249 |
+
}
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Download the chosen file.
|
255 |
+
*
|
256 |
+
* @param string $handle Log handle.
|
257 |
+
*
|
258 |
+
* @return void
|
259 |
+
*
|
260 |
+
* @since 2.51.7
|
261 |
+
*/
|
262 |
+
public function download( $handle, $subdir ) {
|
263 |
+
$logs = $this->get_log_files();
|
264 |
+
$handle = sanitize_title( $handle );
|
265 |
+
$subdir = sanitize_title( $subdir );
|
266 |
+
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
|
267 |
+
$file = realpath( trailingslashit( WPMTST_LOGS ) . $logs[ $handle ] );
|
268 |
+
if ( 0 === stripos( $file, realpath( trailingslashit( WPMTST_LOGS ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
269 |
+
header( 'Content-Description: File Transfer' );
|
270 |
+
header( 'Content-Type: application/octet-stream' );
|
271 |
+
header( 'Content-Disposition: attachment; filename="' . basename( $file ) . '"' );
|
272 |
+
header( 'Expires: 0' );
|
273 |
+
header( 'Cache-Control: must-revalidate' );
|
274 |
+
header( 'Pragma: public' );
|
275 |
+
header( 'Content-Length: ' . filesize( $file ) );
|
276 |
+
ob_clean();
|
277 |
+
flush();
|
278 |
+
readfile( $file );
|
279 |
+
exit();
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Sets up the log file if it is writable
|
287 |
+
*
|
288 |
+
* @return void
|
289 |
+
*
|
290 |
+
* @since 2.51.7
|
291 |
+
*/
|
292 |
+
public function setup_log_file( $importer ) {
|
293 |
+
$basedir = trailingslashit( WPMTST_LOGS ) . $importer;
|
294 |
+
if ( ! is_dir( $basedir ) ) {
|
295 |
+
mkdir( $basedir, 0777, true );
|
296 |
+
}
|
297 |
+
$this->filename = wp_hash( home_url( '/' ) ) . '-' . $importer . '-st_debug.log';
|
298 |
+
$this->file = $basedir . '/' . $this->filename;
|
299 |
+
if ( ! is_writeable( WPMTST_LOGS ) ) {
|
300 |
+
$this->is_writable = false;
|
301 |
+
}
|
302 |
+
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Retrieve the log data
|
307 |
+
*
|
308 |
+
* @return string
|
309 |
+
*
|
310 |
+
* @since 2.51.7
|
311 |
+
*/
|
312 |
+
public function get_file_contents() {
|
313 |
+
return $this->get_file();
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Log message to file
|
318 |
+
*
|
319 |
+
* @return void
|
320 |
+
*
|
321 |
+
* @since 2.51.7
|
322 |
+
*/
|
323 |
+
public function log_to_file( $message = '' ) {
|
324 |
+
$message = wp_date( 'd-n-Y H:i:s' ) . ' - ' . $message . "\r\n";
|
325 |
+
$this->write_to_log( $message );
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Retrieve the file data is written to
|
331 |
+
*
|
332 |
+
* @return string
|
333 |
+
*
|
334 |
+
* @since 2.51.7
|
335 |
+
*/
|
336 |
+
protected function get_file() {
|
337 |
+
|
338 |
+
$file = '';
|
339 |
+
|
340 |
+
if ( @file_exists( $this->file ) ) {
|
341 |
+
|
342 |
+
if ( ! is_writeable( $this->file ) ) {
|
343 |
+
$this->is_writable = false;
|
344 |
+
}
|
345 |
+
|
346 |
+
$file = @file_get_contents( $this->file );
|
347 |
+
} else {
|
348 |
+
@file_put_contents( $this->file, '' );
|
349 |
+
@chmod( $this->file, 0664 );
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
return $file;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Write the log message
|
358 |
+
*
|
359 |
+
* @return void
|
360 |
+
*
|
361 |
+
* @since 2.51.7
|
362 |
+
*/
|
363 |
+
protected function write_to_log( $message = '' ) {
|
364 |
+
$file = $this->get_file();
|
365 |
+
$file .= $message;
|
366 |
+
@file_put_contents( $this->file, $file );
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Return the location of the log file that Strong_File_Logging will use.
|
371 |
+
*
|
372 |
+
* @return string
|
373 |
+
*
|
374 |
+
* @since 2.51.7
|
375 |
+
*/
|
376 |
+
public function get_log_file_path() {
|
377 |
+
return $this->file;
|
378 |
+
}
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
$GLOBALS['strong_logs'] = Strong_File_Logging::get_instance();
|
383 |
+
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Logs a message to the debug log file
|
387 |
+
*
|
388 |
+
* @param string $message
|
389 |
+
* @global $strong_logs Strong_File_Logging Object
|
390 |
+
* @return void
|
391 |
+
*
|
392 |
+
* @since 2.51.7
|
393 |
+
*/
|
394 |
+
function ST_debug_log( $importer = '', $message = '' ) {
|
395 |
+
global $strong_logs;
|
396 |
+
if ( $strong_logs->is_logging_enabled ) {
|
397 |
+
$strong_logs->setup_log_file( $importer );
|
398 |
+
$strong_logs->log_to_file( $message );
|
399 |
+
}
|
400 |
+
|
401 |
+
}
|
includes/logs/html-strong-testimonials-logs-viewer.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
if ( $logs ) : ?>
|
6 |
+
<div class="wrap wpmtst">
|
7 |
+
|
8 |
+
<h1><?php esc_html_e( 'Strong Testimonials Debug Logs', 'strong-testimonials' ); ?></h1>
|
9 |
+
<div id="log-viewer-select">
|
10 |
+
<div class="alignleft">
|
11 |
+
<h2>
|
12 |
+
<?php echo esc_html( $viewed_log ); ?>
|
13 |
+
<?php
|
14 |
+
$subfolder = '';
|
15 |
+
if ( strpos( $viewed_log, '/' ) ) {
|
16 |
+
$subfolder = explode( '/', $viewed_log )[0];
|
17 |
+
$log_name = explode( '/', $viewed_log )[1];
|
18 |
+
} else {
|
19 |
+
$log_name = $viewed_log;
|
20 |
+
}
|
21 |
+
?>
|
22 |
+
<?php if ( ! empty( $viewed_log ) ) : ?>
|
23 |
+
<a class="page-title-action" href="
|
24 |
+
<?php
|
25 |
+
echo esc_url(
|
26 |
+
wp_nonce_url(
|
27 |
+
add_query_arg(
|
28 |
+
array(
|
29 |
+
'remove' => sanitize_title( $log_name ),
|
30 |
+
'subdir' => sanitize_title( $subfolder ),
|
31 |
+
),
|
32 |
+
admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-logs' )
|
33 |
+
),
|
34 |
+
'remove_log'
|
35 |
+
)
|
36 |
+
);
|
37 |
+
?>
|
38 |
+
" class="button"><?php esc_html_e( 'Delete log', 'strong-testimonials' ); ?></a>
|
39 |
+
<a class="page-title-action" href="
|
40 |
+
<?php
|
41 |
+
echo esc_url(
|
42 |
+
wp_nonce_url(
|
43 |
+
add_query_arg(
|
44 |
+
array(
|
45 |
+
'download' => sanitize_title( $log_name ),
|
46 |
+
'subdir' => sanitize_title( $subfolder ),
|
47 |
+
),
|
48 |
+
admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-logs' )
|
49 |
+
),
|
50 |
+
'download_log'
|
51 |
+
)
|
52 |
+
);
|
53 |
+
?>
|
54 |
+
" class="button"><?php esc_html_e( 'Download log', 'strong-testimonials' ); ?></a>
|
55 |
+
<?php endif; ?>
|
56 |
+
</h2>
|
57 |
+
</div>
|
58 |
+
<div class="alignright">
|
59 |
+
<form action="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-logs' ) ); ?>" method="post">
|
60 |
+
<select name="log_file">
|
61 |
+
<?php foreach ( $logs as $log_key => $log_file ) : ?>
|
62 |
+
<?php
|
63 |
+
$timestamp = filemtime( WPMTST_LOGS . $log_file );
|
64 |
+
$date = sprintf(
|
65 |
+
__( '%1$s at %2$s', 'strong-testimonials' ),
|
66 |
+
wp_date( 'd-M-y', $timestamp ),
|
67 |
+
wp_date( 'h:i:s', $timestamp )
|
68 |
+
);
|
69 |
+
?>
|
70 |
+
<option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo esc_html( $date ); ?>)</option>
|
71 |
+
<?php endforeach; ?>
|
72 |
+
</select>
|
73 |
+
<button type="submit" class="button" value="<?php esc_attr_e( 'View', 'strong-testimonials' ); ?>"><?php esc_html_e( 'View', 'strong-testimonials' ); ?></button>
|
74 |
+
</form>
|
75 |
+
</div>
|
76 |
+
<div class="clear"></div>
|
77 |
+
</div>
|
78 |
+
<div id="log-viewer">
|
79 |
+
<pre><?php echo esc_html( file_get_contents( WPMTST_LOGS . $viewed_log ) ); ?></pre>
|
80 |
+
</div>
|
81 |
+
<?php else : ?>
|
82 |
+
<div class="updated inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'strong-testimonials' ); ?></p></div>
|
83 |
+
<?php endif; ?>
|
84 |
+
</div>
|
includes/submodules/banner/assets/css/wpchill-welcome.css
CHANGED
@@ -1,370 +1,365 @@
|
|
1 |
-
#
|
2 |
-
padding-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
#wpchill-welcome .clear:
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
#wpchill-welcome
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
font-size: 16px;
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
#wpchill-welcome .wpmtst-btn
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
#wpchill-welcome .button-wrap {
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
padding-
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
#wpchill-welcome .block-row-
|
192 |
-
padding-right: 22px;
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
#wpchill-welcome .
|
257 |
-
color:
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
#wpchill-welcome .upgrade {
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
}
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
.wpchill_horizontal_delimiter {
|
366 |
-
background-color: #f0f0f1;
|
367 |
-
height:20px;
|
368 |
-
width:100%;
|
369 |
-
margin:0 auto;
|
370 |
}
|
1 |
+
#wpchill-welcome {
|
2 |
+
padding-top: 80px;
|
3 |
+
}
|
4 |
+
|
5 |
+
#wpchill-welcome *, #wpchill-welcome *::before, #wpchill-welcome *::after {
|
6 |
+
-webkit-box-sizing: border-box;
|
7 |
+
-moz-box-sizing: border-box;
|
8 |
+
box-sizing: border-box;
|
9 |
+
}
|
10 |
+
|
11 |
+
#wpchill-welcome .clear:before {
|
12 |
+
content: " ";
|
13 |
+
display: table;
|
14 |
+
}
|
15 |
+
|
16 |
+
#wpchill-welcome .clear:after {
|
17 |
+
clear: both;
|
18 |
+
content: " ";
|
19 |
+
display: table;
|
20 |
+
}
|
21 |
+
|
22 |
+
#wpchill-welcome .container {
|
23 |
+
margin: 0 auto;
|
24 |
+
max-width: 800px;
|
25 |
+
padding: 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
#wpchill-welcome .block {
|
29 |
+
padding: 40px;
|
30 |
+
}
|
31 |
+
|
32 |
+
#wpchill-welcome img {
|
33 |
+
max-width: 100%;
|
34 |
+
height: auto;
|
35 |
+
}
|
36 |
+
|
37 |
+
#wpchill-welcome h1 {
|
38 |
+
color: #222;
|
39 |
+
font-size: 24px;
|
40 |
+
margin: 0 0 16px 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
#wpchill-welcome h5 {
|
44 |
+
color: #222;
|
45 |
+
font-size: 16px;
|
46 |
+
margin: 0 0 8px 0;
|
47 |
+
}
|
48 |
+
|
49 |
+
#wpchill-welcome h6 {
|
50 |
+
font-size: 16px;
|
51 |
+
font-weight: 400;
|
52 |
+
line-height: 1.6;
|
53 |
+
margin: 0;
|
54 |
+
}
|
55 |
+
|
56 |
+
#wpchill-welcome .wpmtst-btn-lg {
|
57 |
+
font-size: 16px;
|
58 |
+
font-weight: 600;
|
59 |
+
padding: 16px 28px;
|
60 |
+
}
|
61 |
+
|
62 |
+
#wpchill-welcome .wpmtst-btn-block {
|
63 |
+
display: block;
|
64 |
+
width: 100%;
|
65 |
+
}
|
66 |
+
|
67 |
+
#wpchill-welcome .wpmtst-btn {
|
68 |
+
border: 0;
|
69 |
+
border-radius: 40px;
|
70 |
+
cursor: pointer;
|
71 |
+
display: inline-block;
|
72 |
+
margin: 0;
|
73 |
+
text-decoration: none;
|
74 |
+
text-align: center;
|
75 |
+
vertical-align: middle;
|
76 |
+
white-space: nowrap;
|
77 |
+
box-shadow: none;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
#wpchill-welcome .button-wrap {
|
82 |
+
max-width: 590px;
|
83 |
+
margin: 0 auto 0 auto;
|
84 |
+
}
|
85 |
+
|
86 |
+
#wpchill-welcome .button-wrap .left {
|
87 |
+
margin-bottom: 10px;
|
88 |
+
}
|
89 |
+
|
90 |
+
#wpchill-welcome .button-wrap-single a {
|
91 |
+
font-size: 14px;
|
92 |
+
}
|
93 |
+
|
94 |
+
#wpchill-welcome .button-wrap-single {
|
95 |
+
padding: 0 20px;
|
96 |
+
}
|
97 |
+
|
98 |
+
@media screen and (min-width: 720px) {
|
99 |
+
|
100 |
+
#wpchill-welcome .button-wrap .left {
|
101 |
+
margin-bottom: 0px;
|
102 |
+
float: left;
|
103 |
+
width: 50%;
|
104 |
+
padding-right: 20px;
|
105 |
+
}
|
106 |
+
|
107 |
+
#wpchill-welcome .button-wrap .right {
|
108 |
+
float: right;
|
109 |
+
width: 50%;
|
110 |
+
padding-left: 20px;
|
111 |
+
}
|
112 |
+
|
113 |
+
#wpchill-welcome .button-wrap-single a {
|
114 |
+
font-size: 16px;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/* hero section */
|
119 |
+
#wpchill-welcome .hero {
|
120 |
+
background-color: #fff;
|
121 |
+
border-radius: 10px;
|
122 |
+
margin-bottom: 30px;
|
123 |
+
position: relative;
|
124 |
+
box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
|
125 |
+
padding-top: 40px;
|
126 |
+
}
|
127 |
+
|
128 |
+
#wpchill-welcome .hero .mascot {
|
129 |
+
background-color: #fff;
|
130 |
+
border-radius: 50%;
|
131 |
+
height: 90px;
|
132 |
+
width: 90px;
|
133 |
+
padding: 28px 28px;
|
134 |
+
position: absolute;
|
135 |
+
top: -45px;
|
136 |
+
left: 50%;
|
137 |
+
margin-left: -45px;
|
138 |
+
}
|
139 |
+
|
140 |
+
#wpchill-welcome .hero .video-thumbnail {
|
141 |
+
display: block;
|
142 |
+
margin: 0;
|
143 |
+
width: 100%;
|
144 |
+
}
|
145 |
+
|
146 |
+
#wpchill-welcome .hero .button-wrap {
|
147 |
+
margin-top: 20px;
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
/* features section */
|
152 |
+
#wpchill-welcome .features {
|
153 |
+
background-color: #fff;
|
154 |
+
border-top-left-radius: 10px;
|
155 |
+
border-top-right-radius: 10px;
|
156 |
+
position: relative;
|
157 |
+
padding-top: 20px;
|
158 |
+
}
|
159 |
+
|
160 |
+
#wpchill-welcome .features .feature-list {
|
161 |
+
margin-top: 40px;
|
162 |
+
}
|
163 |
+
|
164 |
+
#wpchill-welcome .features .feature-block {
|
165 |
+
margin-bottom: 30px;
|
166 |
+
}
|
167 |
+
|
168 |
+
@media screen and (min-width: 720px) {
|
169 |
+
|
170 |
+
#wpchill-welcome .block-row-2 .feature-block {
|
171 |
+
margin: 0 auto;
|
172 |
+
float: left;
|
173 |
+
width: 50%;
|
174 |
+
padding-bottom: 32px;
|
175 |
+
overflow: auto;
|
176 |
+
}
|
177 |
+
|
178 |
+
#wpchill-welcome .block-row-3 .feature-block {
|
179 |
+
margin: 0 auto;
|
180 |
+
float: left;
|
181 |
+
width: 33%;
|
182 |
+
padding-bottom: 32px;
|
183 |
+
overflow: auto;
|
184 |
+
}
|
185 |
+
|
186 |
+
#wpchill-welcome .block-row-2 .feature-block:nth-child(odd) {
|
187 |
+
padding-right: 22px;
|
188 |
+
clear: both;
|
189 |
+
}
|
190 |
+
|
191 |
+
#wpchill-welcome .block-row-3 .feature-block:not(:nth-child(3n+3)) {
|
192 |
+
padding-right: 22px;
|
193 |
+
}
|
194 |
+
|
195 |
+
#wpchill-welcome .block-row-3 .feature-block:nth-child(3n+1) {
|
196 |
+
clear: both;
|
197 |
+
}
|
198 |
+
|
199 |
+
#wpchill-welcome .features .feature-block.last {
|
200 |
+
padding-left: 22px;
|
201 |
+
}
|
202 |
+
.block-row-1 > * {
|
203 |
+
width: 100%;
|
204 |
+
}
|
205 |
+
.block-row{
|
206 |
+
display:flex;
|
207 |
+
flex-wrap:wrap;
|
208 |
+
align-items:flex-start;
|
209 |
+
flex-direction: row;
|
210 |
+
justify-content: flex-start;
|
211 |
+
}
|
212 |
+
|
213 |
+
.block-row-2 > * {
|
214 |
+
width: 50%;
|
215 |
+
}
|
216 |
+
|
217 |
+
.block-row-3 > * {
|
218 |
+
width: 33%;
|
219 |
+
}
|
220 |
+
|
221 |
+
.block-row-4 > * {
|
222 |
+
width: 25%;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
#wpchill-welcome .features .feature-block img {
|
227 |
+
float: left;
|
228 |
+
max-width: 44px;
|
229 |
+
max-height: 44px;
|
230 |
+
}
|
231 |
+
|
232 |
+
#wpchill-welcome .features .feature-block h5 {
|
233 |
+
margin-left: 70px;
|
234 |
+
}
|
235 |
+
|
236 |
+
#wpchill-welcome .features .feature-block p {
|
237 |
+
margin-left: 70px;
|
238 |
+
}
|
239 |
+
|
240 |
+
#wpchill-welcome .features .pro-label {
|
241 |
+
display: inline-block;
|
242 |
+
line-height: 1;
|
243 |
+
color: #fff;
|
244 |
+
padding: 3px 6px;
|
245 |
+
font-size: 0.75rem;
|
246 |
+
border-radius: 20px;
|
247 |
+
vertical-align: text-top;
|
248 |
+
margin-left: 20px;
|
249 |
+
}
|
250 |
+
|
251 |
+
#wpchill-welcome .features .feature-list a {
|
252 |
+
color: #5333ED;
|
253 |
+
}
|
254 |
+
|
255 |
+
/* upgrade section */
|
256 |
+
#wpchill-welcome .upgrade {
|
257 |
+
background-color: white;
|
258 |
+
text-align: center;
|
259 |
+
}
|
260 |
+
|
261 |
+
#wpchill-welcome .upgrade h1{
|
262 |
+
color: #fff;
|
263 |
+
}
|
264 |
+
|
265 |
+
@media screen and (min-width: 720px) {
|
266 |
+
|
267 |
+
#wpchill-welcome .upgrade .left{
|
268 |
+
float: left;
|
269 |
+
width: 50%;
|
270 |
+
padding-left: 20%;
|
271 |
+
margin-bottom: 30px;
|
272 |
+
text-align: left;
|
273 |
+
}
|
274 |
+
|
275 |
+
#wpchill-welcome .upgrade .right{
|
276 |
+
float: left;
|
277 |
+
width: 50%;
|
278 |
+
padding-right: 20%;
|
279 |
+
margin-bottom: 30px;
|
280 |
+
text-align: left;
|
281 |
+
}
|
282 |
+
#wpchill-welcome .button-wrap-single{
|
283 |
+
width: 50%;
|
284 |
+
margin: 0 auto;
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
/* testimonials section */
|
289 |
+
#wpchill-welcome .testimonials {
|
290 |
+
background-color: #fafafa;
|
291 |
+
|
292 |
+
position: relative;
|
293 |
+
box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
|
294 |
+
}
|
295 |
+
|
296 |
+
#wpchill-welcome .testimonials .testimonial-block {
|
297 |
+
padding: 0 16px 32px;
|
298 |
+
overflow: auto;
|
299 |
+
margin-top: 40px;
|
300 |
+
text-align: center;
|
301 |
+
}
|
302 |
+
|
303 |
+
@media screen and (min-width: 720px) {
|
304 |
+
|
305 |
+
#wpchill-welcome .testimonials .testimonial-block {
|
306 |
+
float: left;
|
307 |
+
width: 50%;
|
308 |
+
}
|
309 |
+
|
310 |
+
}
|
311 |
+
|
312 |
+
#wpchill-welcome .testimonials .testimonial-block p {
|
313 |
+
font-size: 14px;
|
314 |
+
font-weight: 400;
|
315 |
+
line-height: 1.6;
|
316 |
+
}
|
317 |
+
|
318 |
+
#wpchill-welcome .testimonials .testimonial-block img {
|
319 |
+
max-width: 60px;
|
320 |
+
max-height: 60px;
|
321 |
+
border-radius: 50%;
|
322 |
+
filter: grayscale(100%);
|
323 |
+
box-shadow: 0 0 12px rgba(0,0,0,0.15);
|
324 |
+
}
|
325 |
+
|
326 |
+
/* testimonials footer */
|
327 |
+
#wpchill-welcome .footer {
|
328 |
+
background-color: #fff;
|
329 |
+
border-bottom-left-radius: 10px;
|
330 |
+
border-bottom-right-radius: 10px;
|
331 |
+
margin-bottom: 30px;
|
332 |
+
position: relative;
|
333 |
+
box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
|
334 |
+
}
|
335 |
+
|
336 |
+
#wpchill-welcome .container {
|
337 |
+
position: relative;
|
338 |
+
width: 100%;
|
339 |
+
height: 0;
|
340 |
+
padding-bottom: 56.25%;
|
341 |
+
}
|
342 |
+
|
343 |
+
#wpchill-welcome .video {
|
344 |
+
position: absolute;
|
345 |
+
top: 0;
|
346 |
+
left: 0;
|
347 |
+
width: 100%;
|
348 |
+
height: 100%;
|
349 |
+
}
|
350 |
+
|
351 |
+
#wpchill-welcome .stars_wrapper svg {
|
352 |
+
height: 20px;
|
353 |
+
}
|
354 |
+
|
355 |
+
#wpchill-welcome .wpchill_empty_space{
|
356 |
+
display:block;
|
357 |
+
clear:both;
|
358 |
+
}
|
359 |
+
|
360 |
+
.wpchill_horizontal_delimiter {
|
361 |
+
background-color: #f0f0f1;
|
362 |
+
height:20px;
|
363 |
+
width:100%;
|
364 |
+
margin:0 auto;
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
includes/submodules/banner/assets/img/star.svg
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
-
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
-
viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
|
5 |
-
<style type="text/css">
|
6 |
-
.st0{fill:#5333ED;}
|
7 |
-
</style>
|
8 |
-
<g>
|
9 |
-
<path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
|
10 |
-
c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
|
11 |
-
</g>
|
12 |
-
</svg>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
+
viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
|
5 |
+
<style type="text/css">
|
6 |
+
.st0{fill:#5333ED;}
|
7 |
+
</style>
|
8 |
+
<g>
|
9 |
+
<path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
|
10 |
+
c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
|
11 |
+
</g>
|
12 |
+
</svg>
|
includes/submodules/banner/class-wpchill-welcome.php
CHANGED
@@ -1,260 +1,260 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! class_exists( 'WPChill_Welcome' ) ) {
|
4 |
-
|
5 |
-
class WPChill_Welcome {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Contains the instance of the Class
|
9 |
-
*
|
10 |
-
* @since 1.0.0
|
11 |
-
* @param WPChill_Welcome $instance
|
12 |
-
*/
|
13 |
-
private static $instance = null;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @since 1.0.0
|
17 |
-
* @param string $textdomain - wpchill textdomain
|
18 |
-
*/
|
19 |
-
public $textdomain = 'wpchill';
|
20 |
-
|
21 |
-
private function __construct() {
|
22 |
-
add_action( 'admin_footer', array( $this, 'welcome_style' ) );
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @since 1.0.0
|
27 |
-
* Singleton
|
28 |
-
*/
|
29 |
-
public static function get_instance() {
|
30 |
-
|
31 |
-
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPChill_Welcome ) ) {
|
32 |
-
self::$instance = new WPChill_Welcome();
|
33 |
-
}
|
34 |
-
|
35 |
-
return self::$instance;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @since 1.0.0
|
40 |
-
* Enqueue admin Wellcome style
|
41 |
-
*/
|
42 |
-
public function welcome_style() {
|
43 |
-
wp_register_style( 'wpchill-welcome-style', plugins_url( '/assets/css/wpchill-welcome.css', __FILE__ ), null, '1.0.0' );
|
44 |
-
wp_print_styles( array( 'wpchill-welcome-style' ) );
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @since 1.0.0
|
49 |
-
* Renders buttons
|
50 |
-
*
|
51 |
-
* @param string $text
|
52 |
-
*
|
53 |
-
* @param string $url
|
54 |
-
*
|
55 |
-
* @param bool $fill
|
56 |
-
*
|
57 |
-
* @param string $color
|
58 |
-
*/
|
59 |
-
public function display_button( $text, $link, $fill = true, $color = '#5D3CE4' ) {
|
60 |
-
$style = 'style="background-color:' . sanitize_hex_color( $color ) . ';border-color:' . sanitize_hex_color( $color ) . ';color:#fff;"';
|
61 |
-
echo '<a href="' . esc_attr( $link ) . '" ' . ( $fill ? $style : '' ) . ' class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg">' . esc_html( $text ) . '</a>';
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @since 1.0.0
|
66 |
-
* Renders extension html
|
67 |
-
*
|
68 |
-
* @param string $title
|
69 |
-
*
|
70 |
-
* @param string $description
|
71 |
-
*
|
72 |
-
* @param string $icon (icon URL)
|
73 |
-
*
|
74 |
-
* @param bool $pro
|
75 |
-
*/
|
76 |
-
public function display_extension( $title, $description = '', $icon = '', $pro = false, $pro_color = '#5333ED' ) {
|
77 |
-
|
78 |
-
echo '<div class="feature-block">';
|
79 |
-
if ( '' != $icon ) {
|
80 |
-
echo '<img src="' . esc_attr( $icon ) . '">';
|
81 |
-
}
|
82 |
-
echo '<h5>' . esc_html( $title ) . ( ( $pro ) ? '<div style="background-color:' . esc_attr( $pro_color ) . '" class="pro-label">PRO</div>' : '' ) . '</h5>';
|
83 |
-
echo '<p>' . esc_html( $description ) . '</p>';
|
84 |
-
echo '</div>';
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @since 1.0.0
|
89 |
-
* Displays h1 heading
|
90 |
-
*
|
91 |
-
* @param string $text
|
92 |
-
*
|
93 |
-
* @param string $position
|
94 |
-
*/
|
95 |
-
public function display_heading( $text, $position = 'center' ) {
|
96 |
-
echo '<h1 style="text-align: ' . esc_attr( $position ) . ';" >' . esc_html( $text ) . '</h1>';
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* @since 1.0.0
|
101 |
-
* Displays h6 subheading
|
102 |
-
*
|
103 |
-
* @param string $text
|
104 |
-
*
|
105 |
-
* @param string $position
|
106 |
-
*/
|
107 |
-
public function display_subheading( $text, $position = 'center' ) {
|
108 |
-
echo '<h6 style="text-align: ' . esc_attr( $position ) . '" >' . esc_html( $text ) . '</h6>';
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
/**
|
113 |
-
* @since 1.0.0
|
114 |
-
* Renders testimonial block
|
115 |
-
*
|
116 |
-
* @param string $text
|
117 |
-
*
|
118 |
-
* @param string $icon
|
119 |
-
*
|
120 |
-
* @param string $name
|
121 |
-
*
|
122 |
-
* @param string $job (reviewer's job or company)
|
123 |
-
*/
|
124 |
-
public function display_testimonial( $text, $icon = '', $name = '', $job = '', $star_color = '' ) {
|
125 |
-
|
126 |
-
echo '<div class="testimonial-block">';
|
127 |
-
if ( '' != $icon ) {
|
128 |
-
echo '<img src=" ' . esc_url( $icon ) . ' "/>';
|
129 |
-
}
|
130 |
-
echo '<p>' . esc_html( $text ) . '</p>';
|
131 |
-
|
132 |
-
$this->display_stars( $star_color );
|
133 |
-
|
134 |
-
if ( '' !== $name || '' !== $job ) {
|
135 |
-
echo '<p>';
|
136 |
-
|
137 |
-
if ( '' !== $name ) {
|
138 |
-
echo '<strong>' . esc_html( $name ) . '</strong><br/>';
|
139 |
-
}
|
140 |
-
if ( '' !== $job ) {
|
141 |
-
echo esc_html( $job );
|
142 |
-
}
|
143 |
-
echo '</p>';
|
144 |
-
}
|
145 |
-
|
146 |
-
echo '</div>';
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* @since 1.0.0
|
151 |
-
* Renders a UL list
|
152 |
-
*
|
153 |
-
* @param array $items - array of list items
|
154 |
-
*/
|
155 |
-
public function display_listing( $items ) {
|
156 |
-
echo '<ul>';
|
157 |
-
|
158 |
-
foreach ( $items as $item ) {
|
159 |
-
echo '<li>' . esc_html( $item ) . '</li>';
|
160 |
-
}
|
161 |
-
|
162 |
-
echo '</ul>';
|
163 |
-
}
|
164 |
-
|
165 |
-
|
166 |
-
/**
|
167 |
-
* @since 1.0.0
|
168 |
-
* Renders a UL list
|
169 |
-
*
|
170 |
-
* @param string $url - youtube.com url
|
171 |
-
*/
|
172 |
-
public function display_video( $url ) {
|
173 |
-
parse_str( wp_parse_url( esc_url( $url ), PHP_URL_QUERY ), $video_vars );
|
174 |
-
echo '<div class="container"><iframe src="https://www.youtube.com/embed/' . esc_attr( $video_vars['v'] ) . '" frameborder="0" allowfullscreen class="video"></iframe></div>';
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* @since 1.0.0
|
179 |
-
* Renders rating stars block
|
180 |
-
*
|
181 |
-
* @param string $color - code of the star color fill
|
182 |
-
*/
|
183 |
-
public function display_stars( $color ) {
|
184 |
-
$color = ( '' === $color ) ? '#FFD700' : sanitize_hex_color( $color );
|
185 |
-
$id = wp_rand( 0, 9999999 );
|
186 |
-
$star = '<svg version="1.1" class="svg-' . absint( $id ) . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
|
187 |
-
<g>
|
188 |
-
<path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
|
189 |
-
c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
|
190 |
-
</g>
|
191 |
-
</svg>';
|
192 |
-
|
193 |
-
$svg_args = array(
|
194 |
-
'svg' => array(
|
195 |
-
'class' => true,
|
196 |
-
'aria-hidden' => true,
|
197 |
-
'aria-labelledby' => true,
|
198 |
-
'role' => true,
|
199 |
-
'xmlns' => true,
|
200 |
-
'width' => true,
|
201 |
-
'height' => true,
|
202 |
-
'viewbox' => true, // <= Must be lower case!
|
203 |
-
'id' => true,
|
204 |
-
),
|
205 |
-
'g' => array( 'fill' => true ),
|
206 |
-
'title' => array( 'title' => true ),
|
207 |
-
'path' => array(
|
208 |
-
'd' => true,
|
209 |
-
'fill' => true,
|
210 |
-
),
|
211 |
-
'style' => array( 'type' => true ),
|
212 |
-
);
|
213 |
-
|
214 |
-
echo '<style>';
|
215 |
-
echo '.svg-' . absint( $id ) . '{ fill:' . sanitize_hex_color( $color ) . ';}';
|
216 |
-
echo '</style>';
|
217 |
-
echo '<div class="stars_wrapper">' . wp_kses( $star . $star . $star . $star . $star, $svg_args ) . '</div>';
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* @since 1.0.0
|
222 |
-
* Columns wrapper start
|
223 |
-
*
|
224 |
-
* @param int $cols - # of columns the contained objects should be displayed as. (1/2/3)
|
225 |
-
*/
|
226 |
-
public function layout_start( $cols = 2, $class = '' ) {
|
227 |
-
echo '<div class="' . esc_attr( $class ) . ' block-row block-row-' . absint( $cols ) . '">';
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* @since 1.0.0
|
232 |
-
* Columns wrapper end
|
233 |
-
*/
|
234 |
-
public function layout_end() {
|
235 |
-
echo '</div>';
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* @since 1.0.0
|
240 |
-
* Renders empty space block
|
241 |
-
*
|
242 |
-
* @param int $height - height(px) of space
|
243 |
-
*/
|
244 |
-
public function display_empty_space( $height = 25 ) {
|
245 |
-
|
246 |
-
echo '<div class="wpchill_empty_space" style="height:' . esc_attr( $height ) . 'px;"></div>';
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Horizontal delimiter
|
251 |
-
*
|
252 |
-
* @return void
|
253 |
-
* @since 1.0.0
|
254 |
-
*/
|
255 |
-
public function horizontal_delimiter() {
|
256 |
-
echo '<hr class="wpchill_horizontal_delimiter">';
|
257 |
-
}
|
258 |
-
|
259 |
-
}
|
260 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'WPChill_Welcome' ) ) {
|
4 |
+
|
5 |
+
class WPChill_Welcome {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Contains the instance of the Class
|
9 |
+
*
|
10 |
+
* @since 1.0.0
|
11 |
+
* @param WPChill_Welcome $instance
|
12 |
+
*/
|
13 |
+
private static $instance = null;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @since 1.0.0
|
17 |
+
* @param string $textdomain - wpchill textdomain
|
18 |
+
*/
|
19 |
+
public $textdomain = 'wpchill';
|
20 |
+
|
21 |
+
private function __construct() {
|
22 |
+
add_action( 'admin_footer', array( $this, 'welcome_style' ) );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @since 1.0.0
|
27 |
+
* Singleton
|
28 |
+
*/
|
29 |
+
public static function get_instance() {
|
30 |
+
|
31 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPChill_Welcome ) ) {
|
32 |
+
self::$instance = new WPChill_Welcome();
|
33 |
+
}
|
34 |
+
|
35 |
+
return self::$instance;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @since 1.0.0
|
40 |
+
* Enqueue admin Wellcome style
|
41 |
+
*/
|
42 |
+
public function welcome_style() {
|
43 |
+
wp_register_style( 'wpchill-welcome-style', plugins_url( '/assets/css/wpchill-welcome.css', __FILE__ ), null, '1.0.0' );
|
44 |
+
wp_print_styles( array( 'wpchill-welcome-style' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @since 1.0.0
|
49 |
+
* Renders buttons
|
50 |
+
*
|
51 |
+
* @param string $text
|
52 |
+
*
|
53 |
+
* @param string $url
|
54 |
+
*
|
55 |
+
* @param bool $fill
|
56 |
+
*
|
57 |
+
* @param string $color
|
58 |
+
*/
|
59 |
+
public function display_button( $text, $link, $fill = true, $color = '#5D3CE4' ) {
|
60 |
+
$style = 'style="background-color:' . sanitize_hex_color( $color ) . ';border-color:' . sanitize_hex_color( $color ) . ';color:#fff;"';
|
61 |
+
echo '<a href="' . esc_attr( $link ) . '" ' . ( $fill ? $style : '' ) . ' class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg">' . esc_html( $text ) . '</a>';
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @since 1.0.0
|
66 |
+
* Renders extension html
|
67 |
+
*
|
68 |
+
* @param string $title
|
69 |
+
*
|
70 |
+
* @param string $description
|
71 |
+
*
|
72 |
+
* @param string $icon (icon URL)
|
73 |
+
*
|
74 |
+
* @param bool $pro
|
75 |
+
*/
|
76 |
+
public function display_extension( $title, $description = '', $icon = '', $pro = false, $pro_color = '#5333ED' ) {
|
77 |
+
|
78 |
+
echo '<div class="feature-block">';
|
79 |
+
if ( '' != $icon ) {
|
80 |
+
echo '<img src="' . esc_attr( $icon ) . '">';
|
81 |
+
}
|
82 |
+
echo '<h5>' . esc_html( $title ) . ( ( $pro ) ? '<div style="background-color:' . esc_attr( $pro_color ) . '" class="pro-label">PRO</div>' : '' ) . '</h5>';
|
83 |
+
echo '<p>' . esc_html( $description ) . '</p>';
|
84 |
+
echo '</div>';
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @since 1.0.0
|
89 |
+
* Displays h1 heading
|
90 |
+
*
|
91 |
+
* @param string $text
|
92 |
+
*
|
93 |
+
* @param string $position
|
94 |
+
*/
|
95 |
+
public function display_heading( $text, $position = 'center' ) {
|
96 |
+
echo '<h1 style="text-align: ' . esc_attr( $position ) . ';" >' . esc_html( $text ) . '</h1>';
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @since 1.0.0
|
101 |
+
* Displays h6 subheading
|
102 |
+
*
|
103 |
+
* @param string $text
|
104 |
+
*
|
105 |
+
* @param string $position
|
106 |
+
*/
|
107 |
+
public function display_subheading( $text, $position = 'center' ) {
|
108 |
+
echo '<h6 style="text-align: ' . esc_attr( $position ) . '" >' . esc_html( $text ) . '</h6>';
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @since 1.0.0
|
114 |
+
* Renders testimonial block
|
115 |
+
*
|
116 |
+
* @param string $text
|
117 |
+
*
|
118 |
+
* @param string $icon
|
119 |
+
*
|
120 |
+
* @param string $name
|
121 |
+
*
|
122 |
+
* @param string $job (reviewer's job or company)
|
123 |
+
*/
|
124 |
+
public function display_testimonial( $text, $icon = '', $name = '', $job = '', $star_color = '' ) {
|
125 |
+
|
126 |
+
echo '<div class="testimonial-block">';
|
127 |
+
if ( '' != $icon ) {
|
128 |
+
echo '<img src=" ' . esc_url( $icon ) . ' "/>';
|
129 |
+
}
|
130 |
+
echo '<p>' . esc_html( $text ) . '</p>';
|
131 |
+
|
132 |
+
$this->display_stars( $star_color );
|
133 |
+
|
134 |
+
if ( '' !== $name || '' !== $job ) {
|
135 |
+
echo '<p>';
|
136 |
+
|
137 |
+
if ( '' !== $name ) {
|
138 |
+
echo '<strong>' . esc_html( $name ) . '</strong><br/>';
|
139 |
+
}
|
140 |
+
if ( '' !== $job ) {
|
141 |
+
echo esc_html( $job );
|
142 |
+
}
|
143 |
+
echo '</p>';
|
144 |
+
}
|
145 |
+
|
146 |
+
echo '</div>';
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @since 1.0.0
|
151 |
+
* Renders a UL list
|
152 |
+
*
|
153 |
+
* @param array $items - array of list items
|
154 |
+
*/
|
155 |
+
public function display_listing( $items ) {
|
156 |
+
echo '<ul>';
|
157 |
+
|
158 |
+
foreach ( $items as $item ) {
|
159 |
+
echo '<li>' . esc_html( $item ) . '</li>';
|
160 |
+
}
|
161 |
+
|
162 |
+
echo '</ul>';
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @since 1.0.0
|
168 |
+
* Renders a UL list
|
169 |
+
*
|
170 |
+
* @param string $url - youtube.com url
|
171 |
+
*/
|
172 |
+
public function display_video( $url ) {
|
173 |
+
parse_str( wp_parse_url( esc_url( $url ), PHP_URL_QUERY ), $video_vars );
|
174 |
+
echo '<div class="container"><iframe src="https://www.youtube.com/embed/' . esc_attr( $video_vars['v'] ) . '" frameborder="0" allowfullscreen class="video"></iframe></div>';
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* @since 1.0.0
|
179 |
+
* Renders rating stars block
|
180 |
+
*
|
181 |
+
* @param string $color - code of the star color fill
|
182 |
+
*/
|
183 |
+
public function display_stars( $color ) {
|
184 |
+
$color = ( '' === $color ) ? '#FFD700' : sanitize_hex_color( $color );
|
185 |
+
$id = wp_rand( 0, 9999999 );
|
186 |
+
$star = '<svg version="1.1" class="svg-' . absint( $id ) . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
|
187 |
+
<g>
|
188 |
+
<path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
|
189 |
+
c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
|
190 |
+
</g>
|
191 |
+
</svg>';
|
192 |
+
|
193 |
+
$svg_args = array(
|
194 |
+
'svg' => array(
|
195 |
+
'class' => true,
|
196 |
+
'aria-hidden' => true,
|
197 |
+
'aria-labelledby' => true,
|
198 |
+
'role' => true,
|
199 |
+
'xmlns' => true,
|
200 |
+
'width' => true,
|
201 |
+
'height' => true,
|
202 |
+
'viewbox' => true, // <= Must be lower case!
|
203 |
+
'id' => true,
|
204 |
+
),
|
205 |
+
'g' => array( 'fill' => true ),
|
206 |
+
'title' => array( 'title' => true ),
|
207 |
+
'path' => array(
|
208 |
+
'd' => true,
|
209 |
+
'fill' => true,
|
210 |
+
),
|
211 |
+
'style' => array( 'type' => true ),
|
212 |
+
);
|
213 |
+
|
214 |
+
echo '<style>';
|
215 |
+
echo '.svg-' . absint( $id ) . '{ fill:' . sanitize_hex_color( $color ) . ';}';
|
216 |
+
echo '</style>';
|
217 |
+
echo '<div class="stars_wrapper">' . wp_kses( $star . $star . $star . $star . $star, $svg_args ) . '</div>';
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* @since 1.0.0
|
222 |
+
* Columns wrapper start
|
223 |
+
*
|
224 |
+
* @param int $cols - # of columns the contained objects should be displayed as. (1/2/3)
|
225 |
+
*/
|
226 |
+
public function layout_start( $cols = 2, $class = '' ) {
|
227 |
+
echo '<div class="' . esc_attr( $class ) . ' block-row block-row-' . absint( $cols ) . '">';
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* @since 1.0.0
|
232 |
+
* Columns wrapper end
|
233 |
+
*/
|
234 |
+
public function layout_end() {
|
235 |
+
echo '</div>';
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* @since 1.0.0
|
240 |
+
* Renders empty space block
|
241 |
+
*
|
242 |
+
* @param int $height - height(px) of space
|
243 |
+
*/
|
244 |
+
public function display_empty_space( $height = 25 ) {
|
245 |
+
|
246 |
+
echo '<div class="wpchill_empty_space" style="height:' . esc_attr( $height ) . 'px;"></div>';
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Horizontal delimiter
|
251 |
+
*
|
252 |
+
* @return void
|
253 |
+
* @since 1.0.0
|
254 |
+
*/
|
255 |
+
public function horizontal_delimiter() {
|
256 |
+
echo '<hr class="wpchill_horizontal_delimiter">';
|
257 |
+
}
|
258 |
+
|
259 |
+
}
|
260 |
+
}
|
includes/submodules/banner/readme.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
Readme
|
1 |
+
Readme
|
public/js/controller.min.js
CHANGED
@@ -1,383 +1 @@
|
|
1 |
-
|
2 |
-
* Component Controller
|
3 |
-
*
|
4 |
-
* Version 1.2
|
5 |
-
* For Strong Testimonials version 2.31
|
6 |
-
*
|
7 |
-
* @namespace window.strongControllerParms
|
8 |
-
*/
|
9 |
-
|
10 |
-
'use strict';
|
11 |
-
var debugit = false;
|
12 |
-
|
13 |
-
var strongController = {
|
14 |
-
|
15 |
-
grids: {},
|
16 |
-
|
17 |
-
iframes: {},
|
18 |
-
|
19 |
-
defaults: {
|
20 |
-
initializeOn: 'windowLoad',
|
21 |
-
method: '',
|
22 |
-
universalTimer: 500,
|
23 |
-
observerTimer: 500,
|
24 |
-
containerId: 'page', // = what we listen to (try page > content > primary)
|
25 |
-
addedNodeId: 'content', // = what we listen for
|
26 |
-
event: '',
|
27 |
-
script: '',
|
28 |
-
debug: false
|
29 |
-
},
|
30 |
-
|
31 |
-
config: {},
|
32 |
-
|
33 |
-
setup: function (settings) {
|
34 |
-
// Convert strings to integers
|
35 |
-
settings.universalTimer = parseInt(settings.universalTimer);
|
36 |
-
settings.observerTimer = parseInt(settings.observerTimer);
|
37 |
-
// Convert strings to booleans
|
38 |
-
settings.debug = !!settings.debug;
|
39 |
-
debugit = settings.debug;
|
40 |
-
this.config = jQuery.extend({}, this.defaults, settings);
|
41 |
-
},
|
42 |
-
|
43 |
-
mutationObserver: window.MutationObserver || window.WebKitMutationObserver,
|
44 |
-
|
45 |
-
eventListenerSupported: window.addEventListener,
|
46 |
-
|
47 |
-
checkInit: function () {
|
48 |
-
return jQuery('.strong-view[data-state="idle"]').length;
|
49 |
-
},
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Initialize sliders.
|
53 |
-
*/
|
54 |
-
initSliders: function () {
|
55 |
-
var sliders = jQuery('.strong-view.slider-container[data-state="idle"]');
|
56 |
-
if (debugit) console.log('sliders found:', sliders.length);
|
57 |
-
if (sliders.length) {
|
58 |
-
// Initialize independently
|
59 |
-
sliders.each(function () {
|
60 |
-
|
61 |
-
var $slider = jQuery(this);
|
62 |
-
|
63 |
-
// don't init if it's only a single testimonial
|
64 |
-
var count = $slider.data('count');
|
65 |
-
if( count !== undefined && count === 1 ) {
|
66 |
-
return;
|
67 |
-
}
|
68 |
-
|
69 |
-
$slider.strongSlider();
|
70 |
-
});
|
71 |
-
}
|
72 |
-
},
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Initialize paginated views.
|
76 |
-
*/
|
77 |
-
initPagers: function () {
|
78 |
-
var pagers = jQuery('.strong-pager[data-state="idle"]');
|
79 |
-
if (debugit) console.log('pagers found:', pagers.length);
|
80 |
-
if (pagers.length) {
|
81 |
-
pagers.each(function () {
|
82 |
-
jQuery(this).strongPager();
|
83 |
-
});
|
84 |
-
}
|
85 |
-
},
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Initialize layouts.
|
89 |
-
*/
|
90 |
-
initLayouts: function () {
|
91 |
-
/*
|
92 |
-
* Masonry
|
93 |
-
*/
|
94 |
-
this.grids = jQuery('.strong-view[data-state="idle"] .strong-masonry');
|
95 |
-
if (debugit) console.log('Masonry found:', this.grids.length);
|
96 |
-
if (this.grids.length) {
|
97 |
-
// Add our element sizing.
|
98 |
-
this.grids.prepend('<div class="grid-sizer"></div><div class="gutter-sizer"></div>');
|
99 |
-
|
100 |
-
// Initialize Masonry after images are loaded.
|
101 |
-
this.grids.imagesLoaded(function () {
|
102 |
-
strongController.grids.masonry({
|
103 |
-
columnWidth: '.grid-sizer',
|
104 |
-
gutter: '.gutter-sizer',
|
105 |
-
itemSelector: '.wpmtst-testimonial',
|
106 |
-
percentPosition: true
|
107 |
-
});
|
108 |
-
|
109 |
-
strongController.grids.closest('.strong-view').attr('data-state', 'init');
|
110 |
-
});
|
111 |
-
}
|
112 |
-
|
113 |
-
},
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Initialize form validation.
|
117 |
-
*/
|
118 |
-
initForm: function () {
|
119 |
-
var forms = jQuery('.strong-form[data-state="idle"]');
|
120 |
-
var messages = jQuery('.wpmtst-testimonial-success');
|
121 |
-
if (debugit) console.log('forms found:', forms.length);
|
122 |
-
if (debugit) console.log('messages found:', messages.length);
|
123 |
-
if (forms.length || messages.length) {
|
124 |
-
jQuery( forms ).each(function() {
|
125 |
-
var eachform = new strongValidation(this);
|
126 |
-
});
|
127 |
-
// initialize Captcha plugins here
|
128 |
-
}
|
129 |
-
},
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Look for iframes.
|
133 |
-
*/
|
134 |
-
initIframes: function () {
|
135 |
-
this.iframes = jQuery('iframe');
|
136 |
-
},
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Listen for custom events from other scripts.
|
140 |
-
*/
|
141 |
-
customEvents: function () {
|
142 |
-
addEventListener( 'toggleFullContent', function (event) {
|
143 |
-
if (strongController.grids.length) {
|
144 |
-
strongController.grids.masonry();
|
145 |
-
}
|
146 |
-
});
|
147 |
-
},
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Create observer that reacts to nodes added or removed.
|
151 |
-
*
|
152 |
-
* https://stackoverflow.com/a/14570614/51600
|
153 |
-
*/
|
154 |
-
observer: function (obj, callback) {
|
155 |
-
if (this.mutationObserver) {
|
156 |
-
|
157 |
-
// Define a new observer
|
158 |
-
var obs = new this.mutationObserver(function (mutations) {
|
159 |
-
// Loop through mutations
|
160 |
-
for (var i = 0; i < mutations.length; i++) {
|
161 |
-
if (mutations[i].addedNodes.length) {
|
162 |
-
if (debugit) console.log('mutation observed', mutations);
|
163 |
-
// Loop through added nodes
|
164 |
-
for (var j = 0; j < mutations[i].addedNodes.length; j++) {
|
165 |
-
if (mutations[i].addedNodes[j].id === strongController.config.containerId) {
|
166 |
-
if (debugit) console.log('+', strongController.config.containerId);
|
167 |
-
callback();
|
168 |
-
return;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
});
|
174 |
-
// Have the observer observe obj for changes
|
175 |
-
obs.observe(obj, {childList: true, subtree: true});
|
176 |
-
|
177 |
-
} else if (this.eventListenerSupported) {
|
178 |
-
|
179 |
-
obj.addEventListener('DOMNodeInserted', function (e) {
|
180 |
|