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