get_results("SELECT * FROM ". $wpdb->prefix ."asgall_settings_menu", ARRAY_N); // Full settings get form the admin
$rightArrow = dirname($uploadDir['baseurl']).'/plugins/apptha-slider-gallery/images/next-horizontal.png';
$leftArrow = dirname($uploadDir['baseurl']).'/plugins/apptha-slider-gallery/images/prev-horizontal.png';
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$table1 = $wpdb->prefix ."asgallphotos";
$table2 = $wpdb->prefix ."asgallalbum";
if ($_REQUEST['albid'] != '') {
$asgall_albumid = $_REQUEST['albid']; //If request the album from the gallery display page
}
if ($arguments['albid'] != '') {
$asgall_albumid = $arguments['albid']; //If request is from post/page
}
?>
get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' ORDER BY asgallPhoto_hitcount DESC" ); // Getting album photos
break;
case recent:
$sliderPhotos = $wpdb->get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' ORDER BY asgallPhoto_date DESC" ); // Getting album photos
break;
case featured:
$sliderPhotos = $wpdb->get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' and asgallFeaturedCover = 1" ); // Getting album photos
break;
default:
}
?>
.ad-gallery .ad-image-wrapper {
height:'.$asgallSettings[0][2].'px;
}
';
if(count($sliderPhotos) == 0)
{
$div .= 'No images for the slider';
}
else
{
$div .='
';
$div .='
';
foreach ($sliderPhotos as $values) {
$extens = explode('.',$values->asgallPhoto_image);
$thumbimg = $values->asgallPhoto_id.'_sliderthumb.'.$extens[1];
$photoName = $values->asgallPhoto_name;
$photoDesc = $values->asgallPhoto_desc;
$file_thumb = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $thumbimg;
$file_hover = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $values->asgallPhoto_image;
if (file_exists($file_hover))
{
$file_hover = $path.'/'.$values->asgallPhoto_image;
}
else
{
$file_hover = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/uploads/no-photo.png';
}
if (file_exists($file_thumb))
{
$file_thumb = $path . '/' . $thumbimg;
}
else
{
$file_thumb = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/uploads/no-photo.png';
}
$div .='
';
}
$div .='
';
} // if else close
} // Slider else ends
elseif( isset( $_REQUEST['pid'] ) && ($k == 0) && !$photoView){
// ********************************** SHOW SINGLE PHOTO ***************************************************************
$photoView = 1;
$goback = $pageURL;
$goback = explode('&pid', $goback);
$url = $goback[0]."&pid=";
$psno = $limit = $photoId =(int)$_GET['pid'];
$albId = $_REQUEST['albid'];
$photosno = (int)$_REQUEST['photonumberis'];
$limit--;
$psql = "SELECT * FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON'
AND asgallAlbum_id = $albId AND asgallPhoto_sorting = $limit LIMIT 1";
$picaAlbumPhotosList = $wpdb->get_results($psql); // Getting album photos
$numOffetched = count($picaAlbumPhotosList);
if($numOffetched){
$picaAlbName = $wpdb->get_results( "SELECT count(*) as total , asgallAlbum_name FROM $table1 as p , $table2 as a WHERE p.`asgallAlbum_id` = $albId and a.`asgallAlbum_id` = $albId AND p.is_delete = 0");
$photoflag = 0;
$total = $picaAlbName[0]->total;
$albname = $picaAlbName[0]->asgallAlbum_name ;
$url = $goback[0].'&pid=';
if($photoId <= 1 )
{
$leftArrowId = 0;
}
else{
$leftArrowId = $photoId - 1;
}
if($total <= $photoId )
{
$rightArrowId = 0;
}
else{
$rightArrowId = $photoId + 1;
}
$imgId = $picaAlbumPhotosList[0]->asgallPhoto_id ;
$photoName = $picaAlbumPhotosList[0]->asgallPhoto_name;
// $ldescr = $picaAlbumPhotosList[0]->macPhoto_desc ;
$originalPhotoName = $picaAlbumPhotosList[0]->asgallPhoto_image;
$extension = explode('.', $originalPhotoName);
$originalPhotoName = $imgId.'_singlethumb.'.$extension[1];
$get_count = $wpdb->get_var("SELECT asgallPhoto_hitcount FROM " . $wpdb->prefix . "asgallphotos WHERE asgallPhoto_id='$imgId' ");
$upd_count = $get_count+1;
$sql = $wpdb->query("UPDATE " . $wpdb->prefix . "asgallphotos SET `asgallPhoto_hitcount` = '$upd_count' WHERE `asgallPhoto_id` = '$imgId'");
$descr = $originalPhotoName;
$phtid = $imgId ;
$asgallPhoto_desc = $picaAlbumPhotosList[0]->asgallPhoto_desc;
$extension = explode('.', $picaAlbumPhotosList[0]->asgallPhoto_image);
$imgPath = $picaAlbumPhotosList[0]->asgallPhoto_id."_singlethumb.".$extension[1];
$photourl = $site_url.'/wp-content/uploads/apptha-slider-gallery/'.$imgPath;
?>
';
$div .='
'.$albname.' > '.$photoName . ' > Photos '.$photosno. ' of ' .$total.'
';
$div .='";
$div .='
';
?>
asgallPhoto_desc ;
$p_link = $photourl;
$fbUrl = 'http://www.facebook.com/dialog/feed?app_id='.$fbapi.'&description='.$ldescr.'&picture='.$p_link.'&link='.urlencode($pageURL).'&name='.$descr.'&message=Comments&redirect_uri='.urlencode($pageURL);
$div .= '';
$div .= '';
$div .= '';
$div .= '';
// SHARE AND DOWNLOAD LINK //
$downloadImg = $site_url.'/wp-content/plugins/'.$folder.'/asgallDownload.php?imgname='.$imgPath;
if($asgallSettings[0][11] == 1) {
$div .='
';
} if($asgallSettings[0][9] == 1) {
$div .='
';
$div .='
';
$div .='
Share
';
}
$div .='
Views : '. $get_count.'
';
$div .= '
';
// ENDS SHARE AND DOWNLOAD LINK
$div .='
';
//$div .=''.$albname.' > '.$photoName.'
';
$div .='';
$div .="";
if($leftArrowId){ // show left arrow
$div .=" ";
}//if end
$div .=' ';
$div .="";
$div .=' ';
// $div .=' ';
$div .=" ";
$div .="";
if($rightArrowId){ // show right arrow
$div .=" ";
} //if for photosno right arrow
$div .=" ";
$div .='
';
// $div .= ' Views : '. $get_count.'
';
// $div .= ''. $photoName.'
';
// $div .= 'Views : '. $get_count.'
'. $photoName.'
';
if($asgallPhoto_desc != '')
{
$div .= ''. $asgallPhoto_desc.'
';
}
// FACEBOOK COMMENTS
// $div .='
//';
/*$div .='
';
$div .='';
if($asgallSettings[0][10] == 1) {
$div .= 'Comments ';
$div .='
';
// $div .=' ';
$div .= ' ';
} // Facebook comments
*/
$div .= '
';
}//if($imgId) end hear
else{
echo "" ;
}
} // if is end hear
// ********************************** ENDING SHOW SINGLE PHOTO ***************************************************************
// ********************************** SHOW PHOTOS IN SELECTED ALBUM ***************************************************************
elseif($asgall_albumid != '' && !($_REQUEST['pid'])){
$getAlbumid = $asgall_albumid;
// $j=0;
$albumnDetail = $wpdb->get_row("SELECT asgallAlbum_name,asgallAlbum_status FROM " . $wpdb->prefix . "asgallalbum WHERE asgallAlbum_id='$getAlbumid' AND is_delete=0 ");
$asgallPhotos = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "asgallphotos WHERE asgallAlbum_id='$getAlbumid' AND asgallPhoto_status='ON' AND is_delete=0 ORDER BY asgallPhoto_sorting ");
$div .= '';
?>
asgallAlbum_status == 'OFF')
{
$div .= ' Album does not exist/enable!!!
';
}
else if(count($asgallPhotos) == 0)
{
$div .= 'Images are not exist/enabled
';
}
else
{
$div .= '
'.$albumnDetail->asgallAlbum_name.' : ';
$pageURL = $pageURL;
foreach ($asgallPhotos as $renderPhotos)
{
$photoId = explode('_',$renderPhotos->asgallPhoto_image);
$extens = explode('.',$photoId[1]);
$phtImage = $photoId[0].'_photothumb.'.$extens[1];
$file_image = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $phtImage;
$asgallPhoto_id = $renderPhotos->asgallPhoto_id;
$photoName = $renderPhotos->asgallPhoto_name;
$albid = $renderPhotos->asgallAlbum_id;
$asgallPhoto_sorting = $renderPhotos->asgallPhoto_sorting+1;
$getpageId = $_REQUEST['page_id'];
$twidth = $asgallSettings[0][13];
$theight = $asgallSettings[0][14];
if (file_exists($file_image)) {
$file_image = $path . '/' . $phtImage;
} else {
$file_image = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/uploads/no-photo.png';
}
$div .= '';
$div .= '
';
$div .= "
$photoName
";
$j++;
if($j % $asgallSettings[0][3] == 0) { $div .= '
'; }
} // FOR LOOP
$div .='
';
} // Else condition of album enable
$k++;
} // IF END
// ********************************** ENDING SHOW PHOTOS IN SELECTED ALBUM ***************************************************************
else if(!($_REQUEST['pid']))
{
// ********************************** SHOW ALBUMS ***************************************************************
require_once( dirname(__FILE__) . '/asgallPagination.php');
$i=0;
$div .= '';
$limit = $asgallSettings[0][3]*$asgallSettings[0][4];
$sql = mysql_query("SELECT * FROM " . $wpdb->prefix . "asgallalbum WHERE asgallAlbum_status='ON' AND is_delete=0 ");
$start = findStart($limit);
$w = "LIMIT " . $start . ", " . $limit;
$count = mysql_num_rows($sql);
/* Find the number of pages based on $count and $limit */
$pages = findPages($count, $limit);
/* Now we use the LIMIT clause to grab a range of rows */
$asgallAlbums = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "asgallalbum WHERE asgallAlbum_status='ON' AND is_delete=0 $w"); // Getting album name
if(count($asgallAlbums) == 0)
{
$div .= ' Please enable the albums
';
}
else
{
if($asgallSettings[0][17] == 0)
{
$typeid = $asgallSettings[0][18];
switch ($typeid)
{
case 0:
$sliderPhotos = $wpdb->get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' ORDER BY asgallPhoto_hitcount DESC" ); // Getting album photos
break;
case 1:
$sliderPhotos = $wpdb->get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' ORDER BY asgallPhoto_id DESC" ); // Getting album photos
break;
case 2:
$sliderPhotos = $wpdb->get_results("SELECT asgallPhoto_id, asgallPhoto_desc, asgallPhoto_name ,asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE is_delete =0 and asgallPhoto_status = 'ON' and asgallFeaturedCover = 1" ); // Getting album photos
break;
default:
}
?>
.ad-gallery .ad-image-wrapper {
height:'.$asgallSettings[0][2].'px;
}
';
if(count($sliderPhotos) == 0)
{
$div .= 'No images for the slider';
}
else
{
$div .='
';
$div .='
';
foreach ($sliderPhotos as $values) {
$extens = explode('.',$values->asgallPhoto_image);
$thumbimg = $values->asgallPhoto_id.'_sliderthumb.'.$extens[1];
$photoName = $values->asgallPhoto_name;
$photoDesc = $values->asgallPhoto_desc;
$file_thumb = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $thumbimg;
$file_hover = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $values->asgallPhoto_image;
if (file_exists($file_hover))
{
$file_hover = $path.'/'.$values->asgallPhoto_image;
}
else
{
$file_hover = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/uploads/no-photo.png';
}
if (file_exists($file_thumb))
{
$file_thumb = $path . '/' . $thumbimg;
}
else
{
$file_thumb = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/uploads/no-photo.png';
}
$div .='
';
}
$div .='
';
} // if else close
} // If slider enable
$div .= '
Albums : ';
foreach ($asgallAlbums as $renderAlbum)
{
$photoId = explode('_',$renderAlbum->asgallAlbum_image);
$extens = explode('.',$photoId[1]);
$albumImage = $photoId[0].'_albumthumb.'.$extens[1];
$file_image = $uploadDir['basedir'] . '/apptha-slider-gallery/' . $albumImage;
$date = explode(' ',$renderAlbum->asgallAlbum_date);
$exp_date = explode('-',$date[0]);
$asgallPhtcount = $wpdb->get_row("SELECT count(*) as total, asgallPhoto_image FROM " . $wpdb->prefix . "asgallphotos WHERE asgallAlbum_id='$renderAlbum->asgallAlbum_id' and `is_delete` =0 and asgallPhoto_status = 'ON'"); // Getting album name
$asgallCount = $asgallPhtcount->total;
$twidth = $asgallSettings[0][5];
$theight = $asgallSettings[0][6];
$pageid = $_GET['page_id'];
if($renderAlbum->asgallAlbum_image == '' && $asgallCount == '0')
{
$file_image = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/images/nocover.jpg';
}
else if($renderAlbum->asgallAlbum_image == '' && $asgallCount != '0')
{
$get_image = explode('_',$asgallPhtcount->asgallPhoto_image);
$extension = explode('.',$get_image[1]);
$phototumb = $get_image[0].'_albumthumb.'.$extension[1];
$file_image = $path . '/' . $phototumb;
}
else if (file_exists($file_image)) {
$file_image = $path . '/' . $albumImage;
}
else
{
$file_image = $site_url . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/images/nocover.jpg';
}
if($pageid != '')
{
$url = $pageURL.'&albid='.$renderAlbum->asgallAlbum_id;
}
else
{
$url = $pageURL.'?albid='.$renderAlbum->asgallAlbum_id;
}
$div .= '';
$div .= '
'. $post_date = date('M d, Y', strtotime($renderAlbum->asgallAlbum_date)).'
photos: '.$asgallCount.'
';
$i++;
if($i % $asgallSettings[0][3] == 0) { $div .= '
'; }
} // For each ends
$div .='
';
$pagelist = pageList($_GET['pages'], $pages, $_GET['albid']);
$div .= '' . $pagelist . '
';
} // else of count greaterthan one
} // main if condition of album listing
// ********************************** ENDING OF SHOW ALBUMS ***************************************************************
$option_title = $wpdb->get_var("SELECT option_value FROM " . $wpdb->prefix . "options WHERE option_name='get_wpappslider_key'");
$get_title = unserialize($option_title);
$strDomainName = $site_url;
preg_match("/^(http:\/\/)?([^\/]+)/i", $strDomainName, $subfolder);
preg_match("/(?P[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i", $subfolder[2], $matches);
$customerurl = $matches['domain'];
$customerurl = str_replace("www.", "", $customerurl);
$customerurl = str_replace(".", "D", $customerurl);
$customerurl = strtoupper($customerurl);
$get_option_title = asgall_macgal_generate($customerurl);
if ($get_title['title'] != $get_option_title) {
$div .=''.apiKey_asgall().'
';
}
return $div;
} // End of Function
} // End of the class