PluginProbe
WP Ultimate Post Grid / 2.6.0
WP Ultimate Post Grid v2.6.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.6.0, at vendor/vafpress/data/sources.php

207 lines 4.8 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 $weights = $fonts->{$face}->weights;
107
108 foreach ($weights as $weight)
109 {
110 $result[] = array('value' => $weight, 'label' => $weight);
111 }
112
113 return $result;
114 }
115
116 VP_Security::instance()->whitelist_function('vp_get_gwf_style');
117
118 function vp_get_gwf_style($face)
119 {
120 if(empty($face))
121 return array();
122
123 $fonts = file_get_contents(dirname(__FILE__) . '/gwf.json');
124 $fonts = json_decode($fonts);
125 $styles = $fonts->{$face}->styles;
126
127 foreach ($styles as $style)
128 {
129 $result[] = array('value' => $style, 'label' => $style);
130 }
131
132 return $result;
133 }
134
135 function vp_get_social_medias() {
136 $socmeds = array(
137 array('value' => 'blogger', 'label' => 'Blogger'),
138 array('value' => 'delicious', 'label' => 'Delicious'),
139 array('value' => 'deviantart', 'label' => 'DeviantArt'),
140 array('value' => 'digg', 'label' => 'Digg'),
141 array('value' => 'dribbble', 'label' => 'Dribbble'),
142 array('value' => 'email', 'label' => 'Email'),
143 array('value' => 'facebook', 'label' => 'Facebook'),
144 array('value' => 'flickr', 'label' => 'Flickr'),
145 array('value' => 'forrst', 'label' => 'Forrst'),
146 array('value' => 'foursquare', 'label' => 'Foursquare'),
147 array('value' => 'github', 'label' => 'Github'),
148 array('value' => 'googleplus', 'label' => 'Google+'),
149 array('value' => 'instagram', 'label' => 'Instagram'),
150 array('value' => 'lastfm', 'label' => 'Last.FM'),
151 array('value' => 'linkedin', 'label' => 'LinkedIn'),
152 array('value' => 'myspace', 'label' => 'MySpace'),
153 array('value' => 'pinterest', 'label' => 'Pinterest'),
154 array('value' => 'reddit', 'label' => 'Reddit'),
155 array('value' => 'rss', 'label' => 'RSS'),
156 array('value' => 'soundcloud', 'label' => 'SoundCloud'),
157 array('value' => 'stumbleupon', 'label' => 'StumbleUpon'),
158 array('value' => 'tumblr', 'label' => 'Tumblr'),
159 array('value' => 'twitter', 'label' => 'Twitter'),
160 array('value' => 'vimeo', 'label' => 'Vimeo'),
161 array('value' => 'wordpress', 'label' => 'WordPress'),
162 array('value' => 'yahoo', 'label' => 'Yahoo!'),
163 array('value' => 'youtube', 'label' => 'Youtube'),
164 );
165
166 return $socmeds;
167 }
168
169 function vp_get_fontawesome_icons()
170 {
171 // scrape list of icons from fontawesome css
172 if( false === ( $icons = get_transient( 'vp_fontawesome_icons' ) ) )
173 {
174 $pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s*{\s*content/';
175 $subject = file_get_contents(VP_DIR . '/public/css/vendor/font-awesome.min.css');
176
177 preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
178
179 $icons = array();
180
181 foreach($matches as $match)
182 {
183 $icons[] = array('value' => $match[1], 'label' => $match[1]);
184 }
185 set_transient( 'vp_fontawesome_icons', $icons, 60 * 60 * 24 );
186 }
187
188 return $icons;
189 }
190
191 VP_Security::instance()->whitelist_function('vp_dep_boolean');
192
193 function vp_dep_boolean($value)
194 {
195 $args = func_get_args();
196 $result = true;
197
198 foreach ($args as $val)
199 {
200 $result = ($result and !empty($val));
201 }
202 return $result;
203 }
204
205 /**
206 * EOF
207 */