Page Builder by SiteOrigin - Version 2.16.13

Version Description

  • 25 May 2022 =
  • Updated WordPress Tested up to tag.
  • Minor PHP formatting improvements.
Download this release

Release Info

Developer SiteOrigin
Plugin Icon 128x128 Page Builder by SiteOrigin
Version 2.16.13
Comparing to
See all releases

Code changes from version 2.16.12 to 2.16.13

Files changed (3) hide show
  1. lang/siteorigin-panels.pot +3 -3
  2. readme.txt +7 -3
  3. siteorigin-panels.php +49 -51
lang/siteorigin-panels.pot CHANGED
@@ -36,15 +36,15 @@ msgstr ""
36
  msgid "https://siteorigin.com"
37
  msgstr ""
38
 
39
- #: siteorigin-panels.php:395
40
  msgid "Read More"
41
  msgstr ""
42
 
43
- #: siteorigin-panels.php:570
44
  msgid "Edit Home Page"
45
  msgstr ""
46
 
47
- #: siteorigin-panels.php:590, tpl/js-templates.php:40, tpl/js-templates.php:42
48
  msgid "Live Editor"
49
  msgstr ""
50
 
36
  msgid "https://siteorigin.com"
37
  msgstr ""
38
 
39
+ #: siteorigin-panels.php:394
40
  msgid "Read More"
41
  msgstr ""
42
 
43
+ #: siteorigin-panels.php:569
44
  msgid "Edit Home Page"
45
  msgstr ""
46
 
47
+ #: siteorigin-panels.php:589, tpl/js-templates.php:40, tpl/js-templates.php:42
48
  msgid "Live Editor"
49
  msgstr ""
50
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, parallax, widgets, blocks, gallery, layout, grid, cms, builder, widget
3
  Requires at least: 4.7
4
- Tested up to: 5.9
5
  Requires PHP: 5.6.20
6
- Stable tag: 2.16.12
7
- Build time: 2022-05-22T20:31:04+02:00
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
  Donate link: https://siteorigin.com/downloads/premium/
@@ -107,6 +107,10 @@ SiteOrigin Premium includes access to our professional email support service, pe
107
 
108
  == Changelog ==
109
 
 
 
 
 
110
  = 2.16.12 - 22 May 2022 =
111
  * Layout Block: Resolved WP 6.0 styling conflict.
112
  * WP Version Check: Update to check for version body class instead of branch.
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, parallax, widgets, blocks, gallery, layout, grid, cms, builder, widget
3
  Requires at least: 4.7
4
+ Tested up to: 6.0
5
  Requires PHP: 5.6.20
6
+ Stable tag: 2.16.13
7
+ Build time: 2022-05-25T13:29:46+02:00
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
  Donate link: https://siteorigin.com/downloads/premium/
107
 
108
  == Changelog ==
109
 
110
+ = 2.16.13 - 25 May 2022 =
111
+ * Updated WordPress `Tested up to` tag.
112
+ * Minor PHP formatting improvements.
113
+
114
  = 2.16.12 - 22 May 2022 =
115
  * Layout Block: Resolved WP 6.0 styling conflict.
116
  * WP Version Check: Update to check for version body class instead of branch.
