PluginProbe
WP Ultimate Post Grid / 2.8.0
WP Ultimate Post Grid v2.8.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / vendor / vafpress / data / sources.php

sources.php in WP Ultimate Post Grid 2.8.0, at vendor/vafpress/data/sources.php

232 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Here is the place to put your own defined function that serve as
5 * datasource to field with multiple options.
6 */
7
8 function vp_get_categories()
9 {
10 $wp_cat = get_categories(array('hide_empty' => 0 ));
11
12 $result = array();
13 foreach ($wp_cat as $cat)
14 {
15 $result[] = array('value' => $cat->cat_ID, 'label' => $cat->name);
16 }
17 return $result;
18 }
19
20 function vp_get_users()
21 {
22 $wp_users = VP_WP_User::get_users();
23
24 $result = array();
25 foreach ($wp_users as $user)
26 {
27 $result[] = array('value' => $user['id'], 'label' => $user['display_name']);
28 }
29 return $result;
30 }
31
32 function vp_get_posts()
33 {
34 $wp_posts = get_posts(array(
35 'posts_per_page' => -1,
36 ));
37
38 $result = array();
39 foreach ($wp_posts as $post)
40 {
41 $result[] = array('value' => $post->ID, 'label' => $post->post_title);
42 }
43 return $result;
44 }
45
46 function vp_get_pages()
47 {
48 $wp_pages = get_pages();
49
50 $result = array();
51 foreach ($wp_pages as $page)
52 {
53 $result[] = array('value' => $page->ID, 'label' => $page->post_title);
54 }
55 return $result;
56 }
57
58 function vp_get_tags()
59 {
60 $wp_tags = get_tags(array('hide_empty' => 0));
61 $result = array();
62 foreach ($wp_tags as $tag)
63 {
64 $result[] = array('value' => $tag->term_id, 'label' => $tag->name);
65 }
66 return $result;
67 }
68
69 function vp_get_roles()
70 {
71 $result = array();
72 $editable_roles = VP_WP_User::get_editable_roles();
73
74 foreach ($editable_roles as $key => $role)
75 {
76 $result[] = array('value' => $key, 'label' => $role['name']);
77 }
78
79 return $result;
80 }
81
82 function vp_get_gwf_family()
83 {
84 $fonts = file_get_contents(dirname(__FILE__) . '/gwf.json');
85 $fonts = json_decode($fonts);
86
87 $fonts = array_keys(get_object_vars($fonts));
88
89 foreach ($fonts as $font)
90 {
91 $result[] = array('value' => $font, 'label' => $font);
92 }
93
94 return $result;
95 }
96
97 VP_Security::instance()->whitelist_function('vp_get_gwf_weight');
98
99 function vp_get_gwf_weight($face)
100 {
101 if(empty($face))
102 return array();
103
104 $fonts = file_get_contents(dirname(__FILE__) . '/gwf.json');
105 $fonts = json_decode($fonts);
106 if( !property_exists($fonts, $face) )
107 return null;
108 $weights = $fonts->{$face}->weights;
109
110 foreach ($weights as $weight)
111 {
112 $result[] = array('value' => $weight, 'label' => $weight);
113 }
114
115 return $result;
116 }
117
118 VP_Security::instance()->whitelist_function('vp_get_gwf_style');
119
120 function vp_get_gwf_style($face)
121 {
122 if(empty($face))
123 return array();
124
125 $fonts = file_get_contents(dirname(__FILE__) . '/gwf.json');
126 $fonts = json_decode($fonts);
127 if( !property_exists($fonts, $face) )
128 return null;
129 $styles = $fonts->{$face}->styles;
130
131 foreach ($styles as $style)
132 {
133 $result[] = array('value' => $style, 'label' => $style);
134 }
135
136 return $result;
137 }
138
139 VP_Security::instance()->whitelist_function('vp_get_gwf_subset');
140
141 function vp_get_gwf_subset($face)
142 {
143 if(empty($face))
144 return array();
145
146 $fonts = file_get_contents(dirname(__FILE__) . '/gwf.json');
147 $fonts = json_decode($fonts);
148 if( !property_exists($fonts, $face) )
149 return null;
150 $subsets = $fonts->{$face}->subsets;
151
152 foreach ($subsets as $subset)
153 {
154 $result[] = array('value' => $subset, 'label' => $subset);
155 }
156
157 return $result;
158 }
159
160 function vp_get_social_medias() {
161 $socmeds = array(
162 array('value' => 'blogger', 'label' => 'Blogger'),
163 array('value' => 'delicious', 'label' => 'Delicious'),
164 array('value' => 'deviantart', 'label' => 'DeviantArt'),
165 array('value' => 'digg', 'label' => 'Digg'),
166 array('value' => 'dribbble', 'label' => 'Dribbble'),
167 array('value' => 'email', 'label' => 'Email'),
168 array('value' => 'facebook', 'label' => 'Facebook'),
169 array('value' => 'flickr', 'label' => 'Flickr'),
170 array('value' => 'forrst', 'label' => 'Forrst'),
171 array('value' => 'foursquare', 'label' => 'Foursquare'),
172 array('value' => 'github', 'label' => 'Github'),
173 array('value' => 'googleplus', 'label' => 'Google+'),
174 array('value' => 'instagram', 'label' => 'Instagram'),
175 array('value' => 'lastfm', 'label' => 'Last.FM'),
176 array('value' => 'linkedin', 'label' => 'LinkedIn'),
177 array('value' => 'myspace', 'label' => 'MySpace'),
178 array('value' => 'pinterest', 'label' => 'Pinterest'),
179 array('value' => 'reddit', 'label' => 'Reddit'),
180 array('value' => 'rss', 'label' => 'RSS'),
181 array('value' => 'soundcloud', 'label' => 'SoundCloud'),
182 array('value' => 'stumbleupon', 'label' => 'StumbleUpon'),
183 array('value' => 'tumblr', 'label' => 'Tumblr'),
184 array('value' => 'twitter', 'label' => 'Twitter'),
185 array('value' => 'vimeo', 'label' => 'Vimeo'),
186 array('value' => 'wordpress', 'label' => 'WordPress'),
187 array('value' => 'yahoo', 'label' => 'Yahoo!'),
188 array('value' => 'youtube', 'label' => 'Youtube'),
189 );
190
191 return $socmeds;
192 }
193
194 function vp_get_fontawesome_icons()
195 {
196 // scrape list of icons from fontawesome css
197 if( false === ( $icons = get_transient( 'vp_fontawesome_icons' ) ) )
198 {
199 $pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s*{\s*content/';
200 $subject = file_get_contents(VP_DIR . '/public/css/vendor/font-awesome.min.css');
201
202 preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
203
204 $icons = array();
205
206 foreach($matches as $match)
207 {
208 $icons[] = array('value' => $match[1], 'label' => $match[1]);
209 }
210 set_transient( 'vp_fontawesome_icons', $icons, 60 * 60 * 24 );
211 }
212
213 return $icons;
214 }
215
216 VP_Security::instance()->whitelist_function('vp_dep_boolean');
217
218 function vp_dep_boolean($value)
219 {
220 $args = func_get_args();
221 $result = true;
222
223 foreach ($args as $val)
224 {
225 $result = ($result and !empty($val));
226 }
227 return $result;
228 }
229
230 /**
231 * EOF
232 */