/var/www/hkosl.com/aga/wp-content/plugins/siteorigin-panels/inc/styles.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
188
189
190
191
192
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
257
258
259
260
261
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
<?php

/**
 * Class for handling all the default styling.
 *
 * Class SiteOrigin_Panels_Default_Styles
 */
class SiteOrigin_Panels_Styles {

    public function 
__construct() {
        
add_action'wp_enqueue_scripts', array( $this'register_scripts' ), );

        
// Adding all the fields
        
add_filter'siteorigin_panels_row_style_fields', array( $this'row_style_fields' ) );
        
add_filter'siteorigin_panels_cell_style_fields', array( $this'cell_style_fields' ) );
        
add_filter'siteorigin_panels_widget_style_fields', array( $this'widget_style_fields' ) );

        
// Style wrapper attributes
        
add_filter'siteorigin_panels_row_style_attributes', array( $this'general_style_attributes' ), 10);
        
add_filter'siteorigin_panels_row_style_attributes', array( $this'row_style_attributes' ), 10);
        
add_filter'siteorigin_panels_row_style_attributes', array( $this'vantage_row_style_attributes' ), 11);
        
add_filter'siteorigin_panels_cell_style_attributes', array( $this'general_style_attributes' ), 10);
        
add_filter'siteorigin_panels_widget_style_attributes', array( $this'general_style_attributes' ), 10);

        
// Style wrapper CSS
        
add_filter'siteorigin_panels_row_style_css', array( $this'general_style_css' ), 10);
        
add_filter'siteorigin_panels_cell_style_css', array( $this'general_style_css' ), 10);
        
add_filter'siteorigin_panels_widget_style_css', array( $this'general_style_css' ), 10);

        
add_filter'siteorigin_panels_row_style_mobile_css', array( $this'general_style_mobile_css' ), 10);
        
add_filter'siteorigin_panels_cell_style_mobile_css', array( $this'general_style_mobile_css' ), 10);
        
add_filter'siteorigin_panels_widget_style_mobile_css', array( $this'general_style_mobile_css' ), 10);

        
// Main filter to add any custom CSS.
        
add_filter'siteorigin_panels_css_object', array( $this'filter_css_object' ), 10);

        
// Filtering specific attributes
        
add_filter'siteorigin_panels_css_row_margin_bottom', array( $this'filter_row_bottom_margin' ), 10);
        
add_filter'siteorigin_panels_css_row_gutter', array( $this'filter_row_gutter' ), 10);
        
add_filter'siteorigin_panels_css_widget_css', array( $this'filter_widget_style_css' ), 10);
    }

    public static function 
single() {
        static 
$single;
        return empty( 
$single ) ? $single = new self() : $single;
    }

    static function 
register_scripts() {
        
wp_register_script(
            
'siteorigin-panels-front-styles',
            
siteorigin_panels_url'js/styling' SITEORIGIN_PANELS_VERSION_SUFFIX SITEORIGIN_PANELS_JS_SUFFIX '.js' ),
            array( 
'jquery' ),
            
SITEORIGIN_PANELS_VERSION
        
);
        
wp_register_script(
            
'siteorigin-parallax',
            
siteorigin_panels_url'js/siteorigin-parallax' SITEORIGIN_PANELS_JS_SUFFIX '.js' ),
            array( 
'jquery' ),
            
SITEORIGIN_PANELS_VERSION
        
);
        
wp_localize_script'siteorigin-panels-front-styles''panelsStyles', array(
            
'fullContainer' => apply_filters'siteorigin_panels_full_width_container'siteorigin_panels_setting'full-width-container' ) )
        ) );
    }

    
/**
     * These are general styles that apply to all elements
     *
     * @param $label
     *
     * @return array
     */
    
static function get_general_style_fields$id$label ) {
        
$fields = array();

        
// All the attribute fields

        
$fields['id'] = array(
            
'name'        => sprintf__'%s ID''siteorigin-panels' ), $label ),
            
'type'        => 'text',
            
'group'       => 'attributes',
            
'description' => sprintf__'A custom ID used for this %s.''siteorigin-panels' ), strtolower$label ) ),
            
'priority'    => 4,
        );

        
$fields['class'] = array(
            
'name'        => sprintf__'%s Class''siteorigin-panels' ), $label ),
            
