Skip to content

Commit

Permalink
Disable Cloudinary on localhost. See #5
Browse files Browse the repository at this point in the history
  • Loading branch information
siamkreative committed Apr 5, 2016
1 parent f6b1efa commit 55ab18b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions includes/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ function wpscr_shortcode( $atts ) {
// https://pippinsplugins.com/retrieving-image-urls-of-galleries/
$gallery = get_post_gallery( $a['id'], false );

// Check if Cloudinary is enabled
$titan = TitanFramework::getInstance( 'wpscr_settings' );
$cloudinary_username = $titan->getOption( 'slider_cloudinary_account' );
$cloudinary_url = "http://res.cloudinary.com/$cloudinary_username/image/fetch/";
// Cloudinary integration
$cloudinary_url = "";
$whitelist = array(
'127.0.0.1',
'::1'
);

// Disable if localhost
if( !in_array($_SERVER['REMOTE_ADDR'], $whitelist) ) {
$titan = TitanFramework::getInstance( 'wpscr_settings' );
$cloudinary_username = $titan->getOption( 'slider_cloudinary_account' );
$cloudinary_url = "https://res.cloudinary.com/$cloudinary_username/image/fetch/";
}

if( $gallery ) {
$attachments = explode( ",", $gallery['ids'] );
Expand Down

0 comments on commit 55ab18b

Please sign in to comment.