Completed
Push — master ( ea40a4...a4569a )
by
unknown
02:51
created

public/includes/components.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 15 and the first side effect is on line 111.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * The functions in this file register the components that will be shown in the component drop-up menu
4
 * and are filterable and pluggable
5
 *
6
 */
7
8
/**
9
 * Build an array of components that will be shown in the
10
 * component drop-up menu on click
11
 *
12
 * @return array of components
13
 * @since 1.0
14
 */
15
function lasso_editor_components() {
16
17
	$array = array(
18
		'quote' => array(
19
			'name'    => __('Quote','lasso'),
20
			'content' => lasso_quote_component(),
21
		),
22
		'image' => array(
23
			'name'    => __('Image','lasso'),
24
			'content' => lasso_image_component(),
25
		),
26
		'parallax' => array(
27
			'name'    => __('Parallax','lasso'),
28
			'content' => lasso_parallax_component(),
29
		),
30
		'audio' => array(
31
			'name'    => __('Audio','lasso'),
32
			'content' => lasso_audio_component(),
33
		),
34
		'content' => array(
35
			'name'    => __('Content','lasso'),
36
			'content' => lasso_content_component(),
37
		),
38
		'character' => array(
39
			'name'    => __('Character','lasso'),
40
			'content' => lasso_character_component(),
41
		),
42
		'collection' => array(
43
			'name'    => __('Collection','lasso'),
44
			'content' => lasso_collections_component(),
45
		),
46
		'document' => array(
47
			'name'    => __('Document','lasso'),
48
			'content' => lasso_document_component(),
49
		),
50
		'gallery' => array(
51
			'name'    => __('Gallery','lasso'),
52
			'content' => lasso_gallery_component(),
53
		),
54
		'chapter' => array(
55
			'name'    => __('Chapter','lasso'),
56
			'content' => lasso_heading_component(),
57
		),
58
		'map' => array(
59
			'name'    => __('Map','lasso'),
60
			'content' => lasso_map_component(),
61
		),
62
		'timeline_stop' => array(
63
			'name'    => __('Timeline','lasso'),
64
			'content' => lasso_timeline_component(),
65
		),
66
		'video' => array(
67
			'name'    => __('Video','lasso'),
68
			'content' => lasso_video_component(),
69
		),
70
		'wpimg' => array(
71
			'name'    => __('WordPress Image','lasso'),
72
			'content' => lasso_wp_image(),
73
		),
74
		'wpquote' => array(
75
			'name'    => __('WordPress Quote','lasso'),
76
			'content' => lasso_wp_quote(),
77
		)
78
	);
79
80
	return apply_filters( 'lasso_components', $array );
81
}
82
83
/**
84
 * Here each of the components content is being registered and retrieved above
85
 *
86
 * Notes:  - these functions are pluggable
87
 *     - custom modules must have data-component-type="whatever"
88
 *   - custom modules must have all options as data-attributes if utilizing settings panel
89
 *
90
 * 1.  Quote
91
 * 2.  Image
92
 * 3. Parallax
93
 * 4. Audio
94
 * 5. Content
95
 * 6. Character
96
 * 7. Collections
97
 * 8. Document
98
 * 9. Gallery
99
 * 10. Heading
100
 * 11. Map
101
 * 12. Timeline
102
 * 13. Video
103
 */
104
105
// 1
106
if ( !function_exists( 'lasso_quote_component' ) ):
107
	function lasso_quote_component() {
108
109
		return do_shortcode( '[aesop_quote quote="The Universe is made of stories, not of atoms."]' );
110
	}
111
endif;
112
113
// 2
114
if ( !function_exists( 'lasso_image_component' ) ):
115
	function lasso_image_component() {
116
117
		return do_shortcode( '[aesop_image img="'.LASSO_URL.'/public/assets/img/empty-img.png" align="center" imgwidth="800px"]' );
118
	}
119
endif;
120
121
// 3
122
if ( !function_exists( 'lasso_parallax_component' ) ):
123
	function lasso_parallax_component() {
124
125
		return do_shortcode( '[aesop_parallax img="'.LASSO_URL.'/public/assets/img/empty-img.png"]' );
126
	}
127
endif;
128
129
// 4
130
if ( !function_exists( 'lasso_audio_component' ) ):
131
	function lasso_audio_component() {
132
133
		return do_shortcode( '[aesop_audio src="http://users.skynet.be/fa046054/home/P22/track06.mp3"]' );
134
135
	}
136
endif;
137
138
// 5
139
if ( !function_exists( 'lasso_content_component' ) ):
140
	function lasso_content_component() {
141
142
		return do_shortcode( '[aesop_content]Start typing here...[/aesop_content]' );
143
	}
144
endif;
145
146
// 6
147
if ( !function_exists( 'lasso_character_component' ) ):
148
	function lasso_character_component() {
149
150
		return do_shortcode( '[aesop_character img="'.LASSO_URL.'/public/assets/img/empty-img.png" name="Joes Apartment" width="150px"]' );
151
152
	}
153
endif;
154
155
// 7
156
if ( !function_exists( 'lasso_collections_component' ) ):
157
	function lasso_collections_component() {
158
159
		return do_shortcode( '[aesop_collection]' );
160
	}
161
endif;
162
163
// 8
164
if ( !function_exists( 'lasso_document_component' ) ):
165
	function lasso_document_component() {
166
167
		return do_shortcode( '[aesop_document src="'.LASSO_URL.'/public/assets/img/empty-img.png" ]' );
168
169
	}
170
endif;
171
172
// 9
173
if ( !function_exists( 'lasso_gallery_component' ) ):
174
	function lasso_gallery_component() {
175
176
		return do_shortcode( '[aesop_gallery]' );
177
178
	}
179
endif;
180
181
// 10
182
if ( !function_exists( 'lasso_heading_component' ) ):
183
	function lasso_heading_component() {
184
185
		return do_shortcode( '[aesop_chapter title="Chapter One" img="'.LASSO_URL.'/public/assets/img/empty-img.png" full="on"]' );
186
	}
187
endif;
188
189
// 11
190
if ( !function_exists( 'lasso_map_component' ) ):
191
	function lasso_map_component() {
192
193
		return '<form id="lasso--map-form" class="aesop-component aesop-map-component lasso--map-drag-holder" enctype="multipart/form-data">
194
				'.lasso_map_form_footer().'
195
				'.do_shortcode( '[aesop_map sticky="off"]' ).'
196
			</form>';
197
198
	}
199
endif;
200
201
// 12
202
if ( !function_exists( 'lasso_timeline_component' ) ):
203
	function lasso_timeline_component() {
204
205
		return do_shortcode( '[aesop_timeline_stop num="Title" title="2014"]' );
206
207
	}
208
endif;
209
210
// 13
211
if ( !function_exists( 'lasso_video_component' ) ):
212
	function lasso_video_component() {
213
214
		return do_shortcode( '[aesop_video id="59940289" width="100%" align="center"]' );
215
216
	}
217
endif;
218
219
// 14 - since 0.9.1
220
if ( !function_exists('lasso_wp_image') ):
221
222
	function lasso_wp_image(){
223
		return '<div data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img class="wp-image-0" src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>';
224
	}
225
226
endif;
227
228
// 15 - since 0.9.2
229
if ( !function_exists('lasso_wp_quote') ):
230
231
	function lasso_wp_quote(){
232
		return '<blockquote data-component-type="wpquote" class="lasso--wpquote lasso-component"><p>The universe is made of stories.</p></blockquote>';
233
	}
234
235
endif;
236
237
238
239
240