about-widget.php
6 years ago
accordion-widget.php
6 years ago
accordion.php
6 years ago
attachment-url.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
code.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
dropcap.php
6 years ago
facebook.php
6 years ago
flickr.php
6 years ago
gallery.php
6 years ago
general-element-fields.php
6 years ago
gmap.php
6 years ago
highlight.php
6 years ago
image.php
6 years ago
instagram-feed.php
6 years ago
latest-items.php
8 years ago
latest-posts-slider.php
6 years ago
popular-posts-widget.php
6 years ago
quote.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-posts-widget.php
6 years ago
recent-products.php
6 years ago
related-posts.php
8 years ago
sample-element.php
6 years ago
search.php
6 years ago
socials-list.php
6 years ago
staff.php
6 years ago
tab-widget.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
flickr.php
361 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Divider element |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2020 averta |
| 11 | */ |
| 12 | |
| 13 | function auxin_get_flickr_master_array( $master_array ) { |
| 14 | |
| 15 | $master_array['aux_flickr'] = array( |
| 16 | 'name' => __('Flickr Justified Gallery', 'auxin-elements' ), |
| 17 | 'auxin_output_callback' => 'auxin_widget_flickr_callback', |
| 18 | 'base' => 'aux_flickr', |
| 19 | 'description' => __('It uses Flickr Justified Gallery plugin.', 'auxin-elements'), |
| 20 | 'class' => 'aux-widget-flickr', |
| 21 | 'show_settings_on_create' => true, |
| 22 | 'weight' => 1, |
| 23 | 'is_widget' => true, |
| 24 | 'is_shortcode' => true, |
| 25 | 'is_so' => true, |
| 26 | 'is_vc' => true, |
| 27 | 'category' => THEME_NAME, |
| 28 | 'group' => '', |
| 29 | 'admin_enqueue_js' => '', |
| 30 | 'admin_enqueue_css' => '', |
| 31 | 'front_enqueue_js' => '', |
| 32 | 'front_enqueue_css' => '', |
| 33 | 'icon' => 'aux-element aux-pb-icons-flickr', |
| 34 | 'custom_markup' => '', |
| 35 | 'js_view' => '', |
| 36 | 'html_template' => '', |
| 37 | 'deprecated' => '', |
| 38 | 'content_element' => '', |
| 39 | 'as_parent' => '', |
| 40 | 'as_child' => '', |
| 41 | 'params' => array( |
| 42 | array( |
| 43 | 'heading' => __('User ID', 'auxin-elements'), |
| 44 | 'description' => sprintf(__('Displays the photostream of the specified user, no matter what is the default user ID in the settings. Remember that you can use %sidgettr%s to retrieve the user_id.', 'auxin-elements'), '<a target="_blank" href="http://idgettr.com/">','</a>'), |
| 45 | 'param_name' => 'user_id', |
| 46 | 'type' => 'textfield', |
| 47 | 'value' => '', |
| 48 | 'def_value' => '', |
| 49 | 'holder' => 'textfield', |
| 50 | 'class' => 'user_id', |
| 51 | 'admin_label' => false, |
| 52 | 'dependency' => '', |
| 53 | 'weight' => '', |
| 54 | 'group' => '' , |
| 55 | 'edit_field_class' => '' |
| 56 | ), |
| 57 | array( |
| 58 | 'heading' => __('Flickr image type', 'auxin-elements'), |
| 59 | 'description' => '', |
| 60 | 'param_name' => 'flickr_type', |
| 61 | 'type' => 'dropdown', |
| 62 | 'value' => array( |
| 63 | 'photostream' => __('Photostream' , 'auxin-elements'), |
| 64 | 'galleries' => __('Galleries', 'auxin-elements'), |
| 65 | 'album' => __('Album', 'auxin-elements'), // flickr set |
| 66 | 'group' => __('Group pools', 'auxin-elements'), |
| 67 | 'tags' => __('Tags', 'auxin-elements'), |
| 68 | ), |
| 69 | 'def_value' => 'none', |
| 70 | 'holder' => '', |
| 71 | 'class' => 'flickr_type', |
| 72 | 'admin_label' => true, |
| 73 | 'dependency' => '', |
| 74 | 'weight' => '', |
| 75 | 'group' => '' , |
| 76 | 'edit_field_class' => '' |
| 77 | ), |
| 78 | array( |
| 79 | 'heading' => __('Gallery ID', 'auxin-elements'), |
| 80 | 'description' => __('To show the photos of a particular gallery, you need to know its id. For example, the id of the gallery located in the URL: http://www.flickr.com/photos/miro-mannino/galleries/72157636382842016/ is: 72157636382842016', 'auxin-elements'), |
| 81 | 'param_name' => 'gallery_id', |
| 82 | 'type' => 'textfield', |
| 83 | 'value' => '', |
| 84 | 'def_value' => '', |
| 85 | 'holder' => 'textfield', |
| 86 | 'class' => 'gallery_id', |
| 87 | 'admin_label' => false, |
| 88 | 'dependency' => array( |
| 89 | 'element' => 'flickr_type', |
| 90 | 'value' => 'galleries' |
| 91 | ), |
| 92 | 'weight' => '', |
| 93 | 'group' => '' , |
| 94 | 'edit_field_class' => '' |
| 95 | ), |
| 96 | array( |
| 97 | 'heading' => __('Album ID', 'auxin-elements'), |
| 98 | 'description' => __('To show the photos of a particular photo set (also called "album"), you need to know its photoset_id. For example, the photoset_id of the photo set located in the URL: http://www.flickr.com/photos/miro-mannino/sets/72157629228993613/ is: 72157629228993613', 'auxin-elements'), |
| 99 | 'param_name' => 'photoset_id', |
| 100 | 'type' => 'textfield', |
| 101 | 'value' => '', |
| 102 | 'def_value' => '', |
| 103 | 'holder' => 'textfield', |
| 104 | 'class' => 'photoset_id', |
| 105 | 'admin_label' => false, |
| 106 | 'dependency' => array( |
| 107 | 'element' => 'flickr_type', |
| 108 | 'value' => 'album' |
| 109 | ), |
| 110 | 'weight' => '', |
| 111 | 'group' => '' , |
| 112 | 'edit_field_class' => '' |
| 113 | ), |
| 114 | array( |
| 115 | 'heading' => __('Group pools', 'auxin-elements'), |
| 116 | 'description' => sprintf(__('Display photos of a particular group pool, you need to know the group id, that you can retrieve using %sidgettr%s.', 'auxin-elements'), '<a target="_blank" href="http://idgettr.com/">','</a>'), |
| 117 | 'param_name' => 'group_id', |
| 118 | 'type' => 'textfield', |
| 119 | 'value' => '', |
| 120 | 'def_value' => '', |
| 121 | 'holder' => 'textfield', |
| 122 | 'class' => 'group_id', |
| 123 | 'admin_label' => false, |
| 124 | 'dependency' => array( |
| 125 | 'element' => 'flickr_type', |
| 126 | 'value' => 'group' |
| 127 | ), |
| 128 | 'weight' => '', |
| 129 | 'group' => '' , |
| 130 | 'edit_field_class' => '' |
| 131 | ), |
| 132 | array( |
| 133 | 'heading' => __('Tags', 'auxin-elements'), |
| 134 | 'description' => __('Display photos that have some particular tags, Seprate words with , for example: cat, square, nikon', 'auxin-elements'), |
| 135 | 'param_name' => 'tags', |
| 136 | 'type' => 'textfield', |
| 137 | 'value' => '', |
| 138 | 'def_value' => '', |
| 139 | 'holder' => 'textfield', |
| 140 | 'class' => 'tags', |
| 141 | 'admin_label' => false, |
| 142 | 'dependency' => array( |
| 143 | 'element' => 'flickr_type', |
| 144 | 'value' => 'tags' |
| 145 | ), |
| 146 | 'weight' => '', |
| 147 | 'group' => '' , |
| 148 | 'edit_field_class' => '' |
| 149 | ), |
| 150 | array( |
| 151 | 'heading' => __('Lightbox','auxin-elements'), |
| 152 | 'description' => __('In case of using Colorbox or Swipebox, you need to enable it on Flickr Justified Gallery plugin settings.','auxin-elements'), |
| 153 | 'param_name' => 'lightbox', |
| 154 | 'type' => 'dropdown', |
| 155 | 'value' => array( |
| 156 | 'none' => __('None' , 'auxin-elements'), |
| 157 | 'colorbox' => __('Colorbox', 'auxin-elements'), |
| 158 | 'swipebox' => __('Swipebox', 'auxin-elements'), |
| 159 | ), |
| 160 | 'def_value' => 'none', |
| 161 | 'holder' => '', |
| 162 | 'class' => 'lightbox', |
| 163 | 'admin_label' => true, |
| 164 | 'dependency' => '', |
| 165 | 'weight' => '', |
| 166 | 'group' => '' , |
| 167 | 'edit_field_class' => '' |
| 168 | ), |
| 169 | array( |
| 170 | 'heading' => __('Images height', 'auxin-elements'), |
| 171 | 'description' => __('You can use the this option to set images height in px.', 'auxin-elements'), |
| 172 | 'param_name' => 'images_height', |
| 173 | 'type' => 'textfield', |
| 174 | 'value' => '', |
| 175 | 'def_value' => '', |
| 176 | 'holder' => 'textfield', |
| 177 | 'class' => 'images_height', |
| 178 | 'admin_label' => false, |
| 179 | 'dependency' => '', |
| 180 | 'weight' => '', |
| 181 | 'group' => '' , |
| 182 | 'edit_field_class' => '' |
| 183 | ), |
| 184 | array( |
| 185 | 'heading' => __('Max number of photos','auxin-elements'), |
| 186 | 'description' => __('Maximum number of photos. Please note if pagination option is activaited then this options is used as maximum number of photos per page.', 'auxin-elements'), |
| 187 | 'param_name' => 'max_num_photos', |
| 188 | 'type' => 'textfield', |
| 189 | 'value' => '', |
| 190 | 'def_value' => '', |
| 191 | 'holder' => 'textfield', |
| 192 | 'class' => 'max_num_photos', |
| 193 | 'admin_label' => false, |
| 194 | 'dependency' => '', |
| 195 | 'weight' => '', |
| 196 | 'group' => '' , |
| 197 | 'edit_field_class' => '' |
| 198 | ), |
| 199 | array( |
| 200 | 'heading' => __('Pagination','auxin-elements'), |
| 201 | 'description' => '', |
| 202 | 'param_name' => 'pagination', |
| 203 | 'type' => 'dropdown', |
| 204 | 'value' => array( |
| 205 | 'none' => __('None' , 'auxin-elements'), |
| 206 | 'prevnext' => __('Previous and Next', 'auxin-elements'), |
| 207 | 'numbers' => __('Page Numbers', 'auxin-elements'), |
| 208 | ), |
| 209 | 'def_value' => 'none', |
| 210 | 'holder' => '', |
| 211 | 'class' => 'pagination', |
| 212 | 'admin_label' => true, |
| 213 | 'dependency' => '', |
| 214 | 'weight' => '', |
| 215 | 'group' => '' , |
| 216 | 'edit_field_class' => '' |
| 217 | ), |
| 218 | array( |
| 219 | 'heading' => __('Fixed height', 'auxin-elements'), |
| 220 | 'description' => __('Each row has the same height, but the images will be cut more.', 'auxin-elements'), |
| 221 | 'param_name' => 'fixed_height', |
| 222 | 'type' => 'aux_switch', |
| 223 | 'value' => '0', |
| 224 | 'class' => 'fixed_height', |
| 225 | 'admin_label' => false, |
| 226 | 'dependency' => '', |
| 227 | 'weight' => '', |
| 228 | 'group' => '' , |
| 229 | 'edit_field_class' => '' |
| 230 | ), |
| 231 | array( |
| 232 | 'heading' => __('Randomize images order', 'auxin-elements'), |
| 233 | 'description' => '', |
| 234 | 'param_name' => 'randomize', |
| 235 | 'type' => 'aux_switch', |
| 236 | 'value' => '0', |
| 237 | 'class' => 'randomize', |
| 238 | 'admin_label' => 0, |
| 239 | 'dependency' => '', |
| 240 | 'weight' => '', |
| 241 | 'group' => '' , |
| 242 | 'edit_field_class' => '' |
| 243 | ), |
| 244 | array( |
| 245 | 'heading' => __('Margin between the images','auxin-elements'), |
| 246 | 'description' => __('Specifies the space between images.', 'auxin-elements'), |
| 247 | 'param_name' => 'margins', |
| 248 | 'type' => 'textfield', |
| 249 | 'value' => '', |
| 250 | 'def_value' => '', |
| 251 | 'holder' => 'textfield', |
| 252 | 'class' => 'margins', |
| 253 | 'admin_label' => false, |
| 254 | 'dependency' => '', |
| 255 | 'weight' => '', |
| 256 | 'group' => '' , |
| 257 | 'edit_field_class' => '' |
| 258 | ) |
| 259 | ) |
| 260 | ); |
| 261 | |
| 262 | return $master_array; |
| 263 | } |
| 264 | |
| 265 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_flickr_master_array', 10, 1 ); |
| 266 | |
| 267 | function auxin_widget_flickr_callback( $atts, $shortcode_content = null ){ |
| 268 | |
| 269 | $default_atts = array( |
| 270 | 'user_id' => '', |
| 271 | 'flickr_type' => 'photostream', |
| 272 | 'gallery_id' => '', |
| 273 | 'photoset_id' => '', |
| 274 | 'group_id' => '', |
| 275 | 'tags' => '', |
| 276 | 'max_num_photos' => '', |
| 277 | 'images_height' => '', |
| 278 | 'lightbox' => 'none', |
| 279 | 'pagination' => 'none', |
| 280 | 'margins' => '', |
| 281 | 'fixed_height' => false, |
| 282 | 'randomize' => false, |
| 283 | 'custom_el_id' => '', |
| 284 | 'base_class' => 'aux-widget-flickr' |
| 285 | ); |
| 286 | |
| 287 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 288 | extract( $result['parsed_atts'] ); |
| 289 | |
| 290 | $shortcode_name = ""; |
| 291 | $justify_shortcode = ""; |
| 292 | |
| 293 | ob_start(); |
| 294 | |
| 295 | |
| 296 | switch ($flickr_type) { |
| 297 | case 'photostream': |
| 298 | $shortcode_name = "flickr_photostream"; |
| 299 | break; |
| 300 | case 'galleries': |
| 301 | $shortcode_name = 'flickr_gallery id="' . $gallery_id . '"'; |
| 302 | break; |
| 303 | case 'album': |
| 304 | $shortcode_name = 'flickr_set id="' . $photoset_id . '"'; |
| 305 | break; |
| 306 | case 'group': |
| 307 | $shortcode_name = 'flickr_group id="' . $group_id . '"'; |
| 308 | break; |
| 309 | case 'tags': |
| 310 | $shortcode_name = 'flickr_tags tags="' . $tags . '"'; |
| 311 | break; |
| 312 | } |
| 313 | |
| 314 | if( ! empty( $user_id ) ) { |
| 315 | $user_id = 'user_id="' . $user_id . '"'; |
| 316 | } |
| 317 | |
| 318 | if( ! empty( $pagination ) ) { |
| 319 | $pagination = 'pagination="' . $pagination . '"'; |
| 320 | } |
| 321 | |
| 322 | if( ! empty( $max_num_photos ) ) { |
| 323 | $max_num_photos = 'max_num_photos="' . $max_num_photos . '"'; |
| 324 | } |
| 325 | |
| 326 | if( ! empty( $images_height ) ) { |
| 327 | $images_height = 'images_height="' . $images_height . '"'; |
| 328 | } |
| 329 | |
| 330 | |
| 331 | if( ! empty( $lightbox ) ) { |
| 332 | $lightbox = 'lightbox="' . $lightbox . '"'; |
| 333 | } |
| 334 | |
| 335 | if( ! empty( $margins ) ) { |
| 336 | $margins = 'margins="' . $margins . '"'; |
| 337 | } |
| 338 | |
| 339 | if( empty( $fixed_height ) ){ |
| 340 | $fixed_height = 0; |
| 341 | } else { |
| 342 | $fixed_height = 1; |
| 343 | } |
| 344 | $fixed_height = 'fixed_height="' . $fixed_height .'"'; |
| 345 | |
| 346 | if( empty( $randomize ) ){ |
| 347 | $randomize = 0; |
| 348 | } else { |
| 349 | $randomize = 1; |
| 350 | } |
| 351 | $randomize = 'randomize="' . $randomize .'"'; |
| 352 | |
| 353 | $justify_shortcode = '[' . $shortcode_name . ' ' . $user_id . ' ' . $images_height . ' ' . $margins . ' ' . $fixed_height . ' ' . $max_num_photos . ' ' . $randomize . ' ' . $lightbox . ' ' . $pagination . ']'; |
| 354 | |
| 355 | echo do_shortcode( $justify_shortcode ); |
| 356 | |
| 357 | return ob_get_clean(); |
| 358 | |
| 359 | } |
| 360 | |
| 361 |