'type'        => 'text',
            
'group'       => 'attributes',
            
'description' => __'A CSS class''siteorigin-panels' ),
            
'priority'    => 5,
        );

        
$fields$id '_css' ] = array(
            
'name'        => __'CSS Styles''siteorigin-panels' ),
            
'type'        => 'code',
            
'group'       => 'attributes',
            
'description' => __'One style attribute per line.''siteorigin-panels' ),
            
'priority'    => 10,
        );

        
$fields'mobile_css' ] = array(
            
'name'        => __'Mobile CSS Styles''siteorigin-panels' ),
            
'type'        => 'code',
            
'group'       => 'attributes',
            
'description' => __'CSS applied when in mobile view.''siteorigin-panels' ),
            
'priority'    => 11,
        );

        
// The layout fields

        
$fields['padding'] = array(
            
'name'        => __'Padding''siteorigin-panels' ),
            
'type'        => 'measurement',
            
'group'       => 'layout',
            
'description' => sprintf__'Padding around the entire %s.''siteorigin-panels' ), strtolower$label ) ),
            
'priority'    => 7,
            
'multiple'    => true
        
);

        
$fields['mobile_padding'] = array(
            
'name'        => __'Mobile Padding''siteorigin-panels' ),
            
'type'        => 'measurement',
            
'group'       => 'layout',
            
'description' => __'Padding when on mobile devices.''siteorigin-panels' ),
            
'priority'    => 8,
            
'multiple'    => true
        
);

        
// The general design fields

        
$fields['background'] = array(
            
'name'        => __'Background Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => sprintf__'Background color of the %s.''siteorigin-panels' ), strtolower$label ) ),
            
'priority'    => 5,
        );

        
$fields['background_image_attachment'] = array(
            
'name'        => __'Background Image''siteorigin-panels' ),
            
'type'        => 'image',
            
'group'       => 'design',
            
'description' => sprintf__'Background image of the %s.''siteorigin-panels' ), strtolower$label ) ),
            
'priority'    => 6,
        );

        
$fields['background_display'] = array(
            
'name'        => __'Background Image Display''siteorigin-panels' ),
            
'type'        => 'select',
            
'group'       => 'design',
            
'options'     => array(
                
'tile'              => __'Tiled Image''siteorigin-panels' ),
                
'cover'             => __'Cover''siteorigin-panels' ),
                
'center'            => __'Centered, with original size''siteorigin-panels' ),
                
'contain'           => __'Contain''siteorigin-panels' ),
                
'fixed'             => __'Fixed''siteorigin-panels' ),
                
'parallax'          => __'Parallax''siteorigin-panels' ),
                
'parallax-original' => __'Parallax (Original Size)''siteorigin-panels' ),
            ),
            
'description' => __'How the background image is displayed.''siteorigin-panels' ),
            
'priority'    => 7,
        );

        
$fields['border_color'] = array(
            
'name'        => __'Border Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => sprintf__'Border color of the %s.''siteorigin-panels' ), strtolower$label ) ),
            
'priority'    => 10,
        );

        return 
$fields;
    }

    
/**
     * All the row styling fields
     *
     * @param $fields
     *
     * @return array
     */
    
static function row_style_fields$fields ) {
        
// Add the general fields
        
$fields wp_parse_args$fieldsself::get_general_style_fields'row'__'Row''siteorigin-panels' ) ) );

        
$fields['cell_class'] = array(
            
'name'        => __'Cell Class''siteorigin-panels' ),
            
'type'        => 'text',
            
'group'       => 'attributes',
            
'description' => __'Class added to all cells in this row.''siteorigin-panels' ),
            
'priority'    => 6,
        );

        
// Add the layout fields

        
$fields['bottom_margin'] = array(
            
'name'        => __'Bottom Margin''siteorigin-panels' ),
            
'type'        => 'measurement',
            
'group'       => 'layout',
            
'description' => sprintf__'Space below the row. Default is %spx.''siteorigin-panels' ), siteorigin_panels_setting'margin-bottom' ) ),
            
'priority'    => 5,
        );

        
$fields['gutter'] = array(
            
'name'        => __'Gutter''siteorigin-panels' ),
            
