PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/shared/shortcodes/shortcodes/column.php

https://github.com/deltafactory/landing-pages
PHP | 170 lines | 136 code | 14 blank | 20 comment | 14 complexity | c22fb5a56f9005133d8580b621519ea1 MD5 | raw file
  1<?php
  2/**
  3*	Columns Shortcode
  4*/
  5
  6/* 	Shortcode generator config
  7 * 	----------------------------------------------------- */
  8	$shortcodes_config['columns'] = array(
  9		'no_preview' => true,
 10		'options' => array(
 11			'gutter' => array(
 12				'name' => __('Gutter Width', 'leads'),
 13				'desc' => __('A space between the columns.', 'leads'),
 14				'type' => 'select',
 15				'options' => array(
 16					'20' => '20px',
 17					'30' => '30px'
 18				),
 19				'std' => ''
 20			),
 21			'set' => array(
 22				'name' => __('Column Set', 'leads'),
 23				'desc' => __('Select the set.', 'leads'),
 24				'type' => 'select',
 25				'options' => array(
 26					'[one_full]Content goes here[/one_full]' => '1/1',
 27					'[one_half]Content goes here[/one_half][one_half]Content goes here[/one_half]' => '1/2 + 1/2',
 28					'[one_third]Content goes here[/one_third][one_third]Content goes here[/one_third][one_third]Content goes here[/one_third]' => '1/3 + 1/3 + 1/3',
 29					'[two_third]Content goes here[/two_third][one_third]Content goes here[/one_third]' => '2/3 + 1/3',
 30					'[one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/4 + 1/4 + 1/4 + 1/4',
 31					'[one_half]Content goes here[/one_half][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/2 + 1/4 + 1/4',
 32					'[three_fourth]Content goes here[/three_fourth][one_fourth]Content goes here[/one_fourth]' => '3/4 + 1/4',
 33					'[one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '1/5 + 1/5 + 1/5 + 1/5 + 1/5',
 34					'[two_fifth]Content goes here[/two_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '2/5 + 1/5 + 1/5 + 1/5',
 35					'[three_fifth]Content goes here[/three_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '3/5 + 1/5 + 1/5',
 36					'[four_fifth]Content goes here[/four_fifth][one_fifth]Content goes here[/one_fifth]' => '4/5 + 1/5',
 37				),
 38				'std' => ''
 39			)
 40		),
 41		'shortcode' => '[columns gutter="{{gutter}}"]{{set}}[/columns]',
 42		'popup_title' => 'Insert Column Shortcode'
 43	);
 44
 45/* 	Page builder module config
 46 * 	----------------------------------------------------- */
 47	$freshbuilder_modules['column'] = array(
 48		'name' => __('Column', 'leads'),
 49		'size' => 'one_fifth',
 50		'options' => array(
 51			'content' => array(
 52				'name' => __('Column Content', 'leads'),
 53				'desc' => __('Enter the column content', 'leads'),
 54				'type' => 'textarea',
 55				'std' => '',
 56				'class' => 'wide',
 57				'is_content' => '1'
 58			)
 59		)
 60	);
 61
 62/* 	Add shortcode
 63 * 	----------------------------------------------------- */
 64	/* Columns Wrap */
 65	if (!function_exists('inbound_shortcode_columns')) {
 66		function inbound_shortcode_columns( $atts, $content = null ) {
 67			extract(shortcode_atts(array(
 68				'gutter' => '20'
 69			), $atts));
 70
 71			if( $gutter == '30') {
 72				$gutter = 'inbound-row_30';
 73			} else {
 74				$gutter = 'inbound-row';
 75			}
 76			$content = preg_replace('/<br class=\'inbr\'.*\/>/', '', $content); // remove editor br tags
 77			return '<div class="'. $gutter .'">' . do_shortcode($content) . '</div>';
 78		}
 79	}
 80	add_shortcode('columns', 'inbound_shortcode_columns');
 81
 82	/* Full column */
 83	if (!function_exists('inbound_shortcode_full_columns')) {
 84		function inbound_shortcode_full_columns( $atts, $content = null ) {
 85			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
 86			return '<div class="inbound-grid full">' . do_shortcode($content) . '</div>';
 87		}
 88	}
 89	add_shortcode('one_full', 'inbound_shortcode_full_columns');
 90
 91	/* One Half */
 92	if (!function_exists('inbound_shortcode_one_half_columns')) {
 93		function inbound_shortcode_one_half_columns( $atts, $content = null ) {
 94			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
 95			return '<div class="inbound-grid one-half">' . do_shortcode($content) . '</div>';
 96		}
 97	}
 98	add_shortcode('one_half', 'inbound_shortcode_one_half_columns');
 99
