Page Builder by SiteOrigin - Version 2.10.4

Version Description

  • 3 April 2019 =
  • New welcome page.
  • Include row style wrapper in cell CSS direct child selectors.
Download this release

Release Info

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

Code changes from version 2.10.3 to 2.10.4

inc/css-builder.php CHANGED
@@ -97,29 +97,43 @@ class SiteOrigin_Panels_Css_Builder {
97
  * @param bool $specify_layout Sometimes for CSS specificity, we need to include the layout ID.
98
  */
99
  public function add_cell_css( $li, $ri = false, $ci = false, $sub_selector = '', $attributes = array(), $resolution = 1920, $specify_layout = false ) {
100
- $selector = array();
101
 
102
  if ( $ri === false && $ci === false ) {
103
  // This applies to all cells in the layout
104
- $selector[] = '#pl-' . $li;
105
- $selector[] = '.panel-grid-cell';
106
  } elseif ( $ri !== false && $ci === false ) {
107
  // This applies to all cells in a row
 
 
108
  if ( $specify_layout ) {
109
- $selector[] = '#pl-' . $li;
110
  }
111
- $selector[] = is_string( $ri ) ? ( '#' . $ri ) : '#pg-' . $li . '-' . $ri;
112
- $selector[] = '> .panel-grid-cell';
 
 
 
 
 
 
 
 
 
 
113
  } elseif ( $ri !== false && $ci !== false ) {
114
  // This applies to a specific cell
115
  if ( $specify_layout ) {
116
- $selector[] = '#pl-' . $li;
117
  }
118
- $selector[] = '#pgc-' . $li . '-' . $ri . '-' . $ci;
119
  }
120
 
121
- $selector = implode( ' ', $selector );
122
- $selector = $this->add_sub_selector( $selector, $sub_selector );
 
 
123
 
124
  // Add this to the CSS array
125
  $this->add_css( $selector, $attributes, $resolution );
97
  * @param bool $specify_layout Sometimes for CSS specificity, we need to include the layout ID.
98
  */
99
  public function add_cell_css( $li, $ri = false, $ci = false, $sub_selector = '', $attributes = array(), $resolution = 1920, $specify_layout = false ) {
100
+ $selector_parts = array();
101
 
102
  if ( $ri === false && $ci === false ) {
103
  // This applies to all cells in the layout
104
+ $selector_parts[] = '#pl-' . $li;
105
+ $selector_parts[] = '.panel-grid-cell';
106
  } elseif ( $ri !== false && $ci === false ) {
107
  // This applies to all cells in a row
108
+ $sel = '';
109
+
110
  if ( $specify_layout ) {
111
+ $sel = '#pl-' . $li . ' ';
112
  }
113
+ $sel .= is_string( $ri ) ? ( '#' . $ri ) : '#pg-' . $li . '-' . $ri;
114
+
115
+ // If row styles are set, there's a row style wrapper between the row and the cell, so we need to include
116
+ // the selector for both. This is a somewhat hacky fix, but trying to prevent further breakage in existing
117
+ // layouts.
118
+ $sel_with_style = ', ' . $sel . ' > .panel-row-style';
119
+
120
+ $sel .= ' > .panel-grid-cell';
121
+ $sel_with_style .= ' > .panel-grid-cell';
122
+
123
+ $selector_parts[] = $sel;
124
+ $selector_parts[] = $sel_with_style;
125
  } elseif ( $ri !== false && $ci !== false ) {
126
  // This applies to a specific cell
127
  if ( $specify_layout ) {
128
+ $selector_parts[] = '#pl-' . $li;
129
  }
130
+ $selector_parts[] = '#pgc-' . $li . '-' . $ri . '-' . $ci;
131
  }
132
 
133
+ $selector = implode( ' ', $selector_parts );
134
+ if ( ! empty( $sub_selector ) ) {
135
+ $selector = $this->add_sub_selector( $selector, $sub_selector );
136
+ }
137
 
138
  // Add this to the CSS array
139
  $this->add_css( $selector, $attributes, $resolution );
inc/functions.php CHANGED
@@ -1,106 +1,106 @@
1
- <?php
2
- /**
3
- * Contains several legacy and shorthand functions
4
- *
5
- * @since 3.0
6
- */
7
-
8
- /**
9
- * @return mixed|void Are we currently viewing the home page
10
- */
11
- function siteorigin_panels_is_home() {
12
- return SiteOrigin_Panels::is_home();
13
- }
14
-
15
- /**
16
- * Check if we're currently viewing a page builder page.
17
- *
18
- * @param bool $can_edit Also check if the user can edit this page
19
- *
20
- * @return bool
21
- */
22
- function siteorigin_panels_is_panel( $can_edit = false ) {
23
- return SiteOrigin_Panels::is_panel( $can_edit );
24
- }
25
-
26
-
27
- function siteorigin_panels_get_home_page_data() {
28
- return SiteOrigin_Panels::single()->get_home_page_data();
29
- }
30
-
31
- /**
32
- * Render Page Builder content
33
- *
34
- * @param bool $post_id
35
- * @param bool $enqueue_css
36
- * @param bool $panels_data
37
- *
38
- * @return string The HTML content.
39
- */
40
- function siteorigin_panels_render( $post_id = false, $enqueue_css = true, $panels_data = false ) {
41
- return SiteOrigin_Panels::renderer()->render( $post_id, $enqueue_css, $panels_data );
42
- }
43
-
44
- /**
45
- * Generate the CSS for the page layout.
46
- *
47
- * @param $post_id
48
- * @param $panels_data
49
- * @return string
50
- */
51
- function siteorigin_panels_generate_css($post_id, $panels_data = false){
52
- return SiteOrigin_Panels::renderer()->generate_css( $post_id, $panels_data );
53
- }
54
-
55
- /**
56
- * Legacy function to process raw widgets.
57
- *
58
- * @param $widgets
59
- * @param $old_widgets
60
- * @param $escape_classes
61
- *
62
- * @return array
63
- */
64
- function siteorigin_panels_process_raw_widgets( $widgets, $old_widgets = false, $escape_classes = false ) {
65
- return SiteOrigin_Panels_Admin::single()->process_raw_widgets( $widgets, $old_widgets, $escape_classes );
66
- }
67
-
68
- function siteorigin_panels_the_widget( $widget_info, $instance, $grid, $cell, $panel, $is_first, $is_last, $post_id = false, $style_wrapper = '' ) {
69
- SiteOrigin_Panels::renderer()->the_widget( $widget_info, $instance, $grid, $cell, $panel, $is_first, $is_last, $post_id, $style_wrapper );
70
- }
71
-
72
- /**
73
- * Get a setting with the given key.
74
- *
75
- * @param string $key
76
- *
77
- * @return array|bool|mixed|null
78
- */
79
- function siteorigin_panels_setting( $key = '' ) {
80
- return SiteOrigin_Panels_Settings::single()->get( $key );
81
- }
82
-
83
- function siteorigin_panels_plugin_activation_install_url( $plugin, $plugin_name, $source = false ) {
84
- return SiteOrigin_Panels_Admin_Widgets_Bundle::install_url( $plugin, $plugin_name, $source );
85
- }
86
-
87
- /**
88
- * A null function for compatibility with aTheme themes.
89
- *
90
- * @return bool
91
- */
92
- function siteorigin_panels_activate(){
93
- return false;
94
- }
95
-
96
-
97
- /**
98
- * Returns the base URL of our widget with `$path` appended.
99
- *
100
- * @param string $path Extra path to append to the end of the URL.
101
- *
102
- * @return string Base URL of the widget, with $path appended.
103
- */
104
- function siteorigin_panels_url( $path = '' ) {
105
- return plugins_url( 'siteorigin-panels/' . $path );
106
- }
1
+ <?php
2
+ /**
3
+ * Contains several legacy and shorthand functions
4
+ *
5
+ * @since 3.0
6
+ */
7
+
8
+ /**
9
+ * @return mixed|void Are we currently viewing the home page
10
+ */
11
+ function siteorigin_panels_is_home() {
12
+ return SiteOrigin_Panels::is_home();
13
+ }
14
+
15
+ /**
16
+ * Check if we're currently viewing a page builder page.
17
+ *
18
+ * @param bool $can_edit Also check if the user can edit this page
19
+ *
20
+ * @return bool
21
+ */
22
+ function siteorigin_panels_is_panel( $can_edit = false ) {
23
+ return SiteOrigin_Panels::is_panel( $can_edit );
24
+ }
25
+
26
+
27
+ function siteorigin_panels_get_home_page_data() {
28
+ return SiteOrigin_Panels::single()->get_home_page_data();
29
+ }
30
+
31
+ /**
32
+ * Render Page Builder content
33
+ *
34
+ * @param bool $post_id
35
+ * @param bool $enqueue_css
36
+ * @param bool $panels_data
37
+ *
38
+ * @return string The HTML content.
39
+ */
40
+ function siteorigin_panels_render( $post_id = false, $enqueue_css = true, $panels_data = false ) {
41
+ return SiteOrigin_Panels::renderer()->render( $post_id, $enqueue_css, $panels_data );
42
+ }
43
+
44
+ /**
45
+ * Generate the CSS for the page layout.
46
+ *
47
+ * @param $post_id
48
+ * @param $panels_data
49
+ * @return string
50
+ */
51
+ function siteorigin_panels_generate_css($post_id, $panels_data = false){
52
+ return SiteOrigin_Panels::renderer()->generate_css( $post_id, $panels_data );
53
+ }
54
+
55
+ /**
56
+ * Legacy function to process raw widgets.
57
+ *
58
+ * @param $widgets
59
+ * @param $old_widgets
60
+ * @param $escape_classes
61
+ *
62
+ * @return array
63
+ */
64
+ function siteorigin_panels_process_raw_widgets( $widgets, $old_widgets = false, $escape_classes = false ) {
65
+ return SiteOrigin_Panels_Admin::single()->process_raw_widgets( $widgets, $old_widgets, $escape_classes );
66
+ }
67
+
68
+ function siteorigin_panels_the_widget( $widget_info, $instance, $grid, $cell, $panel, $is_first, $is_last, $post_id = false, $style_wrapper = '' ) {
69
+ SiteOrigin_Panels::renderer()->the_widget( $widget_info, $instance, $grid, $cell, $panel, $is_first, $is_last, $post_id, $style_wrapper );
70
+ }
71
+
72
+ /**
73
+ * Get a setting with the given key.
74
+ *
75
+ * @param string $key
76
+ *
77
+ * @return array|bool|mixed|null
78
+ */
79
+ function siteorigin_panels_setting( $key = '' ) {
80
+ return SiteOrigin_Panels_Settings::single()->get( $key );
81
+ }
82
+
83
+ function siteorigin_panels_plugin_activation_install_url( $plugin, $plugin_name, $source = false ) {
84
+ return SiteOrigin_Panels_Admin_Widgets_Bundle::install_url( $plugin, $plugin_name, $source );
85
+ }
86
+
87
+ /**
88
+ * A null function for compatibility with aTheme themes.
89
+ *
90
+ * @return bool
91
+ */
92
+ function siteorigin_panels_activate(){
93
+ return false;
94
+ }
95
+
96
+
97
+ /**
98
+ * Returns the base URL of our widget with `$path` appended.
99
+ *
100
+ * @param string $path Extra path to append to the end of the URL.
101
+ *
102
+ * @return string Base URL of the widget, with $path appended.
103
+ */
104
+ function siteorigin_panels_url( $path = '' ) {
105
+ return plugins_url( 'siteorigin-panels/' . $path );
106
+ }
inc/renderer.php CHANGED
@@ -207,12 +207,9 @@ class SiteOrigin_Panels_Renderer {
207
  'flex-direction' => $collapse_order == 'left-top' ? 'column' : 'column-reverse',
208
  ), $panels_mobile_width );
209
 
210
- $css->add_cell_css( $post_id, $ri, false, '', array(
211
- 'margin-right' => 0,
212
- ), $panels_mobile_width );
213
-
214
  $css->add_cell_css( $post_id, $ri, false, '', array(
215
  'width' => '100%',
 
216
  ), $panels_mobile_width );
217
  }
218
 
207
  'flex-direction' => $collapse_order == 'left-top' ? 'column' : 'column-reverse',
208
  ), $panels_mobile_width );
