Esempio n. 1
0
 /**
  * Helper: Returns a specified path by the user in the public directory.
  *
  * @param $userPath
  * @return string
  */
 function asset($userPath)
 {
     $path = (isHttps() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
     if (substr($userPath, 1, 1) == '/') {
         return $path . $userPath;
     }
     return $path . '/' . $userPath;
 }
function enjoyinstagram_mb_shortcode_grid()
{
    $shortcode_content = '';
    static $i = 1;
    if (get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
        $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
        $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
        if (get_option('enjoyinstagram_user_or_hashtag') == 'hashtag') {
            $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
        } else {
            $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
        }
        $pre_shortcode_content = "<div id=\"grid-" . $i . "\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
        if (isHttps()) {
            foreach ($result->data as $entry) {
                $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
                $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
            }
        }
        foreach ($result->data as $entry) {
            if (!empty($entry->caption)) {
                $caption = $entry->caption->text;
            } else {
                $caption = '';
            }
            if (!empty($entry->user)) {
                $user = $entry->user->username;
                $userPicture = $entry->user->profile_picture;
            } else {
                $user = '';
                $userPicture = '';
            }
            $shortcode_content .= "<li><div class=\"header_ca\"><img  src=\"{$userPicture}\" style=\"width:30px; margin-right: 10px; border-radius: 50%;\">{$user}</div><img  src=\"{$entry->images->standard_resolution->url}\"><div class=\"caption_ca\">{$caption}</div></li>";
        }
        $post_shortcode_content = "</ul></div>";
        ?>
<script type="text/javascript">
			jQuery(function() {
				jQuery('#grid-<?php 
        echo $i;
        ?>
').fadeIn('1000');
			});
		</script>
<?php 
    }
    $i++;
    $shortcode_content = $pre_shortcode_content . $shortcode_content . $post_shortcode_content;
    return $shortcode_content;
}
 public function handle($request, Closure $next)
 {
     $debug = env('APP_DEBUG', true);
     $appEnv = env('APP_ENV', 'local');
     if (isHttps()) {
         $_SERVER['HTTPS'] = 'on';
     }
     if ($debug && ($appEnv === 'local' || $appEnv === 'dev')) {
         #Enable writing pkdebug to log file
         PkLibConfig::setSuppressPkDebug(false);
         $logDir = realpath(storage_path() . '/logs');
         $logPath = $logDir . '/pkapp.log';
         appLogPath($logPath);
     }
     return $next($request);
 }
Esempio n. 4
0
 public function __construct()
 {
     $ssl = isHttps();
     $this->scheme = $ssl ? 'https' : 'http';
     $this->host = $_SERVER['SERVER_NAME'];
     $this->port = $_SERVER['SERVER_PORT'];
     if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
         $uriParts = explode('?', $_SERVER['REQUEST_URI']);
         $this->path = $uriParts[0];
         $this->query = $uriParts[1];
     } else {
         $this->path = $_SERVER['REQUEST_URI'];
     }
     if ($ssl && $this->port != 443 || !$ssl && $this->port != 80) {
         $authority = "{$this->host}:{$this->port}";
     } else {
         $authority = $this->host;
     }
     $this->url = "{$this->scheme}://{$authority}{$this->path}";
     if ($this->query) {
         $this->url .= "?{$this->query}";
     }
 }
function enjoyinstagram_mb_shortcode_widget($atts)
{
    if (get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
        extract(shortcode_atts(array('n' => '4', 'id' => 'owl', 'n_y_n' => 'false', 'u_or_h' => 'user'), $atts));
        ?>
		<script>
			jQuery(function () {
				jQuery(document.body)
					.on('click touchend', '#swipebox-slider .current img', function (e) {
						jQuery('#swipebox-next').click();
						return false;
					})
					.on('click touchend', '#swipebox-slider .current', function (e) {
						jQuery('#swipebox-close').trigger('click');
					});
			});
		</script>
		<script type="text/javascript">
			jQuery(function ($) {
				$(".swipebox").swipebox({
					hideBarsDelay: 0
				});

			});
			jQuery(document).ready(function () {
				jQuery("#owl-<?php 
        echo "{$id}";
        ?>
").owlCarousel({
					items: <?php 
        echo "{$n}";
        ?>
,
					navigation: <?php 
        echo "{$n_y_n}";
        ?>
,
				});
				jQuery("#owl-<?php 
        echo "{$id}";
        ?>
").fadeIn('slow');
			});
		</script>
		<?php 
        $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
        $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
        if ("{$u_or_h}" == 'hashtag') {
            $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
        } else {
            $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
        }
        if (isHttps()) {
            foreach ($result->data as $entry) {
                $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
                $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
            }
        }
        ?>
		<div id="owl-<?php 
        echo "{$id}";
        ?>
" class="owl-example">
			<?php 
        if ($result->data) {
            foreach ($result->data as $entry) {
                if (!empty($entry->caption)) {
                    $caption = $entry->caption->text;
                } else {
                    $caption = '';
                }
                if (get_option('enjoyinstagram_carousel_items_number') != '1') {
                    echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img  src=\"{$entry->images->thumbnail->url}\"></a></div>";
                } else {
                    echo "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
                }
            }
        }
        ?>
		</div>
	<?php 
    }
}
Esempio n. 6
0
function enjoyinstagram_mb_shortcode($atts)
{
    $shortcode_content = '';
    static $i = 1;
    if (get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
        extract(shortcode_atts(array('n' => '4'), $atts));
        ?>
<script>
    jQuery(function(){
      jQuery(document.body)
          .on('click touchend','#swipebox-slider .current img', function(e){
              jQuery('#swipebox-next').click();
			  return false;
          })
          .on('click touchend','#swipebox-slider .current', function(e){
              jQuery('#swipebox-close').trigger('click');
          });
    });
</script>
<script type="text/javascript">
jQuery(function($) {
	$(".swipebox").swipebox({
	hideBarsDelay : 0
	});
	
});   
jQuery(document).ready(function() {
jQuery("#owl-<?php 
        echo $i;
        ?>
").owlCarousel({
	  lazyLoad : true,
	  items : <?php 
        echo get_option('enjoyinstagram_carousel_items_number');
        ?>
,
	  itemsDesktop : [1199,<?php 
        echo get_option('enjoyinstagram_carousel_items_number');
        ?>
],
   	  itemsDesktopSmall : [980,<?php 
        echo get_option('enjoyinstagram_carousel_items_number');
        ?>
],
      itemsTablet: [768,<?php 
        echo get_option('enjoyinstagram_carousel_items_number');
        ?>
],
      itemsMobile : [479,<?php 
        echo get_option('enjoyinstagram_carousel_items_number');
        ?>
],
	  stopOnHover: true,
	  navigation: <?php 
        echo get_option('enjoyinstagram_carousel_navigation');
        ?>
	  
		 });
		 jQuery("#owl-<?php 
        echo $i;
        ?>
").fadeIn();
		 });
</script>
<?php 
        $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
        $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
        if (get_option('enjoyinstagram_user_or_hashtag') == 'hashtag') {
            $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
        } else {
            $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
        }
        $pre_shortcode_content = "<div id=\"owl-" . $i . "\" class=\"owl-example\" style=\"display:none;\">";
        if (isHttps()) {
            foreach ($result->data as $entry) {
                $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
                $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
            }
        }
        foreach ($result->data as $entry) {
            if (!empty($entry->caption)) {
                $caption = $entry->caption->text;
            } else {
                $caption = '';
            }
            if (get_option('enjoyinstagram_carousel_items_number') != '1') {
                $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img  src=\"{$entry->images->standard_resolution->url}\"></a></div>";
            } else {
                $shortcode_content .= "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
            }
        }
        $post_shortcode_content = "</div>";
    }
    $i++;
    $shortcode_content = $pre_shortcode_content . $shortcode_content . $post_shortcode_content;
    return $shortcode_content;
}
Esempio n. 7
0
Url present view	: <?php 
if (isset($current_view)) {
    echo $current_view;
}
?>
<br>
Show Base Url 	: <?php 
echo baseUrl();
?>
 <br/>
Show Theme Url 	: <?php 
echo SETUP_THEME_PATH;
?>
 <br/>
Is Https 		: <?php 
if (isHttps()) {
    echo "True";
} else {
    echo "False";
}
?>
 <br/>
user Browser 	: <?php 
echo getUserBrowser();
?>
 <br/>
Session ID 		: <?php 
echo session_id();
?>
 <br/>
function enjoyinstagram_mb_shortcode_grid()
{
    $shortcode_content = '';
    static $i = 1;
    if (get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
        $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
        $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
        if (get_option('enjoyinstagram_user_or_hashtag') == 'hashtag') {
            $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
        } else {
            $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
        }
        $pre_shortcode_content = "<div id=\"grid-" . $i . "\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
        if (isHttps()) {
            foreach ($result->data as $entry) {
                $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
                $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
            }
        }
        foreach ($result->data as $entry) {
            if (!empty($entry->caption)) {
                $caption = $entry->caption->text;
            } else {
                $caption = '';
            }
            $shortcode_content .= "<li><a title=\"{$caption}\" class=\"swipebox_grid\" href=\"{$entry->images->standard_resolution->url}\"><img  src=\"{$entry->images->standard_resolution->url}\"></a></li>";
        }
        $post_shortcode_content = "</ul></div>";
        ?>

    

<script type="text/javascript">	
    
			jQuery(function() {
				jQuery('#grid-<?php 
        echo $i;
        ?>
').gridrotator({
					rows		: <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
					columns		: <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
,
					animType	: 'fadeInOut',
					onhover : false,
					interval		: 7000,
					preventClick    : false,
					w1400           : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
},
					w1024           : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
},
 
w768            : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
},
 
w480            : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
},
 
w320            : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
},
 
w240            : {
    rows    : <?php 
        echo get_option('enjoyinstagram_grid_rows');
        ?>
,
    columns : <?php 
        echo get_option('enjoyinstagram_grid_cols');
        ?>
}
				});
				
			jQuery('#grid-<?php 
        echo $i;
        ?>
').fadeIn('1000');
			
			
			});
			
		</script>