siteorigin-panels.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
- Version: 2.16.12
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
@@ -11,7 +11,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
- define( 'SITEORIGIN_PANELS_VERSION', '2.16.12' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
@@ -24,7 +24,7 @@ class SiteOrigin_Panels {
24
  function __construct() {
25
  register_activation_hook( __FILE__, array( 'SiteOrigin_Panels', 'activate' ) );
26
 
27
- // Register the autoloader
28
  spl_autoload_register( array( $this, 'autoloader' ) );
29
 
30
  add_action( 'plugins_loaded', array( $this, 'version_check' ) );
@@ -32,7 +32,7 @@ class SiteOrigin_Panels {
32
  add_action( 'plugins_loaded', array( $this, 'init_compat' ), 100 );
33
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 );
34
 
35
- add_action('widgets_init', array( $this, 'widgets_init' ) );
36
 
37
  add_filter( 'body_class', array( $this, 'body_class' ) );
38
  add_filter( 'siteorigin_panels_data', array( $this, 'process_panels_data' ), 5 );
@@ -49,7 +49,7 @@ class SiteOrigin_Panels {
49
  }
50
 
51
  if ( is_admin() ) {
52
- // Setup all the admin classes
53
  SiteOrigin_Panels_Settings::single();
54
  SiteOrigin_Panels_Revisions::single();
55
  }
@@ -62,18 +62,18 @@ class SiteOrigin_Panels {
62
  SiteOrigin_Panels::renderer();
63
  SiteOrigin_Panels_Styles_Admin::single();
64
 
65
- if( siteorigin_panels_setting( 'bundled-widgets' ) && ! function_exists( 'origin_widgets_init' ) ) {
66
  require_once plugin_dir_path( __FILE__ ) . 'widgets/widgets.php';
67
  }
68
 
69
  SiteOrigin_Panels_Widget_Shortcode::init();
70
 
71
- // We need to generate fresh post content
72
  add_filter( 'the_content', array( $this, 'generate_post_content' ) );
73
  add_filter( 'woocommerce_format_content', array( $this, 'generate_woocommerce_content' ) );
74
  add_filter( 'wp_enqueue_scripts', array( $this, 'generate_post_css' ) );
75
 
76
- // Remove the default excerpt function
77
  add_filter( 'get_the_excerpt', array( $this, 'generate_post_excerpt' ), 9 );
78
 
79
  // Content cache has been removed. SiteOrigin_Panels_Cache_Renderer just deletes any existing caches.
@@ -97,9 +97,9 @@ class SiteOrigin_Panels {
97
  *
98
  * @return SiteOrigin_Panels_Renderer
99
  */
100
- public static function renderer(){
101
  static $renderer;
102
- if( empty( $renderer ) ) {
103
  switch( siteorigin_panels_setting( 'legacy-layout' ) ) {
104
  case 'always':
105
  $renderer = SiteOrigin_Panels_Renderer_Legacy::single();
@@ -109,7 +109,7 @@ class SiteOrigin_Panels {
109
  $renderer = SiteOrigin_Panels_Renderer::single();
110
  break;
111
 
112
- default :
113
  $renderer = self::is_legacy_browser() ?
114
  SiteOrigin_Panels_Renderer_Legacy::single() :
115
  SiteOrigin_Panels_Renderer::single();
@@ -120,9 +120,9 @@ class SiteOrigin_Panels {
120
  return $renderer;
121
  }
122
 
123
- public static function is_legacy_browser(){
124
  $agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
125
- if( empty( $agent ) ) return false;
126
 
127
  return
128
  // IE lte 11
@@ -148,11 +148,11 @@ class SiteOrigin_Panels {
148
  $filename = strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', $filename ) );
149
  $filename = plugin_dir_path( __FILE__ ) . 'inc/widgets/' . $filename . '.php';
150
  }
151
- else if ( strpos( $class, 'SiteOrigin_Panels_Compat_' ) === 0 ) {
152
  $filename = str_replace( array( 'SiteOrigin_Panels_Compat_', '_' ), array( '', '-' ), $class );
153
  $filename = plugin_dir_path( __FILE__ ) . 'compat/' . strtolower( $filename ) . '.php';
154
  }
155
- else if ( strpos( $class, 'SiteOrigin_Panels_' ) === 0 ) {
156
  $filename = str_replace( array( 'SiteOrigin_Panels_', '_' ), array( '', '-' ), $class );
157
  $filename = plugin_dir_path( __FILE__ ) . 'inc/' . strtolower( $filename ) . '.php';
158
  }
@@ -177,14 +177,14 @@ class SiteOrigin_Panels {
177
  siteorigin_panels_setting( 'sidebars-emulator' ) &&
178
  ( ! get_option( 'permalink_structure' ) || get_option( 'rewrite_rules' ) )
179
  ) {
180
- // Initialize the sidebars emulator
181
  SiteOrigin_Panels_Sidebars_Emulator::single();
182
  }
183
 
184
- // Initialize the language
185
  load_plugin_textdomain( 'siteorigin-panels', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
186
 
187
- // Initialize all the extra classes
188
  SiteOrigin_Panels_Home::single();
189
 
190
  // Check if we need to initialize the admin class.
@@ -197,7 +197,7 @@ class SiteOrigin_Panels {
197
  * Loads Page Builder compatibility to allow other plugins/themes
198
  */
199
  public function init_compat() {
200
- // Compatibility with Widget Options plugin
201
  if ( class_exists( 'WP_Widget_Options' ) ) {
202
  require_once plugin_dir_path( __FILE__ ) . 'compat/widget-options.php';
203
  }
@@ -210,12 +210,11 @@ class SiteOrigin_Panels {
210
  require_once plugin_dir_path( __FILE__ ) . 'compat/yoast.php';
211
  }
212
 
213
- // Compatibility with AMP plugin
214
  if ( is_admin() && function_exists( 'amp_bootstrap_plugin' ) ) {
215
  require_once plugin_dir_path( __FILE__ ) . 'compat/amp.php';
216
  }
217
 
218
-
219
  // Compatibility with Gravity Forms.
220
  if ( class_exists( 'GFCommon' ) ) {
221
  require_once plugin_dir_path( __FILE__ ) . 'compat/gravity-forms.php';
@@ -226,11 +225,11 @@ class SiteOrigin_Panels {
226
  if ( defined( 'ROCKET_LL_VERSION' ) ) {
227
  $lazy_load_settings = get_option( 'rocket_lazyload_options' );
228
  $load_lazy_load_compat = ! empty( $lazy_load_settings ) && ! empty( $lazy_load_settings['images'] );
229
- // WP Rocket
230
  } elseif ( function_exists( 'get_rocket_option' ) && ! defined( 'DONOTROCKETOPTIMIZE' ) ) {
231
  $load_lazy_load_compat = get_rocket_option( 'lazyload' ) && apply_filters( 'do_rocket_lazyload', true );
232
  }
233
-
234
  if ( apply_filters( 'siteorigin_lazyload_compat', $load_lazy_load_compat ) ) {
235
  require_once plugin_dir_path( __FILE__ ) . 'compat/lazy-load-backgrounds.php';
236
  }
@@ -245,7 +244,7 @@ class SiteOrigin_Panels {
245
  }
246
 
247
  /**
248
- * @return mixed|void Are we currently viewing the home page
249
  */
250
  public static function is_home() {
251
  $home = ( is_front_page() && is_page() && get_option( 'show_on_front' ) == 'page' && get_option( 'page_on_front' ) == get_the_ID() && get_post_meta( get_the_ID(), 'panels_data' ) );
@@ -272,7 +271,7 @@ class SiteOrigin_Panels {
272
  *
273
  * @return bool
274
  */
275
- static function is_live_editor(){
276
  return ! empty( $_GET['siteorigin_panels_live_editor'] );
277
  }
278
 
@@ -371,11 +370,11 @@ class SiteOrigin_Panels {
371
 
372
  $post_id = $this->get_post_id();
373
 
374
- // Check if this post has panels_data
375
  if ( get_post_meta( $post_id, 'panels_data', true ) ) {
376
  $panel_content = SiteOrigin_Panels::renderer()->render(
377
  $post_id,
378
- // Add CSS if this is not the main single post, this is handled by add_single_css
379
  $preview || $post_id !== get_queried_object_id()
380
  );
381
 
@@ -383,7 +382,7 @@ class SiteOrigin_Panels {
383
  $content = $panel_content;
384
 
385
  if ( ! is_singular() ) {
386
- // This is an archive page, so try strip out anything after the more text
387
 
388
  if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
389
  $content = explode( $matches[0], $content, 2 );
@@ -497,7 +496,7 @@ class SiteOrigin_Panels {
497
  public function generate_post_css() {
498
  $post_id = $this->get_post_id();
499
 
500
- if( is_singular() && get_post_meta( $post_id, 'panels_data', true ) ) {
501
  $renderer = SiteOrigin_Panels::renderer();
502
  $renderer->add_inline_css( $post_id, $renderer->generate_css( $post_id ) );
503
  }
@@ -533,14 +532,14 @@ class SiteOrigin_Panels {
533
  * @return array
534
  */
535
  function body_class( $classes ) {
536
- if( self::is_panel() ) {
537
  $classes[] = 'siteorigin-panels';
538
  $classes[] = 'siteorigin-panels-before-js';
539
 
540
  add_action( 'wp_footer', array( $this, 'strip_before_js' ), 99 );
541
  }
542
- if( self::is_home() ) $classes[] = 'siteorigin-panels-home';
543
- if( self::is_live_editor() ) $classes[] = 'siteorigin-panels-live-editor';
544
 
545
  $this->container = SiteOrigin_Panels::container_settings();
546
  if ( ! empty( $this->container ) && $this->container['css_override'] ) {
@@ -578,7 +577,7 @@ class SiteOrigin_Panels {
578
  }
579
  }
580
 
581
- // Add a Live Edit link if this is a Page Builder page that the user can edit
582
  if (
583
  siteorigin_panels_setting( 'live-editor-quick-link' ) &&
584
  is_singular() &&
@@ -600,7 +599,7 @@ class SiteOrigin_Panels {
600
  return $admin_bar;
601
  }
602
 
603
- function widgets_init(){
604
  register_widget( 'SiteOrigin_Panels_Widgets_PostContent' );
605
  register_widget( 'SiteOrigin_Panels_Widgets_PostLoop' );
606
  register_widget( 'SiteOrigin_Panels_Widgets_Layout' );
@@ -608,7 +607,7 @@ class SiteOrigin_Panels {
608
 
609
  function live_edit_link_style() {
610
  if ( is_singular() && current_user_can( 'edit_post', get_the_ID() ) && get_post_meta( get_the_ID(), 'panels_data', true ) ) {
611
- // Add the style for the eye icon before the Live Editor link
612
  $css = '#wpadminbar #wp-admin-bar-so_live_editor > .ab-item:before {
613
  content: "\f177";
614
  top: 2px;
@@ -618,7 +617,7 @@ class SiteOrigin_Panels {
618
  }
619
 
620
  /**
621
- * Process panels data to make sure everything is properly formatted
622
  *
623
  * @param array $panels_data
624
  *
@@ -626,7 +625,7 @@ class SiteOrigin_Panels {
626
  */
627
  function process_panels_data( $panels_data ) {
628
 
629
- // Process all widgets to make sure that panels_info is properly represented
630
  if ( ! empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ) {
631
 
632
  $last_gi = 0;
@@ -640,7 +639,7 @@ class SiteOrigin_Panels {
640
  unset( $widget['info'] );
641
  }
642
 
643
- // Filter the widgets to add indexes
644
  if ( $widget['panels_info']['grid'] != $last_gi ) {
645
  $last_gi = $widget['panels_info']['grid'];
646
  $last_ci = $widget['panels_info']['cell'];
@@ -663,7 +662,7 @@ class SiteOrigin_Panels {
663
  }
664
 
665
  /**
666
- * Fix class names that have been incorrectly escaped
667
  *
668
  * @param $class
669
  *
@@ -673,16 +672,16 @@ class SiteOrigin_Panels {
673
  return preg_replace( '/\\\\+/', '\\', $class );
674
  }
675
 
676
- public static function front_css_url(){
677
  return self::renderer()->front_css_url();
678
  }
679
 
680
  /**
681
- * Trigger a siteorigin_panels_version_changed action if the version has changed
682
  */
683
- public function version_check(){
684
  $active_version = get_option( 'siteorigin_panels_active_version', false );
685
- if( empty( $active_version ) || $active_version !== SITEORIGIN_PANELS_VERSION ) {
686
  do_action( 'siteorigin_panels_version_changed' );
687
  update_option( 'siteorigin_panels_active_version', SITEORIGIN_PANELS_VERSION );
688
  }
@@ -691,39 +690,38 @@ class SiteOrigin_Panels {
691
  /**
692
  * Script that removes the siteorigin-panels-before-js class from the body.
693
  */
694
- public function strip_before_js(){
695
  ?><script type="text/javascript">document.body.className = document.body.className.replace("siteorigin-panels-before-js","");</script><?php
696
  }
697
 
698
  /**
699
- * Should we display premium addon messages
700
  *
701
  * @return bool
702
  */
703
- public static function display_premium_teaser(){
704
  return siteorigin_panels_setting( 'display-teaser' ) &&
705
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
706
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
707
  }
708
 
709
  /**
710
- * Get the premium upgrade URL
711
  *
712
  * @return string
713
  */
714
  public static function premium_url( $featured_addon = false ) {
715
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
716
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
717
- if( ! empty( $featured_addon ) ) {
718
  $url = add_query_arg( 'featured_addon', urlencode( $featured_addon ), $url );
719
  }
720
- if( ! empty( $ref ) ) {
721
  $url = add_query_arg( 'ref', urlencode( $ref ), $url );
722
  }
723
  return $url;
724
  }
725
 
726
-
727
  /**
728
  * Get the registered widget instance by it's class name or the hash generated when it was registered.
729
  *
@@ -746,7 +744,7 @@ class SiteOrigin_Panels {
746
  }
747
 
748
  /**
749
- * Flag redirect to welcome page after activation
750
  *
751
  * @param $plugin
752
  */
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
+ Version: 2.16.13
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
+ define( 'SITEORIGIN_PANELS_VERSION', '2.16.13' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
24
  function __construct() {
25
  register_activation_hook( __FILE__, array( 'SiteOrigin_Panels', 'activate' ) );
26
 
27
+ // Register the autoloader.
28
  spl_autoload_register( array( $this, 'autoloader' ) );
29
 
30
  add_action( 'plugins_loaded', array( $this, 'version_check' ) );
32
  add_action( 'plugins_loaded', array( $this, 'init_compat' ), 100 );
33
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 );
34
 
35
+ add_action( 'widgets_init', array( $this, 'widgets_init' ) );
36
 
37
  add_filter( 'body_class', array( $this, 'body_class' ) );
38
  add_filter( 'siteorigin_panels_data', array( $this, 'process_panels_data' ), 5 );
49
  }
50
 
51
  if ( is_admin() ) {
52
+ // Setup all the admin classes.
53
  SiteOrigin_Panels_Settings::single();
54
  SiteOrigin_Panels_Revisions::single();
55
  }
62
  SiteOrigin_Panels::renderer();
63
  SiteOrigin_Panels_Styles_Admin::single();
64
 
65
+ if ( siteorigin_panels_setting( 'bundled-widgets' ) && ! function_exists( 'origin_widgets_init' ) ) {
66
  require_once plugin_dir_path( __FILE__ ) . 'widgets/widgets.php';
67
  }
68
 
69
  SiteOrigin_Panels_Widget_Shortcode::init();
70
 
71
+ // We need to generate fresh post content.
72
  add_filter( 'the_content', array( $this, 'generate_post_content' ) );
73
  add_filter( 'woocommerce_format_content', array( $this, 'generate_woocommerce_content' ) );
74
  add_filter( 'wp_enqueue_scripts', array( $this, 'generate_post_css' ) );
75
 
76
+ // Remove the default excerpt function.
77
  add_filter( 'get_the_excerpt', array( $this, 'generate_post_excerpt' ), 9 );
78
 
79
  // Content cache has been removed. SiteOrigin_Panels_Cache_Renderer just deletes any existing caches.
97
  *
98
  * @return SiteOrigin_Panels_Renderer
99
  */
100
+ public static function renderer() {
101
  static $renderer;
102
+ if ( empty( $renderer ) ) {
103
  switch( siteorigin_panels_setting( 'legacy-layout' ) ) {
104
  case 'always':
105
  $renderer = SiteOrigin_Panels_Renderer_Legacy::single();
109
  $renderer = SiteOrigin_Panels_Renderer::single();
110
  break;
111
 
112
+ default:
113
  $renderer = self::is_legacy_browser() ?
114
  SiteOrigin_Panels_Renderer_Legacy::single() :
115
  SiteOrigin_Panels_Renderer::single();
120
  return $renderer;
121
  }
122
 
123
+ public static function is_legacy_browser() {
124
  $agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
125
+ if ( empty( $agent ) ) return false;
126
 
127
  return
128
  // IE lte 11
148
  $filename = strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', $filename ) );
149
  $filename = plugin_dir_path( __FILE__ ) . 'inc/widgets/' . $filename . '.php';
150
  }
151
+ elseif ( strpos( $class, 'SiteOrigin_Panels_Compat_' ) === 0 ) {
152
  $filename = str_replace( array( 'SiteOrigin_Panels_Compat_', '_' ), array( '', '-' ), $class );
153
  $filename = plugin_dir_path( __FILE__ ) . 'compat/' . strtolower( $filename ) . '.php';
154
  }
155
+ elseif ( strpos( $class, 'SiteOrigin_Panels_' ) === 0 ) {
156
  $filename = str_replace( array( 'SiteOrigin_Panels_', '_' ), array( '', '-' ), $class );
157
  $filename = plugin_dir_path( __FILE__ ) . 'inc/' . strtolower( $filename ) . '.php';
158
  }
177
  siteorigin_panels_setting( 'sidebars-emulator' ) &&
178
  ( ! get_option( 'permalink_structure' ) || get_option( 'rewrite_rules' ) )
179
  ) {
180
+ // Initialize the sidebars emulator.
181
  SiteOrigin_Panels_Sidebars_Emulator::single();
182
  }
183
 
184
+ // Initialize the language.
185
  load_plugin_textdomain( 'siteorigin-panels', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
186
 
187
+ // Initialize all the extra classes.
188
  SiteOrigin_Panels_Home::single();
189
 
190
  // Check if we need to initialize the admin class.
197
  * Loads Page Builder compatibility to allow other plugins/themes
198
  */
199
  public function init_compat() {
200
+ // Compatibility with Widget Options plugin.
201
  if ( class_exists( 'WP_Widget_Options' ) ) {
202
  require_once plugin_dir_path( __FILE__ ) . 'compat/widget-options.php';
203
  }
210
  require_once plugin_dir_path( __FILE__ ) . 'compat/yoast.php';
211
  }
212
 
213
+ // Compatibility with AMP plugin.
214
  if ( is_admin() && function_exists( 'amp_bootstrap_plugin' ) ) {
215
  require_once plugin_dir_path( __FILE__ ) . 'compat/amp.php';
216
  }
217
 
 
218
  // Compatibility with Gravity Forms.
219
  if ( class_exists( 'GFCommon' ) ) {
220
  require_once plugin_dir_path( __FILE__ ) . 'compat/gravity-forms.php';
225
  if ( defined( 'ROCKET_LL_VERSION' ) ) {
226
  $lazy_load_settings = get_option( 'rocket_lazyload_options' );
227
  $load_lazy_load_compat = ! empty( $lazy_load_settings ) && ! empty( $lazy_load_settings['images'] );
228
+ // WP Rocket.
229
  } elseif ( function_exists( 'get_rocket_option' ) && ! defined( 'DONOTROCKETOPTIMIZE' ) ) {
230
  $load_lazy_load_compat = get_rocket_option( 'lazyload' ) && apply_filters( 'do_rocket_lazyload', true );
231
  }
232
+
233
  if ( apply_filters( 'siteorigin_lazyload_compat', $load_lazy_load_compat ) ) {
234
  require_once plugin_dir_path( __FILE__ ) . 'compat/lazy-load-backgrounds.php';
235
  }
244
  }
245
 
246
  /**
247
+ * @return mixed|void Are we currently viewing the home page.
248
  */
249
  public static function is_home() {
250
  $home = ( is_front_page() && is_page() && get_option( 'show_on_front' ) == 'page' && get_option( 'page_on_front' ) == get_the_ID() && get_post_meta( get_the_ID(), 'panels_data' ) );
271
  *
272
  * @return bool
273
  */
274
+ static function is_live_editor() {
275
  return ! empty( $_GET['siteorigin_panels_live_editor'] );
276
  }
277
 
370
 
371
  $post_id = $this->get_post_id();
372
 
373
+ // Check if this post has panels_data.
374
  if ( get_post_meta( $post_id, 'panels_data', true ) ) {
375
  $panel_content = SiteOrigin_Panels::renderer()->render(
376
  $post_id,
377
+ // Add CSS if this is not the main single post, this is handled by add_single_css.
378
  $preview || $post_id !== get_queried_object_id()
379
  );
380
 
382
  $content = $panel_content;
383
 
384
  if ( ! is_singular() ) {
385
+ // This is an archive page, so try strip out anything after the more text.
386
 
387
  if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
388
  $content = explode( $matches[0], $content, 2 );
496
  public function generate_post_css() {
497
  $post_id = $this->get_post_id();
498
 
499
+ if ( is_singular() && get_post_meta( $post_id, 'panels_data', true ) ) {
500
  $renderer = SiteOrigin_Panels::renderer();
501
  $renderer->add_inline_css( $post_id, $renderer->generate_css( $post_id ) );
502
  }
532
  * @return array
533
  */
534
  function body_class( $classes ) {
535
+ if ( self::is_panel() ) {
536
  $classes[] = 'siteorigin-panels';
537
  $classes[] = 'siteorigin-panels-before-js';
538
 
539
  add_action( 'wp_footer', array( $this, 'strip_before_js' ), 99 );
540
  }
541
+ if ( self::is_home() ) $classes[] = 'siteorigin-panels-home';
542
+ if ( self::is_live_editor() ) $classes[] = 'siteorigin-panels-live-editor';
543
 
544
  $this->container = SiteOrigin_Panels::container_settings();
545
  if ( ! empty( $this->container ) && $this->container['css_override'] ) {
577
  }
578
  }
579
 
580
+ // Add a Live Edit link if this is a Page Builder page that the user can edit.
581
  if (
582
  siteorigin_panels_setting( 'live-editor-quick-link' ) &&
583
  is_singular() &&
599
  return $admin_bar;
600
  }
601
 
602
+ function widgets_init() {
603
  register_widget( 'SiteOrigin_Panels_Widgets_PostContent' );
604
  register_widget( 'SiteOrigin_Panels_Widgets_PostLoop' );
605
  register_widget( 'SiteOrigin_Panels_Widgets_Layout' );
607
 
608
  function live_edit_link_style() {
609
  if ( is_singular() && current_user_can( 'edit_post', get_the_ID() ) && get_post_meta( get_the_ID(), 'panels_data', true ) ) {
610
+ // Add the style for the eye icon before the Live Editor link.
611
  $css = '#wpadminbar #wp-admin-bar-so_live_editor > .ab-item:before {
612
  content: "\f177";
613
  top: 2px;
617
  }
618
 
619
  /**
620
+ * Process panels data to make sure everything is properly formatted.
621
  *
622
  * @param array $panels_data
623
  *
625
  */
626
  function process_panels_data( $panels_data ) {
627
 
628
+ // Process all widgets to make sure that panels_info is properly represented.
629
  if ( ! empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ) {
630
 
631
  $last_gi = 0;
639
  unset( $widget['info'] );
640
  }
641
 
642
+ // Filter the widgets to add indexes.
643
  if ( $widget['panels_info']['grid'] != $last_gi ) {
644
  $last_gi = $widget['panels_info']['grid'];
645
  $last_ci = $widget['panels_info']['cell'];
662
  }
663
 
664
  /**
665
+ * Fix class names that have been incorrectly escaped.
666
  *
667
  * @param $class
668
  *
672
  return preg_replace( '/\\\\+/', '\\', $class );
673
  }
674
 
675
+ public static function front_css_url() {
676
  return self::renderer()->front_css_url();
677
  }
678
 
679
  /**
680
+ * Trigger a siteorigin_panels_version_changed action if the version has changed.
681
  */
682
+ public function version_check() {
683
  $active_version = get_option( 'siteorigin_panels_active_version', false );
684
+ if ( empty( $active_version ) || $active_version !== SITEORIGIN_PANELS_VERSION ) {
685
  do_action( 'siteorigin_panels_version_changed' );
686
  update_option( 'siteorigin_panels_active_version', SITEORIGIN_PANELS_VERSION );
687
  }
690
  /**
691
  * Script that removes the siteorigin-panels-before-js class from the body.
692
  */
693
+ public function strip_before_js() {
694
  ?><script type="text/javascript">document.body.className = document.body.className.replace("siteorigin-panels-before-js","");</script><?php
695
  }
696
 
697
  /**
698
+ * Should we display premium addon messages.
699
  *
700
  * @return bool
701
  */
702
+ public static function display_premium_teaser() {
703
  return siteorigin_panels_setting( 'display-teaser' ) &&
704
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
705
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
706
  }
707
 
708
  /**
709
+ * Get the premium upgrade URL.
710
  *
711
  * @return string
712
  */
713
  public static function premium_url( $featured_addon = false ) {
714
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
715
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
716
+ if ( ! empty( $featured_addon ) ) {
717
  $url = add_query_arg( 'featured_addon', urlencode( $featured_addon ), $url );
718
  }
719
+ if ( ! empty( $ref ) ) {
720
  $url = add_query_arg( 'ref', urlencode( $ref ), $url );
721
  }
722
  return $url;
723
  }
724
 
 
725
  /**
726
  * Get the registered widget instance by it's class name or the hash generated when it was registered.
727
  *
744
  }
745
 
746
  /**
747
+ * Flag redirect to welcome page after activation.
748
  *
749
  * @param $plugin
750
  */