"160", "dimthm" => "64", "dimimg" => "640", "linii" => "3", "coloane" => "3", "spatiere" => "3", "pagalbume" => "10", "lightbox" => _e('no','altpwa')."", "sprepicasa" => _e('no','altpwa').""); add_option("altpwa", $options); } $options = get_option('altpwa'); $baseurl = "http://picasaweb.google.com/data/feed/api/user/"; $baseurl2 = "http://picasaweb.google.com/data/feed/base/user/"; $pagalbume = $options["pagalbume"]; //paginare albume (cate albume pe o pagina); $dimthm = $options["dimthm"]; //32,48,64,160 sunt patrate, cu crop; 144,200,288,400,512 sunt fara crop ============ $dimth = $options["dimth"]; //32,48,64,160 sunt patrate, cu crop; 144,200,288,400,512 sunt fara crop ============ $dimimg = $options["dimimg"]; //576,640,720,800 =================== $linii = $options["linii"]; $coloane = $options["coloane"]; $pagpoze = $linii * $coloane; $spatiere = $options["spatiere"]; $lightbox = $options["lightbox"]; $sprepicasa = $options["sprepicasa"]; define('CALEIMG', get_option('siteurl').'/wp-content/plugins/altpwa/images/'); $uri = $_SERVER['REQUEST_URI']; $uri = str_replace("?","",$uri); $precale = get_option('siteurl').$uri."?"; add_action('wp_head', 'alt_pwa_header'); add_action('admin_menu', 'alt_pwa_meniu'); add_shortcode('altpwa', 'alt_pwa_func'); load_plugin_textdomain( 'altpwa', '/wp-content/plugins/altpwa' ); function alt_pwa_meniu() { add_options_page(__('Options','altpwa').' altPWA', 'altPWA', 8, basename(__FILE__), 'alt_pwa_admin'); } function alt_pwa_admin(){ $dimth_a = array(32,48,64,144,160,200,288,400,512); $dimthm_a = array(32,48,64,144,160); $dimimg_a = array(576,640,720,800); $lightbox_a = array(__('yes','altpwa')."",__('no','altpwa').""); $sprepicasa_a = array(__('yes','altpwa')."",__('no','altpwa').""); $options = get_option('altpwa'); if ( !is_array($options) ) { $defaults = array('dimth' => 160, 'dimthm' => 64, 'dimimg' => 640, 'linii' => 3, 'coloane' => 3, 'spatiere' => 3, 'pagalbume' => 10, 'lightbox' => _e('no','altpwa')."", 'sprepicasa' => _e('no','altpwa').""); $options = array_merge($defaults); } if (isset($_POST['update_altpwa'])) { $options['dimth'] = $_POST['dimth']; $options['dimthm'] = $_POST['dimthm']; $options['dimimg'] = $_POST['dimimg']; $options['linii'] = strip_tags(stripslashes($_POST['linii'])); $options['coloane'] = strip_tags(stripslashes($_POST['coloane'])); $options['spatiere'] = strip_tags(stripslashes($_POST['spatiere'])); $options['pagalbume'] = strip_tags(stripslashes($_POST['pagalbume'])); $options['lightbox'] = $_POST['lightbox']; $options['sprepicasa'] = $_POST['sprepicasa']; update_option('altpwa', $options); echo "

".__("Done with updating","altpwa")."...

"; } echo "
"; echo "

".__("Options","altpwa")." altPicasaWebAlbum (altPWA)

"; ?>