'type'        => 'measurement',
            
'group'       => 'layout',
            
'description' => sprintf__'Amount of space between cells. Default is %spx.''siteorigin-panels' ), siteorigin_panels_setting'margin-sides' ) ),
            
'priority'    => 6,
        );

        
$fields['row_stretch'] = array(
            
'name'     => __'Row Layout''siteorigin-panels' ),
            
'type'     => 'select',
            
'group'    => 'layout',
            
'options'  => array(
                
''               => __'Standard''siteorigin-panels' ),
                
'full'           => __'Full Width''siteorigin-panels' ),
                
'full-stretched' => __'Full Width Stretched''siteorigin-panels' ),
                
'full-stretched-padded' => __'Full Width Stretched Padded''siteorigin-panels' ),
            ),
            
'priority' => 10,
        );

        
$fields['collapse_behaviour'] = array(
            
'name'     => __'Collapse Behaviour''siteorigin-panels' ),
            
'type'     => 'select',
            
'group'    => 'layout',
            
'options'  => array(
                
''               => __'Standard''siteorigin-panels' ),
                
'no_collapse'    => __'No Collapse''siteorigin-panels' ),
            ),
            
'priority' => 15,
        );

        
$fields['collapse_order'] = array(
            
'name'     => __'Collapse Order''siteorigin-panels' ),
            
'type'     => 'select',
            
'group'    => 'layout',
            
'options'  => array(
                
''          => __'Default''siteorigin-panels' ),
                
'left-top'  => __'Left on Top''siteorigin-panels' ),
                
'right-top' => __'Right on Top''siteorigin-panels' ),
            ),
            
'priority' => 16,
        );

        if ( 
siteorigin_panels_setting'legacy-layout' ) != 'always'  ) {
            
$fields['cell_alignment'] = array(
                
'name'     => __'Cell Vertical Alignment''siteorigin-panels' ),
                
'type'     => 'select',
                
'group'    => 'layout',
                
'options'  => array(
                    
'flex-start' => __'Top''siteorigin-panels' ),
                    
'center'     => __'Center''siteorigin-panels' ),
                    
'flex-end'   => __'Bottom''siteorigin-panels' ),
                    
'stretch'    => __'Stretch''siteorigin-panels' ),
                ),
                
'priority' => 17,
            );
        }

        return 
$fields;
    }

    
/**
     * All the cell styling fields
     *
     * @param $fields
     *
     * @return array
     */
    
static function cell_style_fields$fields ) {
        
// Add the general fields
        
$fields wp_parse_args$fieldsself::get_general_style_fields'cell'__'Cell''siteorigin-panels' ) ) );

        
$fields['vertical_alignment'] = array(
            
'name'     => __'Vertical Alignment''siteorigin-panels' ),
            
'type'     => 'select',
            
'group'    => 'layout',
            
'options'  => array(
                
'auto'       => __'Use row setting''siteorigin-panels' ),
                
'flex-start' => __'Top''siteorigin-panels' ),
                
'center'     => __'Center''siteorigin-panels' ),
                
'flex-end'   => __'Bottom''siteorigin-panels' ),
                
'stretch'    => __'Stretch''siteorigin-panels' ),
            ),
            
'priority' => 16,
        );

        
$fields['font_color'] = array(
            
'name'        => __'Font Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => __'Color of text inside this cell.''siteorigin-panels' ),
            
'priority'    => 15,
        );

        
$fields['link_color'] = array(
            
'name'        => __'Links Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => __'Color of links inside this cell.''siteorigin-panels' ),
            
'priority'    => 16,
        );

        return 
$fields;
    }

    
/**
     * @param $fields
     *
     * @return array
     */
    
static function widget_style_fields$fields ) {

        
// Add the general fields
        
$fields wp_parse_args$fieldsself::get_general_style_fields'widget'__'Widget''siteorigin-panels' ) ) );
        
        
$fields['margin'] = array(
            
'name'        => __'Margin''siteorigin-panels' ),
            
'type'        => 'measurement',
            
'group'       => 'layout',
            
'description' => __'Margins around the widget.''siteorigin-panels' ),
            
'priority'    => 6,
            