100	/* One Third */
101	if (!function_exists('inbound_shortcode_one_third_columns')) {
102		function inbound_shortcode_one_third_columns( $atts, $content = null ) {
103			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
104			return '<div class="inbound-grid one-third">' . do_shortcode($content) . '</div>';
105		}
106	}
107	add_shortcode('one_third', 'inbound_shortcode_one_third_columns');
108
109	/* Two Third */
110	if (!function_exists('inbound_shortcode_two_third_columns')) {
111		function inbound_shortcode_two_third_columns( $atts, $content = null ) {
112			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
113			return '<div class="inbound-grid two-third">' . do_shortcode($content) . '</div>';
114		}
115	}
116	add_shortcode('two_third', 'inbound_shortcode_two_third_columns');
117
118	/* One Fourth */
119	if (!function_exists('inbound_shortcode_one_fourth_columns')) {
120		function inbound_shortcode_one_fourth_columns( $atts, $content = null ) {
121			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
122			return '<div class="inbound-grid one-fourth">' . do_shortcode($content) . '</div>';
123		}
124	}
125	add_shortcode('one_fourth', 'inbound_shortcode_one_fourth_columns');
126
127	/* Three Fourth */
128	if (!function_exists('inbound_shortcode_three_fourth_columns')) {
129		function inbound_shortcode_three_fourth_columns( $atts, $content = null ) {
130			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
131			return '<div class="inbound-grid three-fourth">' . do_shortcode($content) . '</div>';
132		}
133	}
134	add_shortcode('three_fourth', 'inbound_shortcode_three_fourth_columns');
135
136	/* One Fifth */
137	if (!function_exists('inbound_shortcode_one_fifth_columns')) {
138		function inbound_shortcode_one_fifth_columns( $atts, $content = null ) {
139			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
140			return '<div class="inbound-grid one-fifth">' . do_shortcode($content) . '</div>';
141		}
142	}
143	add_shortcode('one_fifth', 'inbound_shortcode_one_fifth_columns');
144
145	/* Two Fifth */
146	if (!function_exists('inbound_shortcode_two_fifth_columns')) {
147		function inbound_shortcode_two_fifth_columns( $atts, $content = null ) {
148			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
149			return '<div class="inbound-inbound-grid two-fifth">' . do_shortcode($content) . '</div>';
150		}
151	}
152	add_shortcode('two_fifth', 'inbound_shortcode_two_fifth_columns');
153
154	/* Three Fifth */
155	if (!function_exists('inbound_shortcode_three_fifth_columns')) {
156		function inbound_shortcode_three_fifth_columns( $atts, $content = null ) {
157			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
158			return '<div class="inbound-inbound-grid three-fifth">' . do_shortcode($content) . '</div>';
159		}
160	}
161	add_shortcode('three_fifth', 'inbound_shortcode_three_fifth_columns');
162
163	/* Four Fifth */
164	if (!function_exists('inbound_shortcode_four_fifth_columns')) {
165		function inbound_shortcode_four_fifth_columns( $atts, $content = null ) {
166			$content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
167			return '<div class="inbound-inbound-grid three-four">' . do_shortcode($content) . '</div>';
168		}
169	}
170	add_shortcode('three_four', 'inbound_shortcode_four_fifth_columns');