function add_themes_meta_colabs_page_style() { global $post; $meta_style_gallery = get_post_meta($post->ID, "meta_style_gallery", true); ?> <style type="text/css"> #add_themes_meta_colabs_page_style h4 { float: left } #add_themes_meta_colabs_page_style .select-gallery { width:90%; } </style> <script type="text/javascript"> jQuery(document).ready(function(){ colabs_load_style('#page_template'); changeSelect(); }); jQuery('#page_template').live('change', function(){ colabs_load_style(this); }); function colabs_load_style(el){ if(jQuery(el).val()=='template-gallery.php') { jQuery('#add_themes_meta_colabs_page_style').show(); }else{ jQuery('#add_themes_meta_colabs_page_style').hide(); } } jQuery('#meta_style_gallery').live('change', function(){ changeSelect(); }); function changeSelect() { if( jQuery('#meta_style_gallery').val() == "instagram" ) { jQuery('#instagram_gallery_block').show(); jQuery('#category_post_block').hide(); jQuery('#flickr_gallery_block').hide(); } else if( jQuery('#meta_style_gallery').val() == "flickr" ) { jQuery('#flickr_gallery_block').show(); jQuery('#category_post_block').hide(); jQuery('#instagram_gallery_block').hide(); } else if( jQuery('#meta_style_gallery').val() == "post" ) { jQuery('#category_post_block').show(); jQuery('#instagram_gallery_block').hide(); jQuery('#flickr_gallery_block').hide(); } else { jQuery('#category_post_block').hide(); jQuery('#instagram_gallery_block').hide(); jQuery('#flickr_gallery_block').hide(); } } </script> <div class="gallery-metabox"> <h4><?php _e('Select Source Gallery:', 'colabsthemes'); ?> </h4> <select name="meta_style_gallery" id="meta_style_gallery" class="select-gallery"> <option <?php if ($meta_style_gallery == 'post') { echo 'selected="selected"'; } ?> value="post">Post</option> <option <?php if ($meta_style_gallery == 'photograph') { echo 'selected="selected"'; } ?> value="photograph">Photograph</option> <option <?php if ($meta_style_gallery == 'pinterest') { echo 'selected="selected"'; } ?> value="pinterest">Pinterest</option> <option <?php if ($meta_style_gallery == 'picasa') { echo 'selected="selected"'; } ?> value="picasa">Picasa</option> <option <?php if ($meta_style_gallery == 'dribbble') { echo 'selected="selected"'; } ?> value="dribbble">Dribbble</option> <?php if (ColabsInstagram::getInstance()->getAccessToken()) { ?> <option <?php if ($meta_style_gallery == 'instagram') { echo 'selected="selected"'; } ?> value="instagram">Instagram</option> <?php } ?> <option <?php if ($meta_style_gallery == 'flickr') { echo 'selected="selected"'; } ?> value="flickr">Flickr</option> </select> <div id="category_post_block" style="display:none"> <p><strong><?php _e('Select Category:', 'colabsthemes'); ?> </strong></p> <?php $cat_id = get_post_meta($post->ID, "cat", true); wp_dropdown_categories('show_option_none=All&selected=' . $cat_id); ?> </div> <div id="instagram_gallery_block" style="display:none"> <p><strong><?php _e('Type:', 'colabsthemes'); ?> </strong></p> <select id="colabs_type_instagram" name="colabs_type_instagram" class="colabs-input"> <option <?php if (get_post_meta($post->ID, 'colabs_type_instagram', true) == '') { echo 'selected="selected"'; } ?> value=""><?php _e('Popular', 'colabsthemes'); ?> </option> <option <?php if (get_post_meta($post->ID, 'colabs_type_instagram', true) == 'self') { echo 'selected="selected"'; } ?> value="self"><?php _e('Self', 'colabsthemes'); ?> </option> <option <?php if (get_post_meta($post->ID, 'colabs_type_instagram', true) == 'myfeed') { echo 'selected="selected"'; } ?> value="myfeed"><?php _e('Feed', 'colabsthemes'); ?> </option> </select> <p> <strong><?php _e('Count Instagram:', 'colabsthemes'); ?> </strong> </p> <p> <input type="text" value="<?php echo get_post_meta($post->ID, 'colabs_piccount_instagram', true); ?> " id="count_instagram" size="4" name="colabs_piccount_instagram"><br/><?php _e('Count of your Instagram image.', 'colabsthemes'); ?> </p> <p> <strong><?php _e('Random Instagram:', 'colabsthemes'); ?> </strong> </p> <p> <input type="checkbox" value="true" <?php if (get_post_meta($post->ID, 'colabs_random_instagram', true) == 'true') { echo 'checked="checked"'; } ?> id="colabs_random_instagram" name="colabs_random_instagram"> <label><?php _e('Random instagram image', 'colabsthemes'); ?> </label> </p> <p> <strong><?php _e('Tag Instagram (optional):', 'colabsthemes'); ?> </strong> </p> <p> <input type="text" value="<?php echo get_post_meta($post->ID, 'colabs_tag_instagram', true); ?> " id="colabs_tag_instagram" size="46" name="colabs_tag_instagram"><br/><?php _e('Tag (Currently only one tag. Username is ignored.)', 'colabsthemes'); ?> </p> <p> <strong><?php _e('Address/Coordinates Instagram (optional):', 'colabsthemes'); ?> </strong> </p> <p> <input type="text" value="<?php echo get_post_meta($post->ID, 'colabs_address_instagram', true); ?> " id="colabs_address_instagram" size="46" name="colabs_address_instagram"><br/><?php _e('Entry Address/Coordinates instagram in here.', 'colabsthemes'); ?> </p> </div> <div id="flickr_gallery_block" style="display:none"> <p> <strong><?php _e('Flickr ID:', 'colabsthemes'); ?> </strong> </p> <p> <input type="text" value="<?php echo get_post_meta($post->ID, 'colabs_username_flickr', true); ?> " id="id_flickr" size="46" name="colabs_username_flickr"><br/><?php _e('Entry Flickr ID (<a href="http://www.idgettr.com" target="_blank">idGettr</a>) in here.', 'colabsthemes'); ?> </p> <p> <strong><?php _e('Count FLickr:', 'colabsthemes'); ?> </strong> </p> <p> <input type="text" value="<?php echo get_post_meta($post->ID, 'colabs_piccount_flickr', true); ?> " id="count_flickr" size="4" name="colabs_piccount_flickr"><br/><?php _e('Count of your Flickr image.', 'colabsthemes'); ?> </p> </div> </div> <?php }
?> </div><!-- .option --> </div><!-- .section --> <div class="section"> <h3 class="heading"><?php _e('Instagram General settings', 'colabsthemes'); ?> </h3> <div class="option"> <div class="form-wrap"> <div> <?php if (ColabsInstagram::getInstance()->cacheIsEnabled()) { // Cache aktiv? ?> <p> <label for="instagram-cache-time"><?php _e('Refresh cache after', 'colabsthemes'); ?> </label> <?php $possibleCacheTimes = array(5, 10, 15, 30, 45, 60); ?> <select id="instagram-cache-time" name="instagram-cache-time"> <?php foreach ($possibleCacheTimes as $value) { ?> <option <?php
function getErrors() { $errors = array(); if (!ColabsInstagram::getInstance()->cacheIsEnabled()) { $errors[] = sprintf(__('To improve performance of this plugin, it is highly recommended to make the directory wp-content or wp-content/cache writable. For further information click <a target="_blank" href="%s">here</a>', 'colabsthemes'), 'http://codex.wordpress.org/Changing_File_Permissions'); } if (!ColabsInstagram::getInstance()->isCurlInstalled()) { $errors[] = __('Instagram requires <a href="http://php.net/manual/en/book.curl.php" target="_blank">PHP cURL</a> extension to work properly', 'colabsthemes'); } if (!function_exists('mb_detect_encoding')) { $errors[] = __('Geocoding won\'t work unless <a href="http://www.php.net/manual/en/mbstring.installation.php" target="_blank">mbstring</a> is activated', 'colabsthemes'); } return count($errors) > 0 ? $errors : false; }
$getlatlang = getLatLng($address); if (empty($limit)) { $limit = 10; } $nextMaxId = ''; $max_id = $nextMaxId; $piccounter = 1; $token = ColabsInstagram::getAccessToken(); if ($token) { if (!empty($getlatlang)) { $data = ColabsInstagram::getLocationBasedFeed($getlatlang); } else { if (empty($tag)) { $data = ColabsInstagram::getFeedByUserId($user, $max_id, $nextMaxId); } else { $data = ColabsInstagram::getFeedByTag($tag, $max_id, $nextMaxId); } } if (count($data) > 0) { if (get_option('colabs_random_instagram') == 'true') { shuffle($data); } foreach ($data as $obj) { if (intval($limit) > 0 && $piccounter > $limit) { break; } $title = $obj->caption->text; $urlimg = $obj->images->low_resolution->url; $urlimgori = $obj->images->standard_resolution->url; $likes = $obj->likes->count; $time = date(get_option('date_format'), $obj->created_time);