Example #1
0
        
    </div><!-- /#sc-option-intaaccsettings -->
    <!-- END OF Instagram Account Settings -->

    <!-- Instagram General settings -->
    <div class="group c1" id="sc-option-instageneralsettings">
        <h3 class="title"><?php 
    _e('Instagram General settings', 'omnigallery');
    ?>
</h3>
    
        <table class="form-table">
            <tbody>
                <tr valign="top">
					<?php 
    if (SCInstagram::getInstance()->cacheIsEnabled()) {
        // Cache aktiv?
        ?>
                    <th scope="row"><label for="scinstagram-cache-time"><?php 
        _e('Refresh cache after', 'omnigallery');
        ?>
</label></th>
                    <td>
						<?php 
        $possibleCacheTimes = array(5, 10, 15, 30, 45, 60);
        ?>
						<select id="scinstagram-cache-time" name="scinstagram-cache-time">
							<?php 
        foreach ($possibleCacheTimes as $value) {
            ?>
								<option <?php 
Example #2
0
 /**
  * Overrides the native gallery short code, and does a lot more.
  *
  * @param $content
  * @param array $attr
  * @return string
  */
 function modify_gallery($content, $attr = array())
 {
     global $post, $omnigallery, $scinstagram, $scfacebook, $scflickr, $omnigallery_default_gallery_type, $omnigallery_nested_shortcodes;
     if ($attr == null) {
         $attr = array();
     }
     $attr = array_merge(array('type' => $omnigallery_default_gallery_type, 'style' => 'default', 'id' => $post->ID), $attr);
     if ($omnigallery_nested_shortcodes) {
         $attr = array_map('do_shortcode', $attr);
     }
     extract($attr);
     $type = strtolower($type);
     switch ($type) {
         case 'instagram':
             if (!isset($scinstagram)) {
                 $scinstagram = new SCInstagram();
             }
             $images = $scinstagram->get_gallery_images($attr);
             break;
         case 'flickr':
             if (!isset($scflickr)) {
                 $scflickr = new SCFlickr();
             }
             $images = $scflickr->get_gallery_images($attr);
             break;
         case 'picasa':
             if (!isset($scpicasa)) {
                 $scpicasa = new SCPicasa();
             }
             $images = $scpicasa->get_gallery_images($attr);
             break;
         case 'pinterest':
             if (!isset($scpinterest)) {
                 $scpinterest = new SCPinterest();
             }
             $images = $scpinterest->get_gallery_images($attr);
             break;
         case 'facebook':
             if (!isset($scfacebook)) {
                 $scfacebook = new SCFacebook();
             }
             $images = $scfacebook->get_gallery_images($attr);
             break;
         case 'dribble':
             if (!isset($scdribble)) {
                 $scdribble = new SCDribble();
             }
             $images = $scdribble->get_gallery_images($attr);
             break;
     }
     if (isset($images) && is_array($images)) {
         if (isset($style)) {
             $gallery_html = $this->build_gallery($images, $style, $attr);
             return $gallery_html;
         }
     } else {
         if (isset($images)) {
             return $images;
         }
     }
     return $content;
 }
Example #3
0
    function get_gallery_images($attr = array())
    {
        global $omnigallery, $scinstagram, $post;
        static $instance = 0;
        $instance++;
        $attr = array_merge(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'width' => '150', 'height' => '150'), $attr);
        extract($attr);
        $id = intval($id);
        $type = get_option('sc_type_instagram');
        $limit = get_option('sc_piccount_instagram');
        $tag = get_option('sc_tag_instagram');
        $address = get_option('sc_address_instagram');
        $getlatlang = getLatLng($address);
        if (empty($limit)) {
            $limit = 10;
        }
        $nextMaxId = '';
        $max_id = $nextMaxId;
        $piccounter = 1;
        $token = SCInstagram::getAccessToken();
        $instagramOptions = SCInstagram::getInstance()->getOptions();
        $accessToken = SCInstagram::getInstance()->getAccessToken();
        $user = $instagramOptions['scinstagram_user_username'];
        $values = array('userid' => $user, 'tag' => $tag, 'piccount' => $limit);
        if (empty($tag)) {
            $user = $values['userid'];
            if (!is_numeric($values['userid']) && $type != 'popular' && $type != 'feed' && strlen($values['userid'])) {
                $user = SCInstagram::getUserIdByName($values['userid']);
            }
        }
        if (!empty($getlatlang)) {
            $data = SCInstagram::getLocationBasedFeed($getlatlang);
        } else {
            if (empty($tag)) {
                $data = SCInstagram::getFeedByUserId($user, $max_id, $nextMaxId);
            } else {
                $data = SCInstagram::getFeedByTag($tag, $max_id, $nextMaxId);
            }
        }
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
        $float = is_rtl() ? 'right' : 'left';
        $selector = "sc_gallery_instagram-{$instance}";
        $return = '';
        $size_class = sanitize_html_class($size);
        $return .= "\r\n\t\t<style type='text/css'>\r\n\t\t\t#{$selector} {\r\n\t\t\t\tmargin: auto;\r\n                display: block\r\n\t\t\t}\r\n\t\t\t#{$selector}:after {\r\n                width: 0;\r\n                height: 0;\r\n                clear: both;\r\n                content: ' ';\r\n                display: block;\r\n                overflow: hidden;\r\n                visibility: hidden;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-item {\r\n\t\t\t\tfloat: {$float};\r\n\t\t\t\tmargin-top: 10px;\r\n\t\t\t\ttext-align: center;\r\n\t\t\t\twidth: {$itemwidth}%;\r\n\t\t\t}\r\n\t\t\t#{$selector} img {\r\n\t\t\t\tborder: 2px solid #cfcfcf;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-caption {\r\n\t\t\t\tmargin-left: 0;\r\n\t\t\t}\r\n\t\t</style>";
        $return .= "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
        if (count($data) > 0) {
            if (get_option('sc_random_instagram') == 'true') {
                shuffle($data);
            }
            foreach ($data as $obj) {
                if (intval($limit) > 0 && $piccounter > $limit) {
                    break;
                }
                $return .= '
                <dl class="gallery-item">
                    <dt class="gallery-icon">
						<a href="' . $obj->images->standard_resolution->url . '" title="' . $obj->caption->text . '" rel="lightbox-" target="_blank">
                            <img src="' . $omnigallery->plugin_url . '/includes/timthumb.php?src=' . $obj->images->low_resolution->url . '&amp;w=' . $width . '&amp;h=' . $height . '&amp;zc=1&amp;q=90" alt="Instagram Gallery" class="sc-image" width="' . $width . '">
							<!--img src="' . $obj->images->low_resolution->url . '" alt="Instagram Gallery" class="sc-image ' . $size . '" width="' . $width . '" height="' . $height . '"-->
						</a>
                    </dt>
                </dl>';
                $piccounter++;
            }
        }
        $return .= '</div><!--/#gallery-->';
        //$return .= esc_attr( $instagramOptions['scinstagram_user_username'] ).' --- '.$accessToken.' --- '.$user;
        return $return;
    }
Example #4
0
if (class_exists('OmniGallery')) {
    $omnigallery = OmniGallery::getInstance();
    if (isset($omnigallery)) {
        register_activation_hook(__FILE__, array(&$OmniGallery, 'activation'));
    }
}
// Includes Classes
require_once 'includes/scinstagram.class.php';
require_once 'includes/scfacebook.class.php';
require_once 'includes/flickr/phpFlickr.php';
require_once 'includes/scflickr.class.php';
require_once 'includes/scpicasa.class.php';
require_once 'includes/scpinterest.class.php';
require_once 'includes/scdribble.class.php';
if (class_exists('SCInstagram')) {
    $scinstagram = SCInstagram::getInstance();
    if (isset($scinstagram)) {
        register_activation_hook(__FILE__, array(&$scinstagram, 'install'));
    }
}
if (class_exists('SCFacebook')) {
    $scfacebook = new SCFacebook();
}
/**
 * Returns current plugin version.
 * 
 * @return string Plugin version
 */
function omnigallery_plugin_get_version()
{
    if (is_admin()) {