"; } function alt_pwa_header(){ global $wp_query, $wpdb,$lightbox; $id = $wp_query->post->ID; $rezs = $wpdb->get_results("SELECT post_content FROM wp_posts WHERE (id='".$id."')"); foreach ($rezs as $rez){ $temp = $rez->post_content; if( stristr($temp,"[altpwa user=")!==FALSE && ($lightbox==1)) { echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; } } } function pwa_albume(){ global $baseurl,$baseurl2,$user,$pagalbume,$user,$album,$precale,$spatiere,$month; if(is_feed()){ $html .= "

Albumele pot fi vazute doar online.

"; return $html; } if(isset($_REQUEST["album"])){ $album = $_REQUEST["album"]; $html = pwa_album(); return $html; } $html = ""; if(isset($_REQUEST["pagina"])) $pagina=$_REQUEST["pagina"]-0; else $pagina=1; $url = "http://picasaweb.google.com/data/feed/api/user/$user?alt=json&thumbsize=144"; $continut = file_get_contents($url); $feed = json_decode($continut,true); $dim = count($feed["feed"]["entry"]); $url = "http://picasaweb.google.com/data/feed/api/user/$user?alt=json&start-index=".(($pagina-1)*$pagalbume+1)."&max-results=".$pagalbume."&thumbsize=160"; $continut = file_get_contents($url); $feed = json_decode($continut,true); $pagini = ceil($dim / $pagalbume); $precale = str_replace("??","?",str_replace("&pagina=".$pagina,"",$precale)); if($pagini>1){ $html .= "

"; if($pagina>1) $html .= ""; else $html .= ""; $html .= " "; if($dim>$pagina*$pagalbume) $html .= ""; else $html .= ""; $html .= "
".__('Pages','altpwa').": "; for($i=1;$i <= $pagini; $i++) if($i==$pagina) $html .= "".$i." "; else $html .= "".$i." "; $html .= "

"; } $html .= ""; for($i = 0; $i < count($feed["feed"]["entry"]); $i++){ $html .= ""; } $html .= "

"; $html .= "

".$feed["feed"]["entry"][$i]["title"]["\$t"]." (".$feed["feed"]["entry"][$i]["gphoto\$numphotos"]["\$t"]." ".__('photos','altpwa').")
"; $cand = $feed["feed"]["entry"][$i]["published"]["\$t"]; $html .= (substr($cand,8,2)-0)." ".$month[substr($cand,5,2)]." ".substr($cand,0,4); //$html .= date(get_option('date_format'),strtotime($cand)); if($feed["feed"]["entry"][$i]["gphoto\$location"]["\$t"]!="") $html .= ", ".$feed["feed"]["entry"][$i]["gphoto\$location"]["\$t"]."

"; if($feed["feed"]["entry"][$i]["summary"]["\$t"]!="") $html .= "

".$feed["feed"]["entry"][$i]["summary"]["\$t"]."

"; $html .= "
"; return $html; } function pwa_album(){ global $baseurl,$baseurl2,$user,$pagpoze,$pagalbume,$user,$album,$dimth,$dimimg,$spatiere,$coloane,$linii,$lightbox,$precale,$sprepicasa,$month; if(isset($_REQUEST["foto"])){ $album = $_REQUEST["album"]; $foto = $_REQUEST["foto"]; $html = pwa_foto($album,$foto); return $html; } if(isset($_REQUEST["pagina"])) $pagina=$_REQUEST["pagina"]-0; else $pagina=1; $html = ""; $precale = str_replace("&album=".$album,"",str_replace("&pagina=".$pagina,"",$precale)); $url = "http://picasaweb.google.com/data/feed/api/user/$user?alt=json&thumbsize=144"; $continut = file_get_contents($url); $feed = json_decode($continut,true); for($i=0;$i (".$feed["feed"]["gphoto\$numphotos"]["\$t"]." ".__('photos','altpwa').")
"; $cand = $feed["feed"]["updated"]["\$t"]; $html .= date('j', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000)." ".$month["".date('m', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000)]." ".date('Y', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000); //$html .= date(get_option('date_format'),strtotime($cand)); if($feed["feed"]["gphoto\$location"]["\$t"] != "") $html .= ", ".$feed["feed"]["gphoto\$location"]["\$t"]; $html .= "
".$feed["feed"]["subtitle"]["\$t"]."

"; if(is_feed()){ $html .= "

Albumul poate fi vazut doar online.

"; return $html; } $path_album = $feed["feed"]["link"][1]["href"]; $dim = $feed["feed"]["gphoto\$numphotos"]["\$t"]-0; $cate = count($feed["feed"]["entry"]); $pagini = ceil($dim / $pagpoze); if($pagini>1){ $html .= "

"; if($pagina>1) $html .= ""; else $html .= ""; $html .= "  "; if($dim>$pagina*$pagpoze) $html .= ""; else $html .= ""; $html .= "
".__('Pages','altpwa').": "; for($i=1;$i <= $pagini; $i++) if($i==$pagina) $html .= "".$i." "; else $html .= "".$i." "; $html .= "

"; } else if(isset($_REQUEST["album"])) $html .= "

"; $html .= ""; $incheiat=0; for($i=0;$i<$cate;$i++){ if($i%$coloane == 0) { echo ""; $incheiat = 0; } $html .= ""; if($i%$coloane == ($coloane-1)){ $html .= ""; $incheiat = 1; } } if(!$incheiat){ $i--; while(($i%$coloane)!=($coloane-1)){ $html .= ""; $i++; } $html .= ""; } $html .= "

"; if($lightbox==1) $html .= ""; else //$html .= ""; $html .= ""; $html .= "

"; if($sprepicasa==1) $html .= "

".__("Note","altpwa").": ".__("To see the pictures in the original Picasa album, click","altpwa")." ".__("here","altpwa").""; //$html .= "

Notă: Pentru a vedea fotografiile cu o viteză mai bună şi la o dimensiune mai mare mergeţi aici."; return $html; } function pwa_foto($album,$foto){ global $baseurl,$baseurl2,$user,$pagpoze,$user,$album,$dimth,$dimthm,$dimimg,$spatiere,$coloane,$linii,$lightbox,$precale,$month; $html = ""; $precale = str_replace("&album=".$album,"",str_replace("&foto=".$foto,"",$precale)); $url = "http://picasaweb.google.com/data/feed/api/user/$user/album/$album?alt=json&thumbsize=144"; //echo $url; $continut = file_get_contents($url); $feed = json_decode($continut,true); $html .= "

".$feed["feed"]["title"]["\$t"]." (".$feed["feed"]["gphoto\$numphotos"]["\$t"]." ".__('photos','altpwa').")
"; $cand = $feed["feed"]["updated"]["\$t"]; $html .= date('j', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000)." ".$month["".date('m', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000)]." ".date('Y', $feed["feed"]["gphoto\$timestamp"]["\$t"]/1000); //$html .= date(get_option('date_format'),strtotime($cand)); if($feed["feed"]["gphoto\$location"]["\$t"] != "") $html .= ", ".$feed["feed"]["gphoto\$location"]["\$t"]; $html .= "
".$feed["feed"]["subtitle"]["\$t"]."

"; $path_album = $feed["feed"]["link"][2]["href"]; $dim = $feed["feed"]["gphoto\$numphotos"]["\$t"]-0; for($i=0;$i"; else $html .= ""; $html .= "  "; if(count($feed["feed"]["entry"])>($idcrt+1)) $html .= ""; else $html .= ""; $html .= "

"; $html .= "

".$feed["feed"]["entry"][$idcrt]["summary"]["\$t"]."

"; $html .= "

"; if($sprepicasa==1) $html .= "
".__("original image","altpwa")." (".$feed["feed"]["entry"][$idcrt]["gphoto\$width"]["\$t"]." x ".$feed["feed"]["entry"][$idcrt]["gphoto\$height"]["\$t"].")"; $html .= "

"; $html .= ""; $crt++; } $crt = $idcrt - 1; for($i=0;$i<3;$i++) if(($crt-(2-$i))>=0) $html .= ""; $crt = $idcrt + 1; $html .= ""; for($i=0;($i<3) && ($crt"; } for(;$i<3;$i++) $html .= ""; $html .= "
"; $crt = $idcrt; while(3-$crt>0){ $html .= "

"; return $html; } function pwa_square($care=1){ global $dimth,$dimthm; if($care==2) return ($dimthm ==32) || ($dimthm ==48) || ($dimthm ==64) || ($dimthm ==160); else return ($dimth ==32) || ($dimth ==48) || ($dimth ==64) || ($dimth ==160); } function alt_pwa_func($atts){ global $baseurl,$user,$album,$dimth,$precale; $precale = "".get_permalink(); if(stripos($precale,"?")===false) $precale .= "?"; extract(shortcode_atts(array('user'=>'','album' => ''), $atts)); $result = ""; if($album=="") $result .= pwa_albume(); else $result .= pwa_album(); return $result; } ?>