209
 
 
 
 
 
210
  $css->add_cell_css( $post_id, $ri, false, '', array(
211
  'width' => '100%',
212
+ 'margin-right' => 0,
213
  ), $panels_mobile_width );
214
  }
215
 
inc/sidebars-emulator.php CHANGED
@@ -65,17 +65,26 @@ class SiteOrigin_Panels_Sidebars_Emulator {
65
  * Register all the current widgets so we can filter the get_option('widget_...') values to add instances
66
  */
67
  function register_widgets() {
 
 
 
68
  // Get the ID of the current post
69
- $post_id = url_to_postid( add_query_arg( false, false ) );
 
 
 
 
 
70
  if ( empty( $post_id ) ) {
71
  // Maybe this is the home page
72
- $current_url_path = parse_url( add_query_arg( false, false ), PHP_URL_PATH );
73
  $home_url_path = parse_url( trailingslashit( home_url() ), PHP_URL_PATH );
74
 
75
  if ( $current_url_path === $home_url_path && get_option( 'page_on_front' ) != 0 ) {
76
  $post_id = absint( get_option( 'page_on_front' ) );
77
  }
78
  }
 
79
  if ( empty( $post_id ) ) {
80
  return;
81
  }
65
  * Register all the current widgets so we can filter the get_option('widget_...') values to add instances
66
  */
67
  function register_widgets() {
68
+ $current_url = add_query_arg( false, false );
69
+ $cache_key = md5( $current_url );
70
+
71
  // Get the ID of the current post
72
+ $post_id = wp_cache_get( $cache_key, 'siteorigin_url_to_postid' );
73
+ if ( false === $post_id ) {
74
+ $post_id = url_to_postid( $current_url );
75
+ wp_cache_set( $cache_key, $post_id, 'siteorigin_url_to_postid', 3 * HOUR_IN_SECONDS );
76
+ }
77
+
78
  if ( empty( $post_id ) ) {
79
  // Maybe this is the home page
80
+ $current_url_path = parse_url( $current_url, PHP_URL_PATH );
81
  $home_url_path = parse_url( trailingslashit( home_url() ), PHP_URL_PATH );
82
 
83
  if ( $current_url_path === $home_url_path && get_option( 'page_on_front' ) != 0 ) {
84
  $post_id = absint( get_option( 'page_on_front' ) );
85
  }
86
  }
87
+
88
  if ( empty( $post_id ) ) {
89
  return;
90
  }
js/siteorigin-panels-2104.js ADDED
@@ -0,0 +1,7447 @@