'multiple'    => true
        
);

        
// How lets add the design fields

        
$fields['font_color'] = array(
            
'name'        => __'Font Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => __'Color of text inside this widget.''siteorigin-panels' ),
            
'priority'    => 15,
        );

        
$fields['link_color'] = array(
            
'name'        => __'Links Color''siteorigin-panels' ),
            
'type'        => 'color',
            
'group'       => 'design',
            
'description' => __'Color of links inside this widget.''siteorigin-panels' ),
            
'priority'    => 16,
        );

        return 
$fields;
    }

    
/**
     * Style attributes that apply to rows, cells and widgets
     *
     * @param $attributes
     * @param $style
     *
     * @return array $attributes
     */
    
static function general_style_attributes$attributes$style ){
        if ( ! empty( 
$style['class'] ) ) {
            if( ! 
is_array$style['class'] ) ) {
                
$style['class'] = explode' '$style'class' ] );
            }
            
$attributes['class'] = array_merge$attributes['class'], $style['class'] );
        }

        if ( ! empty( 
$style['background_display'] ) &&
             ! empty( 
$style['background_image_attachment'] )
        ) {
            
            
$url self::get_attachment_image_src$style['background_image_attachment'], 'full' );

            if (
                ! empty( 
$url ) &&
                ( 
$style['background_display'] == 'parallax' || $style['background_display'] == 'parallax-original' )
            ) {
                
wp_enqueue_script'siteorigin-parallax' );
                
$parallax_args                          = array(
                    
'backgroundUrl'    => $url[0],
                    
'backgroundSize'   => array( $url[1], $url[2] ),
                    
'backgroundSizing' => $style['background_display'] == 'parallax-original' 'original' 'scaled',
                    
'limitMotion'      => siteorigin_panels_setting'parallax-motion' ) ? floatvalsiteorigin_panels_setting'parallax-motion' ) ) : 'auto',
                );
                
$attributes['data-siteorigin-parallax'] = json_encode$parallax_args );
            }
        }

        if ( ! empty( 
$style['id'] ) ) {
            
$attributes['id'] = sanitize_html_class$style['id'] );
        }

        return 
$attributes;
    }

    static function 
row_style_attributes$attributes$style ) {
        if ( ! empty( 
$style['row_stretch'] ) ) {
            
$attributes['class'][]           = 'siteorigin-panels-stretch';
            
$attributes['data-stretch-type'] = $style['row_stretch'];
            
wp_enqueue_script'siteorigin-panels-front-styles' );
        }

        return 
$attributes;
    }

    static function 
vantage_row_style_attributes$attributes$style ) {
        if ( isset( 
$style['class'] ) && $style['class'] == 'wide-grey' && ! empty( $attributes['style'] ) ) {
            
$attributes['style'] = preg_replace'/padding-left: 1000px; padding-right: 1000px;/'''$attributes['style'] );
        }

        return 
$attributes;
    }

    
/**
     * Get the CSS styles that apply to all rows, cells and widgets
     *
     * @param $css
     * @param $style
     *
     * @return mixed
     */
    
static function general_style_css$css$style ){

        if ( ! empty( 
$style['background'] ) ) {
            
$css'background-color' ] = $style['background'];
        }

        if ( ! empty( 
$style['background_display'] ) &&
             ! ( empty( 
$style['background_image_attachment'] ) && empty( $style['background_image_attachment_fallback'] ) )
        ) {
            
$url self::get_attachment_image_src$style['background_image_attachment'], 'full' );
            
            if ( empty( 
$url ) && ! empty( $style['background_image_attachment_fallback'] ) ) {
                
$url $style['background_image_attachment_fallback'];
            }

            if ( ! empty( 
$url ) ) {
                
$css['background-image'] = 'url(' .( is_array$url ) ? $url[0] : $url ) . ')';

                switch ( 
$style['background_display'] ) {
                    case 
'parallax':
                    case 
'parallax-original':
                        
$css'background-position' ] = 'center center';
                        
$css'background-repeat' ] = 'no-repeat';
                        break;
                    case 
'tile':
                        
$css'background-repeat' ] = 'repeat';
                        break;
                    case 
'cover':
                        
$css'background-position' ] = 'center center';
                        
$css'background-size' ] = 'cover';
                        break;
                    case 
'contain':
                        