<?php 
    }
    $i++;
    $shortcode_content = $pre_shortcode_content . $shortcode_content . $post_shortcode_content;
    return $shortcode_content;
}
Esempio n. 9
0
/**
 * Show the login page
 */
function showlogin()
{
    global $smarty;
    // Check whether there are any errors.
    $errorbartext = "";
    if (isset($_GET['error'])) {
        if ($_GET['error'] == 'authfail') {
            $errorbartext = BootstrapSkin::displayAlertBox("Username and/or password incorrect. Please try again.", "alert-error", "Auth failure", true, false, true);
        } elseif ($_GET['error'] == 'noid') {
            $errorbartext = BootstrapSkin::displayAlertBox("User account is not identified. Please email accounts-enwiki-l@lists.wikimedia.org if you believe this is in error.", "alert-error", "Auth failure", true, false, true);
        } elseif ($_GET['error'] == 'newacct') {
            $errorbartext = BootstrapSkin::displayAlertBox("I'm sorry, but, your account has not been approved by a site administrator yet. Please stand by.", "alert-info", "Account pending", true, false, true);
        }
    }
    $smarty->assign("errorbar", $errorbartext);
    global $strictTransportSecurityExpiry;
    if ($strictTransportSecurityExpiry !== false) {
        if (isHttps()) {
            // Client can clearly use HTTPS, so let's enforce it for all connections.
            header("Strict-Transport-Security: max-age=15768000");
        } else {
            // This is the login form, not the request form. We need protection here.
            $path = 'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
            header("Location: " . $path);
        }
    }
    $smarty->display("login.tpl");
}
Esempio n. 10
0
function getFullRequestedURL()
{
    $https = isHttps();
    $stdport = $https ? 443 : 80;
    $port = "";
    if ($stdport != $_SERVER["SERVER_PORT"] && $_SERVER["SERVER_PORT"]) {
        $port = ":" . $_SERVER["SERVER_PORT"];
    }
    return ($https ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $port . $_SERVER['REQUEST_URI'];
}
function enjoyinstagram_mb_shortcode_grid_widget($atts)
{
    if (get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
        extract(shortcode_atts(array('id' => 'rigrid_default', 'n_c' => '6', 'n_r' => '2', 'u_or_h' => 'user'), $atts));
        $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
        $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
        if ("{$u_or_h}" == 'hashtag') {
            $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
        } else {
            $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
        }
        ?>

	<?php 
        if (isHttps()) {
            foreach ($result->data as $entry) {
                $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
                $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
            }
        }
        ?>


<div id="rigrid-<?php 
        echo "{$id}";
        ?>
" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
    <ul>
<?php 
        if ($result->data) {
            foreach ($result->data as $entry) {
                echo "<li><a title=\"{$entry->caption->text}\" class=\"swipebox_grid\" href=\"{$entry->images->standard_resolution->url}\"><img  src=\"{$entry->images->standard_resolution->url}\"></a></li>";
            }
        }
        ?>
    </ul></div>

<script type="text/javascript">	
    

			jQuery(function() {
			
				jQuery('#rigrid-<?php 
        echo "{$id}";
        ?>
').gridrotator({
					rows		: <?php 
        echo "{$n_r}";
        ?>
,
					columns		: <?php 
        echo "{$n_c}";
        ?>
,
					animType	: 'fadeInOut',
					onhover : false,
					interval		: 7000,
					preventClick    : false,
					w1024           : {
    rows    : <?php 
        echo "{$n_r}";
        ?>
,
    columns : <?php 
        echo "{$n_c}";
        ?>
},
 
w768            : {
    rows    : <?php 
        echo "{$n_r}";
        ?>
,
    columns : <?php 
        echo "{$n_c}";
        ?>
},
 
w480            : {
    rows    : <?php 
        echo "{$n_r}";
        ?>
,
    columns : <?php 
        echo "{$n_c}";
        ?>
},
 
w320            : {
    rows    : <?php 
        echo "{$n_r}";
        ?>
,
    columns : <?php 
        echo "{$n_c}";
        ?>
},
 
w240            : {
    rows    : <?php 
        echo "{$n_r}";
        ?>
,
    columns : <?php 
        echo "{$n_c}";
        ?>
}
				});
				jQuery('#rigrid-<?php 
        echo "{$id}";
        ?>
').fadeIn('slow');
			});

			
		</script>
<?php 
    }
    ?>

   
<?php 
}
Esempio n. 12
0
/**
 * sets cookie if value is different from current cokkie value,
 * or removes if value is equal to default
 *
 * @uses    isHttps()
 * @uses    getCookiePath()
 * @uses    $_COOKIE
 * @uses    CP_removeCookie()
 * @uses    setcookie()
 * @uses    time()
 * @param   string  $cookie     name of cookie to remove
 * @param   mixed   $value      new cookie value
 * @param   string  $default    default value
 * @param   int     $validity   validity of cookie in seconds (default is one month)
 * @param   bool    $httponlt   whether cookie is only for HTTP (and not for scripts)
 * @return  boolean result of setcookie()
 */
function CP_setCookie($cookie, $value, $default = null, $validity = null, $httponly = true)
{
    if ($validity == null) {
        $validity = 2592000;
    }
    if (strlen($value) && null !== $default && $value === $default && isset($_COOKIE[$cookie])) {
        // remove cookie, default value is used
        return CP_removeCookie($cookie);
    }
    if (!strlen($value) && isset($_COOKIE[$cookie])) {
        // remove cookie, value is empty
        return CP_removeCookie($cookie);
    }
    if (!isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
        // set cookie with new value
        /* Calculate cookie validity */
        if ($validity == 0) {
            $v = 0;
        } else {
            $v = time() + $validity;
        }
        /* Use native support for httponly cookies if available */
        if (version_compare(PHP_VERSION, '5.2.0', 'ge')) {
            return setcookie($cookie, $value, $v, getCookiePath(), '', isHttps(), $httponly);
        } else {
            return setcookie($cookie, $value, $v, getCookiePath() . ($httponly ? '; HttpOnly' : ''), '', isHttps());
        }
    }
    // cookie has already $value as value
    return true;
}
Esempio n. 13
0
function fullHost($use_forwarded_host = false) {
  $s = $_SERVER;
  $sp = strtolower($s['SERVER_PROTOCOL']);
  $protocol = substr($sp, 0, strpos($sp, '/')) . ((isHttps()) ? 's' : '');
  $port = $s['SERVER_PORT'];
  $port = ((!isHttps() && $port == '80') || (isHttps() && $port == '443')) ? '' : ':' . $port;
  $host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null);
  $host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
  return $protocol . '://' . $host;
}