PluginProbe ʕ •ᴥ•ʔ
Page Builder by SiteOrigin / 2.18.4
Page Builder by SiteOrigin v2.18.4
2.34.3 2.34.2 2.29.5 2.29.6 2.29.7 2.29.8 2.29.9 2.3 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.31.2 2.31.3 2.31.4 2.31.5 2.31.6 2.31.7 2.31.8 2.32.0 2.32.1 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.34.0 2.34.1 2.4 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 2.4.22 2.4.23 2.4.24 2.4.25 2.4.3 2.4.4 2.4.5 2.4.6 2.4.8 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0 2.8.1 2.8.2 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 trunk 2.10.0 2.10.1 2.10.10 2.10.11 2.10.12 2.10.13 2.10.14 2.10.15 2.10.16 2.10.17 2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.12.0 2.12.1 2.12.2 2.12.3 2.12.4 2.12.5 2.12.6 2.13.0 2.13.1 2.13.2 2.14.0 2.14.1 2.14.2 2.14.3 2.15.0 2.15.1 2.15.2 2.15.3 2.16.0 2.16.1 2.16.10 2.16.11 2.16.12 2.16.13 2.16.14 2.16.15 2.16.16 2.16.17 2.16.18 2.16.19 2.16.2 2.16.3 2.16.4 2.16.5 2.16.6 2.16.7 2.16.8 2.16.9 2.17.0 2.18.0 2.18.1 2.18.2 2.18.3 2.18.4 2.19.0 2.20.0 2.20.1 2.20.2 2.20.3 2.20.4 2.20.5 2.20.6 2.21.0 2.21.1 2.22.0 2.22.1 2.23.0 2.24.0 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.26.1 2.26.2 2.27.0 2.27.1 2.28.0 2.29.0 2.29.1 2.29.10 2.29.11 2.29.12 2.29.13 2.29.14 2.29.15 2.29.16 2.29.17 2.29.18 2.29.19 2.29.2 2.29.20 2.29.21 2.29.22 2.29.3 2.29.4
siteorigin-panels / inc / renderer-legacy.php
siteorigin-panels / inc Last commit date
data 9 years ago widgets 4 years ago admin-dashboard.php 6 years ago admin-layouts.php 4 years ago admin-widget-dialog.php 6 years ago admin-widgets-bundle.php 9 years ago admin.php 3 years ago cache-renderer.php 6 years ago css-builder.php 4 years ago functions.php 6 years ago home.php 9 years ago live-editor.php 6 years ago post-content-filters.php 5 years ago renderer-legacy.php 3 years ago renderer.php 3 years ago revisions.php 6 years ago settings.php 4 years ago sidebars-emulator.php 4 years ago styles-admin.php 3 years ago styles.php 3 years ago widget-shortcode.php 4 years ago
renderer-legacy.php
176 lines
1 <?php
2
3 class SiteOrigin_Panels_Renderer_Legacy extends SiteOrigin_Panels_Renderer {
4
5 public static function single() {
6 static $single;
7 return empty( $single ) ? $single = new self() : $single;
8 }
9
10 /**
11 * Generate the CSS for the page layout.
12 *
13 * @param $post_id
14 * @param $panels_data
15 * @param $layout_data
16 *
17 * @return string
18 */
19 public function generate_css( $post_id, $panels_data = false, $layout_data = false) {
20 // Exit if we don't have panels data
21 if ( empty( $panels_data ) ) {
22 $panels_data = get_post_meta( $post_id, 'panels_data', true );
23 if( empty( $panels_data ) ) {
24 return '';
25 }
26 }
27 if ( empty( $layout_data ) ) {
28 $layout_data = $this->get_panels_layout_data( $panels_data );
29 $layout_data = apply_filters( 'siteorigin_panels_layout_data', $layout_data, $post_id );
30 }
31
32 // Get some of the default settings
33 $settings = siteorigin_panels_setting();
34 $panels_tablet_width = $settings['tablet-width'];
35 $panels_mobile_width = $settings['mobile-width'];
36 $panels_margin_bottom = $settings['margin-bottom'];
37 $panels_margin_bottom_last_row = $settings['margin-bottom-last-row'];
38
39 $css = new SiteOrigin_Panels_Css_Builder();
40
41 $ci = 0;
42 foreach ( $layout_data as $ri => $row ) {
43 if( empty( $row['cells'] ) ) continue;
44
45 // Let other themes and plugins change the gutter.
46 $gutter = apply_filters( 'siteorigin_panels_css_row_gutter', $settings['margin-sides'] . 'px', $row, $ri, $panels_data );
47 preg_match( '/([0-9\.,]+)(.*)/', $gutter, $gutter_parts );
48
49 $cell_count = count( $row['cells'] );
50
51 // Add the cell sizing
52 foreach( $row['cells'] as $ci => $cell ) {
53 $weight = apply_filters( 'siteorigin_panels_css_cell_weight', $cell['weight'], $row, $ri, $cell, $ci - 1, $panels_data, $post_id );
54
55 // Add the width and ensure we have correct formatting for CSS.
56 $css->add_cell_css( $post_id, $ri, $ci, '', array(
57 'width' => round( $weight * 100, 4 ) . '%',
58 ) );
59 }
60
61 if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
62 $css->add_cell_css( $post_id, $ri, false, '', array(
63 'float' => 'right'
64 ) );
65 }
66
67 if(
68 $ri != count( $layout_data ) - 1 ||
69 ! empty( $row[ 'style' ][ 'bottom_margin' ] ) ||
70 ! empty( $panels_margin_bottom_last_row )
71 ) {
72 // Filter the bottom margin for this row with the arguments
73 $css->add_row_css( $post_id, $ri, '', array(
74 'margin-bottom' => apply_filters( 'siteorigin_panels_css_row_margin_bottom', $panels_margin_bottom . 'px', $row, $ri, $panels_data, $post_id )
75 ) );
76 }
77
78 $margin_half = ( (float) $gutter_parts[1] / 2 ) . $gutter_parts[2];
79 $css->add_row_css($post_id, $ri, '', array(
80 'margin-left' => '-' . $margin_half,
81 'margin-right' => '-' . $margin_half,
82 ) );
83 $css->add_cell_css($post_id, $ri, false, '', array(
84 'padding-left' => $margin_half,
85 'padding-right' => $margin_half,
86 ) );
87 }
88
89 // Add the bottom margins
90 $css->add_widget_css( $post_id, false, false, false, '', array(
91 'margin-bottom' => apply_filters( 'siteorigin_panels_css_cell_margin_bottom', $panels_margin_bottom . 'px', false, false, $panels_data, $post_id )
92 ) );
93 $css->add_widget_css( $post_id, false, false, false, ':last-child', array(
94 'margin-bottom' => apply_filters( 'siteorigin_panels_css_cell_last_margin_bottom', '0px', false, false, $panels_data, $post_id )
95 ) );
96
97 if ( $settings['responsive'] ) {
98
99 $css->add_cell_css($post_id, false, false, '', array(
100 'float' => 'none',
101 'width' => 'auto'
102 ), $panels_mobile_width);
103
104 $css->add_row_css($post_id, false, '', array(
105 'margin-left' => 0,
106 'margin-right' => 0,
107 ), $panels_mobile_width);
108
109 $css->add_cell_css( $post_id, false, false, '', array(
110 'padding' => 0,
111 ), $panels_mobile_width );
112
113 // Hide empty cells on mobile
114 $css->add_row_css( $post_id, false, ' .panel-grid-cell-empty', array(
115 'display' => 'none',
116 ), $panels_mobile_width );
117
118 // Hide empty cells on mobile
119 $css->add_row_css( $post_id, false, ' .panel-grid-cell-mobile-last', array(
120 'margin-bottom' => '0px',
121 ), $panels_mobile_width );
122
123 foreach ( $layout_data as $ri => $row ) {
124 $css->add_cell_css( $post_id, $ri, false, '', array(
125 'margin-bottom' => $panels_margin_bottom . 'px',
126 ), $panels_mobile_width );
127
128 $css->add_cell_css( $post_id, $ri, false, ':last-child', array(
129 'margin-bottom' => '0px',
130 ), $panels_mobile_width );
131 }
132 }
133
134 foreach ( $panels_data['widgets'] as $widget_id => $widget ) {
135 if ( ! empty( $widget['panels_info']['style']['link_color'] ) ) {
136 $css->add_widget_css(
137 $post_id,
138 $widget['panels_info']['grid'],
139 $widget['panels_info']['cell'],
140 $widget['panels_info']['id'],
141 ' a',
142 array(
143 'color' => $widget['panels_info']['style']['link_color']
144 )
145 );
146 }
147 }
148
149 // Let other plugins and components filter the CSS object.
150 $css = apply_filters( 'siteorigin_panels_css_object', $css, $panels_data, $post_id, $layout_data );
151
152 return $css->get_css();
153 }
154
155 /**
156 * This overwrites the parent function to get the cells in reverse order when using right_on_top collapse mode.
157 *
158 * @param $cells The cells to modify
159 * @param $row The row the cells belong to
160 *
161 * @return mixed
162 */
163 protected function modify_row_cells( $cells, $row ){
164 if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
165 $cells = array_reverse( $cells, true );
166 }
167
168 return $cells;
169
170 }
171
172 public function front_css_url(){
173 return siteorigin_panels_url( 'css/front' . ( siteorigin_panels_setting( 'legacy-layout' ) ? '-legacy' : '' ) . '.css' );
174 }
175 }
176