$css'background-size' ] = 'contain';
                        break;
                    case 
'center':
                        
$css'background-position' ] = 'center center';
                        
$css'background-repeat' ] = 'no-repeat';
                        break;
                    case 
'fixed':
                        
$css'background-attachment' ] = 'fixed';
                        
$css'background-position' ] = 'center center';
                        
$css'background-size' ] = 'cover';
                        break;
                }
            }
        }

        if ( ! empty( 
$style'border_color' ] ) ) {
            
$css'border' ] = '1px solid ' $style['border_color'];
        }

        if ( ! empty( 
$style'font_color' ] ) ) {
            
$css'color' ] = $style['font_color'];
        }

        if( ! empty( 
$style'padding' ] ) ) {
            
$css['padding'] = $style'padding' ];
        }

        
// Find which key the CSS is stored in
        
foreach( array( 'row_css''cell_css''widget_css''' ) as $css_key ) {
            if( empty( 
$css_key ) || ! empty( $style$css_key ] ) ) {
                break;
            }
        }
        if ( ! empty( 
$css_key ) && ! empty( $style$css_key ] ) ) {
            
preg_match_all'/^([A-Za-z0-9\-]+?):(.+?);?$/m'$style$css_key ], $matches );

            if ( ! empty( 
$matches[0] ) ) {
                for ( 
$i 0$i count$matches[0] ); $i ++ ) {
                    
$css$matches[1][ $i ] ] = $matches[2][ $i ];
                }
            }
        }

        return 
$css;
    }

    
/**
     * Get the mobile styling for rows, cells and widgets
     *
     * @param $css
     * @param $style
     *
     * @return mixed
     */
    
static function general_style_mobile_css$css$style ){
        if( ! empty( 
$style['mobile_padding'] ) ) {
            
$css['padding'] = $style'mobile_padding' ];
        }
        
        if ( ! empty( 
$style['background_display'] ) &&
             
$style['background_display'] == 'fixed'  &&
             ! ( empty( 
$style['background_image_attachment'] ) && empty( $style['background_image_attachment_fallback'] ) )
        ) {
            
$css'background-attachment' ] = 'scroll';
        }

        if ( ! empty( 
$style'mobile_css' ] ) ) {
            
preg_match_all'/^([A-Za-z0-9\-]+?):(.+?);?$/m'$style'mobile_css' ], $matches );

            if ( ! empty( 
$matches[0] ) ) {
                for ( 
$i 0$i count$matches[0] ); $i ++ ) {
                    
$css$matches[1][ $i ] ] = $matches[2][ $i ];
                }
            }
        }

        return 
$css;
    }

    
/**
     * @param SiteOrigin_Panels_Css_Builder $css
     * @param $panels_data
     * @param $post_id
     *
     * @return mixed
     */
    
static function filter_css_object$css$panels_data$post_id$layout ) {
        
$mobile_width siteorigin_panels_setting'mobile-width' );
        if( empty( 
$layout ) ) {
            return 
$css;
        }

        foreach( 
$layout as $ri => $row ) {
            if( empty( 
$row'style' ] ) ) $row'style' ] = array();

            
$standard_css apply_filters'siteorigin_panels_row_style_css', array(), $row['style'] );
            
$mobile_css apply_filters'siteorigin_panels_row_style_mobile_css', array(), $row['style'] );

            if ( ! empty( 
$standard_css ) ) {
                
$css->add_row_css(
                    
$post_id,
                    
$ri,
                    
'> .panel-row-style',
                    
$standard_css
                
);
            }
            if ( ! empty( 
$mobile_css ) ) {
                
$css->add_row_css(
                    
$post_id,
                    
$ri,
                    
'> .panel-row-style',
                    
$mobile_css,
                    
$mobile_width
                
);
            }

            
// Add in flexbox alignment to the main row element
            
if ( siteorigin_panels_setting'legacy-layout' ) != 'always' && ! SiteOrigin_Panels::is_legacy_browser() && ! empty( $row['style']['cell_alignment'] ) ) {
                
$css->add_row_css(
                    
$post_id,
                    
$ri,
                    array( 
'.panel-no-style''.panel-has-style > .panel-row-style' ),
                    array(
                        
'-webkit-align-items' => $row['style']['cell_alignment'],
                        
'align-items'         => $row['style']['cell_alignment'],
                    )
                );
            }

            
// Process the cells if there are any
            
if( empty( $row'cells' ] ) ) continue;

            foreach( 
$row'cells' ] as $ci => $cell ) {
                if( empty( 
$cell'style' ] ) ) $cell'style' ] = array();

                
$standard_css apply_filters'siteorigin_panels_cell_style_css', array(), $cell['style'] );
                
$mobile_css apply_filters'siteorigin_panels_cell_style_mobile_css', array(), $cell['style'] );

                if ( ! empty( 
$standard_css ) ) {
                    
$css->add_cell_css(
                        
$post_id,
                        
$ri,
                        
$ci,
                        
'> .panel-cell-style',
                        
$standard_css
                    
);
                }
                if ( ! empty( 
$mobile_css ) ) {
                    
$css->add_cell_css(
                        
$post_id,
                        
$ri,
                        
$ci,
                        
'> .panel-cell-style',
                        
$mobile_css,
                        
$mobile_width
                    
);
                }

                if ( ! empty( 
$cell'style' ]['vertical_alignment'] ) ) {
                    
$css->add_cell_css(
                        
$post_id,
                        
$ri,
                        
$ci,
                        
'',
                        array(
                            
'align-self' => $cell'style' ]['vertical_alignment']
                        )
                    );
                }

                
// Process the widgets if there are any
                
if( empty( $cell'widgets' ] ) ) continue;

                foreach( 
$cell['widgets'] as $wi => $widget ) {
                    if ( empty( 
$widget['panels_info'] ) ) continue;
                    if ( empty( 
$widget['panels_info']['style'] ) ) $widget['panels_info']['style'] = array();

                    
$standard_css apply_filters'siteorigin_panels_widget_style_css', array(), $widget['panels_info']['style'] );
                    
$mobile_css apply_filters'siteorigin_panels_widget_style_mobile_css', array(), $widget['panels_info']['style'] );

                    if( ! empty( 
$standard_css ) ) {
                        
$css->add_widget_css(
                            
$post_id,
                            
$ri,
                            
$ci,
                            
$wi,
                            
'> .panel-widget-style',
                            
$standard_css
                        
);
                    }

                    if( ! empty( 
$mobile_css ) ) {
                        
$css->add_widget_css(
                            
$post_id,
                            
$ri,
                            
$ci,
                            
$wi,
                            
'> .panel-widget-style',
                            
$mobile_css,
                            
$mobile_width
                        
);
                    }
                    
                    if ( ! empty( 
$widget['panels_info']['style']['link_color'] ) ) {
                        
$css->add_widget_css$post_id$ri$ci$wi' a', array(
                            
'color' => $widget['panels_info']['style']['link_color']
                        ) );
                    }
                }
            }
        }

        return 
$css;
    }

    static function 
filter_row_bottom_margin$margin$grid ) {
        if ( ! empty( 
$grid['style']['bottom_margin'] ) ) {
            
$margin $grid['style']['bottom_margin'];
        }

        return 
$margin;
    }

    static function 
filter_row_gutter$gutter$grid ) {
        if ( ! empty( 
$grid['style']['gutter'] ) ) {
            
$gutter $grid['style']['gutter'];
        }

        return 
$gutter;
    }
    
    
/**
     * Adds widget specific styles not included in the general style fields.
     *
     * @param $widget_css The CSS properties and values
     * @param $widget_style_data The style settings as obtained from the style fields.
     *
     * @return mixed
     */
    
static function filter_widget_style_css$widget_css$widget_style_data ) {
        if ( ! empty( 
$widget_style_data['margin'] ) ) {
            
$widget_css['margin'] = $widget_style_data['margin'];
        }
        
        return 
$widget_css;
    }
    
    public static function 
get_attachment_image_src$image$size 'full' ){
        if( empty( 
$image ) ) {
            return 
false;
        }
        else if( 
is_numeric$image ) ) {
            return 
wp_get_attachment_image_src$image$size );
        }
        else if( 
is_string$image ) ) {
            
preg_match'/(.*?)\#([0-9]+)x([0-9]+)$/'$image$matches );
            return ! empty( 
$matches ) ? $matches false;
        }
    }

}