Changeset 1141552
- Timestamp:
- 04/22/2015 01:08:55 AM (11 years ago)
- Location:
- piwigopress/trunk
- Files:
-
- 3 added
- 1 deleted
- 9 edited
-
Makefile (modified) (1 diff)
-
PiwigoPress_get.php (modified) (3 diffs)
-
PiwigoPress_options.php (modified) (1 diff)
-
PiwigoPress_widget.php (modified) (5 diffs)
-
index.php (added)
-
js/piwigopress_adm.js (modified) (7 diffs)
-
js/piwigopress_adm.min.js (modified) (1 diff)
-
piwigopress.php (modified) (7 diffs)
-
piwigopress_admin.php (modified) (2 diffs)
-
piwigopress_thumbnails_reloader.php (added)
-
piwigopress_utils.php (added)
-
readme.txt (modified) (2 diffs)
-
thumbnails_reloader.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
piwigopress/trunk/Makefile
r1136944 r1141552 35 35 NV2=`grep "^Version:" piwigopress.php | awk -F' ' '{print $$NF}'` ; \ 36 36 NV3=`grep 'define(.PWGP_VERSION' piwigopress.php | sed -e "s/^.*PWGP_VERSION'\s*,\s*'//" -e "s/'.*$$//" -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\)\./\1/'` ; \ 37 NV4=`grep 'define(.PWGP_VERSION' piwigopress_admin.php | sed -e "s/^.*PWGP_VERSION'\s*,\s*'//" -e "s/'.*$$//" -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\)\./\1/'` ; \ 38 echo "V1 = $$NV1 (readme.txt)\nV2 = $$NV2 (piwigopress.php header)\nV3 = $$NV3 (piwigopress.php variable)\nV4 = $$NV4 (piwigopress_admin.php variable)"; \ 39 if [ "$$NV1" != "$$NV2" -o "$$NV1" != "$$NV3" -o "$$NV1" != "$$NV4" ] ; then false ; else true ; fi 37 echo "V1 = $$NV1 (readme.txt)\nV2 = $$NV2 (piwigopress.php header)\nV3 = $$NV3 (piwigopress.php variable)"; \ 38 if [ "$$NV1" != "$$NV2" -o "$$NV1" != "$$NV3" ] ; then false ; else true ; fi 40 39 -
piwigopress/trunk/PiwigoPress_get.php
r1029167 r1141552 2 2 if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */ 3 3 if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */ 4 //error_reporting(E_ALL);5 if (!isset($pwg_mode)) $pwg_mode = ''; // Remind which process is working well6 $pwg_prev_host = ''; // Remind last requested gallery7 4 8 5 function pwg_ret_protocol() { … … 18 15 } 19 16 20 function pwg_get_contents($url, $mode='', $timeout=5) { 21 22 global $pwg_mode, $pwg_prev_host; 17 function pwg_get_contents($url) { 23 18 24 19 # support same-host piwigo … … 33 28 $fullurl = $url; 34 29 } 35 $host = (strtolower(substr($fullurl,0,7)) == 'http://') ? substr($fullurl,7) : $fullurl; 36 $host = (strtolower(substr($host,0,8)) == 'https://') ? substr($host,8) : $host; 37 $doc = substr($host, strpos($host, '/')); 38 $host = substr($host, 0, strpos($host, '/')); 39 if ($pwg_prev_host != $host) $pwg_mode = ''; // What was possible with one website could be different with another 40 $pwg_prev_host = $host; 41 if ($mode == '') $mode = $pwg_mode; // Can be forced by the requester 42 // $mode = 'fs'; // Test purpose only => '' all, 'fs' fsockopen, 'ch' cURL 43 //echo "\n <!-- *** PiwigoPress Getmode = " . $mode . " *** -->\n"; 44 // 1 - The simplest solution: file_get_contents 45 // Contraint: php.ini 46 // ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. 47 // allow_url_fopen = On 48 if ( $mode == '' and true === (bool) ini_get('allow_url_fopen') ) { 49 $value = @file_get_contents($fullurl); 50 if ( $value !== false) return $value; 51 } 52 if ( $mode == '' ) $mode = 'fs'; 53 // 2 - Often accepted access: fsockopen 54 if ($mode == 'fs') { 55 $fs = @fsockopen($host, 80, $errno, $errstr, $timeout); 56 if ( $fs !== false ) { 57 fwrite($fs, 'GET ' . $doc . " HTTP/1.1\r\n"); 58 fwrite($fs, 'Host: ' . $host . "\r\n"); 59 fwrite($fs, "Connection: Close\r\n\r\n"); 60 stream_set_blocking($fs, TRUE); 61 stream_set_timeout($fs,$timeout); // Again the $timeout on the get 62 $info = stream_get_meta_data($fs); 63 $value = ''; 64 while ((!feof($fs)) && (!$info['timed_out'])) { 65 $value .= fgets($fs, 4096); 66 $info = stream_get_meta_data($fs); 67 flush(); 68 } 69 $value = substr($value, strpos($value,'a:2:{s:4:"stat";')); 70 $pwg_mode = 'fs'; 71 if ( $info['timed_out'] === false ) return $value; 72 } 73 } 74 // 3 - Sometime another solution: curl_exec 75 // See http://fr2.php.net/manual/en/curl.installation.php 76 if ($mode !== 'Err' and function_exists('curl_init')) { 77 $ch = @curl_init(); 78 @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 79 @curl_setopt($ch, CURLOPT_URL, $fullurl); 80 @curl_setopt($ch, CURLOPT_HEADER, 1); 81 @curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0'); 82 @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 83 @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 84 $value = @curl_exec($ch); 85 $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE); 86 $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); 87 @curl_close($value); 88 if ($value !== false and $status >= 200 and $status < 400) { 89 $value = substr($value, $header_length); 90 $pwg_mode = 'ch'; 91 return $value; 92 } 93 } 94 // No other solutions 95 $return["stat"] = 'failed'; 96 if ($mode !== 'Err') { 97 echo "\n <!== PiwigoPress_get: failed on file_get, fsockopen and cURL processes " 98 . "- No solution available on this website with its current configuration ==>\n"; 99 } 100 $pwg_mode = 'Err'; 101 return serialize($return); 30 31 return wp_remote_get($fullurl); 102 32 } 103 ?> 33 -
piwigopress/trunk/PiwigoPress_options.php
r1136944 r1141552 217 217 </tr></table> 218 218 </div>'; 219 ?> 219 -
piwigopress/trunk/PiwigoPress_widget.php
r1106463 r1141552 2 2 if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */ 3 3 if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */ 4 require_once('PiwigoPress_get.php'); 4 5 5 6 global $wpdb; /* Need for recent thumbnail access */ … … 53 54 echo $before_widget; 54 55 echo $title; 55 if (!function_exists('pwg_get_contents')) include 'PiwigoPress_get.php';56 56 57 57 if ($thumbnail) { … … 60 60 . 'ws.php?method=pwg.categories.getImages&format=php' 61 61 . $options . '&recursive=true&order=random&f_with_thumbnail=true'); 62 $thumbc = unserialize($response);63 if ($thumbc["stat"] == 'ok') {62 if (!is_wp_error($response)) { 63 $thumbc = unserialize($response['body']); 64 64 /* fix from http://wordpress.org/support/topic/piwigo-260-and-piwigopress-223 65 65 ** for piwigo 2.6 … … 121 121 $response = pwg_get_contents( $piwigo_url 122 122 . 'ws.php?method=pwg.categories.getList&format=php&public=true'); 123 $cats = unserialize($response);124 if ($cats["stat"] == 'ok') {123 if (!is_wp_error($response)) { 124 $cats = unserialize($response['body']); 125 125 echo '<ul style="clear: both;"><li>' . __('Pictures categories','pwg') . '<ul>'; 126 126 foreach ($cats["result"]["categories"] as $cat) { … … 166 166 echo $after_widget; 167 167 168 ?> 168 -
piwigopress/trunk/js/piwigopress_adm.js
r1136944 r1141552 74 74 var url = $("#PWGP_finder").val(); // New URL to load 75 75 $('#PWGP_Load_Active').show(); // Busy icon is on 76 76 77 $.ajax({ 77 url: '../wp-content/plugins/piwigopress/thumbnails_reloader.php?&loadcats=1&url='+url, 78 cache: false, 78 url: PwgpAjax.ajaxUrl, 79 method: 'POST', 80 data: { 81 action: 'pwgp-categories', 82 nonce: PwgpAjax.nonce, 83 url: url 84 }, 85 dataType: "json", 79 86 success: function(data) { 80 87 // console.log('got back: ' + data); 81 var data = jQuery.parseJSON(data);82 88 var $dropper = $('#PWGP_catscroll'); 83 89 // remove all but the 0 value which is translated! … … 92 98 $dropper.append('<option value='+id+'>'+nm+'</option>'); 93 99 } 94 $dropper.select();95 $dropper.focus();100 $dropper.select(); 101 $dropper.focus(); 96 102 } 97 103 }, … … 118 124 var catid = $('#PWGP_catscroll').val(); 119 125 // console.log('catid='+catid); 120 if (!catid) { catid = 0 } ; 121 $gallery.load('../wp-content/plugins/piwigopress/thumbnails_reloader.php?&url='+url+'&category='+catid, function() { 126 if (!catid) { catid = 0; } 127 128 $.post(PwgpAjax.ajaxUrl, { 129 action: 'pwgp-thumbnails', 130 nonce: PwgpAjax.nonce, 131 url: url, 132 category: catid 133 }, function(response) { 134 $gallery.empty().append(response); 122 135 $("#PWGP_more").show().unbind().click(function () { 123 136 Get_more(); … … 142 155 $('#PWGP_Load_Active').show(); 143 156 catid = $('#PWGP_catscroll').val(); 144 if (!catid) { catid = 0 } ;157 if (!catid) { catid = 0; } 145 158 // here we need to add the category id if set to the argument list, for now only category 146 159 // and recursive is also necessary!! 147 160 $.ajax({ 148 url: '../wp-content/plugins/piwigopress/thumbnails_reloader.php?&loaded='+loaded+'&url='+url+'&category='+catid+'&recursive=1', 149 cache: false, 161 url: PwgpAjax.ajaxUrl, 162 data: { 163 action: 'pwgp-thumbnails', 164 nonce: PwgpAjax.nonce, 165 url: url, 166 loaded: loaded, 167 category: catid, 168 recursive: 1 169 }, 170 method: 'post', 150 171 success: function(html){ 151 Drag_n_Drop(html);172 Drag_n_Drop(html); 152 173 } 153 174 }); … … 157 178 if (loaded > 99) added = 100; // More we load larger next load might be 158 179 loaded += added; 159 } ;180 } 160 181 function Drag_n_Drop(thumbs) { 161 182 $($gallery).append(thumbs); … … 177 198 if ($('li:visible', $gallery).size() > 0) $("#PWGP_hide").show(); 178 199 $('#PWGP_Load_Active').hide(); 179 } ;200 } 180 201 function insertImage( $item ) { 181 202 $item.fadeOut(function() { … … 225 246 $("a#PWGP_Gen").show(); 226 247 $("a#PWGP_rst").show(); 227 } ;248 } 228 249 }); // End of Loaded 229 250 }); -
piwigopress/trunk/js/piwigopress_adm.min.js
r1136944 r1141552 1 (function(a){a.fn.extend({insertAtCaret:function(b){return this.each(function(e){if(document.selection){this.focus();sel=document.selection.createRange();sel.text=b;this.focus()}else{if(this.selectionStart||this.selectionStart=="0"){var d=this.selectionStart;var c=this.selectionEnd;var f=this.scrollTop;this.value=this.value.substring(0,d)+b+this.value.substring(c,this.value.length);this.focus();this.selectionStart=d+b.length;this.selectionEnd=d+b.length;this.scrollTop=f}else{this.value+=b;this.focus()}}})}});a(document).ready(function(){var b=true;a("a#PWGP_button").unbind().click(function(){if(b){if(a("#dashboard-widgets-wrap").size()==0){var c="#poststuff"}else{var c="#dashboard-widgets-wrap"}if(a("#PWGP_shortcoder").size()==0){var d=a("#PWGP_Gal_finder").html();a(c).before('<div id="PWGP_shortcoder" />');a("#PWGP_shortcoder").html(d);a("#PWGP_Gal_finder").remove()}else{a("#PWGP_shortcoder").show()}a("#PWGP_catscroll").on("focus",function(){current_catid=this.value}).change(function(){if(current_catid!=this.value){a("#PWGP_more").hide();a("#PWGP_hide").hide();a("#PWGP_show").hide();a("#PWGP_show_stats").hide()}});a("#PWGP_finder").focus(function(){current_url=this.value}).change(function(){if(current_url!=this.value){a("#PWGP_more").hide();a("#PWGP_hide").hide();a("#PWGP_show").hide();a("#PWGP_show_stats").hide();a("#PWGP_catscroll").hide();a("#PWGP_loadcat").show();a("#PWGP_catscroll").val(0)}});a("#PWGP_loadcat").unbind().click(function(){var e=a("#PWGP_finder").val();a("#PWGP_Load_Active").show();a.ajax({url: "../wp-content/plugins/piwigopress/thumbnails_reloader.php?&loadcats=1&url="+e,cache:false,success:function(j){var j=jQuery.parseJSON(j);var h=a("#PWGP_catscroll");a('#PWGP_catscroll option[value!="0"]').remove();if(j.stat=="ok"){var g=j.result.categories;for(var l=0;l<g.length;l++){var f=g[l].name;var k=g[l].id;h.append("<option value="+k+">"+f+"</option>")}h.select();h.focus()}},error:function(g,h,f){console.log("cannot load list of piwigo categories: "+h+" "+f+" "+g.responseText)}});a("#PWGP_Load_Active").hide();a("#PWGP_loadcat").hide();a("#PWGP_catscroll").show()});a("#PWGP_load").unbind().click(function(){var j=a("#PWGP_finder").val(),h=5,f=a("#PWGP_dragger"),k=a("#PWGP_dragger li"),e=a("#PWGP_dropping");a(".PWGP_system").show(500);a("#PWGP_Load_Active").show();var g=a("#PWGP_catscroll").val();if(!g){g=0}f.load("../wp-content/plugins/piwigopress/thumbnails_reloader.php?&url="+j+"&category="+g,function(){a("#PWGP_more").show().unbind().click(function(){l()});a("#PWGP_hide").show().unbind().click(function(){var o=Math.max(1,Math.floor(a("li:visible",f).size()/2));for(i=0;i<o;i++){f.find("li:visible").first().hide()}if(a("li:visible",f).size()==0){a("#PWGP_hide").hide()}else{a("#PWGP_show").show().unbind().click(function(){a("li:hidden",f).show();a("#PWGP_show").hide()})}});n();a("#PWGP_Load_Active").hide();function l(){a("#PWGP_Load_Active").show();g=a("#PWGP_catscroll").val();if(!g){g=0}a.ajax({url:"../wp-content/plugins/piwigopress/thumbnails_reloader.php?&loaded="+h+"&url="+j+"&category="+g+"&recursive=1",cache:false,success:function(p){n(p)}});var o=5;if(h>9){o=10}if(h>49){o=50}if(h>99){o=100}h+=o}function n(o){a(f).append(o);var q=(a("#PWGP_dragger img").first().height())+20;f.height(q);e.height(q+25).css("min-height",q+25);a("#PWGP_dropping ul").height(q);a("li",f).draggable({revert:true,cursor:"move",zIndex:50});var p=a("li",e).size()+a("li",f).size();a("#PWGP_show_stats").show().find("#PWGP_stats").text(" "+p+" / "+h);e.droppable({activeClass:"ui-state-highlight",drop:function(r,s){m(s.draggable)}});if(a("li:visible",f).size()>0){a("#PWGP_hide").show()}a("#PWGP_Load_Active").hide()}function m(o){o.fadeOut(function(){var p=a("ul",e);o.appendTo(p).fadeIn();a("a#PWGP_Gen").unbind().click(function(){var q=window.tinyMCE.majorVersion;a("img",e).each(function(){var s=a(this).attr("title").split("]");var r=s[0];var w=a("#thumbnail_size input[type=radio][name=thumbnail_size]:checked").attr("value");if(w!=="la"){r+=" size='"+w+"'"}a("input#desc_check[name=desc_check]").attr("value",0);$hdesc=0+a("input#desc_check[name=desc_check]:checked").attr("value",1).attr("value");if($hdesc==1){r+=" desc=1"}var u=a("#photo_class").val();if(u!=""){r+=" class='"+u+"'"}var t=a("#link_type input[type=radio][name=link_type]:checked").attr("value");if(t!="picture"){r+=" lnktype='"+t+"'"}var v=a("#open_type input[type=radio][name=open_type]:checked").attr("value");if(v!=""){r+=" opntype='"+v+"'"}var r="\t"+r+"] \n\r";a("#content").insertAtCaret(r);if(q>="4"){tinyMCE.execCommand("mceInsertContent",false,r)}else{tinyMCE.execInstanceCommand("content","mceInsertContent",false,r)}})});a("a#PWGP_rst").unbind().click(function(){a("li",e).appendTo(f);a("a#PWGP_Gen").hide();a("a#PWGP_rst").hide();a("#PWGP_show_stats").show().find("#PWGP_stats").text(" "+a("li",f).size()+" / "+h)})});a("a#PWGP_Gen").show();a("a#PWGP_rst").show()}})});b=false}else{a("div#PWGP_shortcoder").hide();b=true}})})}(jQuery));1 (function(a){a.fn.extend({insertAtCaret:function(b){return this.each(function(e){if(document.selection){this.focus();sel=document.selection.createRange();sel.text=b;this.focus()}else{if(this.selectionStart||this.selectionStart=="0"){var d=this.selectionStart;var c=this.selectionEnd;var f=this.scrollTop;this.value=this.value.substring(0,d)+b+this.value.substring(c,this.value.length);this.focus();this.selectionStart=d+b.length;this.selectionEnd=d+b.length;this.scrollTop=f}else{this.value+=b;this.focus()}}})}});a(document).ready(function(){var b=true;a("a#PWGP_button").unbind().click(function(){if(b){if(a("#dashboard-widgets-wrap").size()==0){var c="#poststuff"}else{var c="#dashboard-widgets-wrap"}if(a("#PWGP_shortcoder").size()==0){var d=a("#PWGP_Gal_finder").html();a(c).before('<div id="PWGP_shortcoder" />');a("#PWGP_shortcoder").html(d);a("#PWGP_Gal_finder").remove()}else{a("#PWGP_shortcoder").show()}a("#PWGP_catscroll").on("focus",function(){current_catid=this.value}).change(function(){if(current_catid!=this.value){a("#PWGP_more").hide();a("#PWGP_hide").hide();a("#PWGP_show").hide();a("#PWGP_show_stats").hide()}});a("#PWGP_finder").focus(function(){current_url=this.value}).change(function(){if(current_url!=this.value){a("#PWGP_more").hide();a("#PWGP_hide").hide();a("#PWGP_show").hide();a("#PWGP_show_stats").hide();a("#PWGP_catscroll").hide();a("#PWGP_loadcat").show();a("#PWGP_catscroll").val(0)}});a("#PWGP_loadcat").unbind().click(function(){var e=a("#PWGP_finder").val();a("#PWGP_Load_Active").show();a.ajax({url:PwgpAjax.ajaxUrl,method:"POST",data:{action:"pwgp-categories",nonce:PwgpAjax.nonce,url:e},dataType:"json",success:function(j){var h=a("#PWGP_catscroll");a('#PWGP_catscroll option[value!="0"]').remove();if(j.stat=="ok"){var g=j.result.categories;for(var l=0;l<g.length;l++){var f=g[l].name;var k=g[l].id;h.append("<option value="+k+">"+f+"</option>")}h.select();h.focus()}},error:function(g,h,f){console.log("cannot load list of piwigo categories: "+h+" "+f+" "+g.responseText)}});a("#PWGP_Load_Active").hide();a("#PWGP_loadcat").hide();a("#PWGP_catscroll").show()});a("#PWGP_load").unbind().click(function(){var j=a("#PWGP_finder").val(),h=5,f=a("#PWGP_dragger"),k=a("#PWGP_dragger li"),e=a("#PWGP_dropping");a(".PWGP_system").show(500);a("#PWGP_Load_Active").show();var g=a("#PWGP_catscroll").val();if(!g){g=0}a.post(PwgpAjax.ajaxUrl,{action:"pwgp-thumbnails",nonce:PwgpAjax.nonce,url:j,category:g},function(l){f.empty().append(l);a("#PWGP_more").show().unbind().click(function(){m()});a("#PWGP_hide").show().unbind().click(function(){var p=Math.max(1,Math.floor(a("li:visible",f).size()/2));for(i=0;i<p;i++){f.find("li:visible").first().hide()}if(a("li:visible",f).size()==0){a("#PWGP_hide").hide()}else{a("#PWGP_show").show().unbind().click(function(){a("li:hidden",f).show();a("#PWGP_show").hide()})}});o();a("#PWGP_Load_Active").hide();function m(){a("#PWGP_Load_Active").show();g=a("#PWGP_catscroll").val();if(!g){g=0}a.ajax({url:PwgpAjax.ajaxUrl,data:{action:"pwgp-thumbnails",nonce:PwgpAjax.nonce,url:j,loaded:h,category:g,recursive:1},method:"post",success:function(q){o(q)}});var p=5;if(h>9){p=10}if(h>49){p=50}if(h>99){p=100}h+=p}function o(p){a(f).append(p);var r=(a("#PWGP_dragger img").first().height())+20;f.height(r);e.height(r+25).css("min-height",r+25);a("#PWGP_dropping ul").height(r);a("li",f).draggable({revert:true,cursor:"move",zIndex:50});var q=a("li",e).size()+a("li",f).size();a("#PWGP_show_stats").show().find("#PWGP_stats").text(" "+q+" / "+h);e.droppable({activeClass:"ui-state-highlight",drop:function(s,t){n(t.draggable)}});if(a("li:visible",f).size()>0){a("#PWGP_hide").show()}a("#PWGP_Load_Active").hide()}function n(p){p.fadeOut(function(){var q=a("ul",e);p.appendTo(q).fadeIn();a("a#PWGP_Gen").unbind().click(function(){var r=window.tinyMCE.majorVersion;a("img",e).each(function(){var t=a(this).attr("title").split("]");var s=t[0];var x=a("#thumbnail_size input[type=radio][name=thumbnail_size]:checked").attr("value");if(x!=="la"){s+=" size='"+x+"'"}a("input#desc_check[name=desc_check]").attr("value",0);$hdesc=0+a("input#desc_check[name=desc_check]:checked").attr("value",1).attr("value");if($hdesc==1){s+=" desc=1"}var v=a("#photo_class").val();if(v!=""){s+=" class='"+v+"'"}var u=a("#link_type input[type=radio][name=link_type]:checked").attr("value");if(u!="picture"){s+=" lnktype='"+u+"'"}var w=a("#open_type input[type=radio][name=open_type]:checked").attr("value");if(w!=""){s+=" opntype='"+w+"'"}var s="\t"+s+"] \n\r";a("#content").insertAtCaret(s);if(r>="4"){tinyMCE.execCommand("mceInsertContent",false,s)}else{tinyMCE.execInstanceCommand("content","mceInsertContent",false,s)}})});a("a#PWGP_rst").unbind().click(function(){a("li",e).appendTo(f);a("a#PWGP_Gen").hide();a("a#PWGP_rst").hide();a("#PWGP_show_stats").show().find("#PWGP_stats").text(" "+a("li",f).size()+" / "+h)})});a("a#PWGP_Gen").show();a("a#PWGP_rst").show()}})});b=false}else{a("div#PWGP_shortcoder").hide();b=true}})})}(jQuery)); -
piwigopress/trunk/piwigopress.php
r1136944 r1141552 4 4 Plugin URI: http://wordpress.org/extend/plugins/piwigopress/ 5 5 Description: PiwigoPress from any open API Piwigo gallery, swiftly includes your photos in Posts/Pages and/or add randomized thumbnails and menus in your sidebar. 6 Version: 2.2 86 Version: 2.29 7 7 Author: Norbert Preining 8 8 Author URI: http://www.preining.info/ 9 9 */ 10 if (!defined('ABSPATH')) exit; /* Avoid unpredicted access */ 10 11 if (defined('PHPWG_ROOT_PATH')) return; /* Avoid Automatic install under Piwigo */ 11 12 /* Copyright 2009-2012 VDigital (email : vpiwigo[at]gmail[dot]com) … … 27 28 */ 28 29 if (!defined('PWGP_NAME')) define('PWGP_NAME','PiwigoPress'); 29 if (!defined('PWGP_VERSION')) define('PWGP_VERSION','2.2. 8');30 if (!defined('PWGP_VERSION')) define('PWGP_VERSION','2.2.9'); 30 31 31 32 load_plugin_textdomain('pwg', false, dirname (plugin_basename( __FILE__ ) ) . '/languages/'); 32 33 add_shortcode('PiwigoPress', 'PiwigoPress_photoblog'); 34 35 require_once('piwigopress_utils.php'); 36 require_once('PiwigoPress_get.php'); 33 37 34 38 function PiwigoPress_photoblog($parm) { … … 63 67 $deriv = array ( 'sq' => 'square', 'th' => 'thumb', 'sm' => 'small', 'xs' => 'xsmall', '2s' => '2small', 64 68 'me' => 'medium', 'la' => 'large', 'xl' => 'xlarge', 'xx' => 'xxlarge'); 65 if (!function_exists('pwg_get_contents')) include 'PiwigoPress_get.php';66 69 $response = pwg_get_contents( $url . 'ws.php?method=pwg.images.getInfo&format=php&image_id=' . $id); 67 $thumbc = unserialize($response);68 if ($thumbc["stat"] == 'ok') {70 if (!is_wp_error($response)) { 71 $thumbc = unserialize($response['body']); 69 72 $picture = $thumbc["result"]; 70 73 //var_dump($picture); … … 190 193 if ( is_admin() ) { 191 194 wp_register_script( 'piwigopress_a', plugins_url( 'piwigopress/js/piwigopress_adm.min.js'), array('jquery'), PWGP_VERSION ); 195 wp_localize_script( 'piwigopress_a', 'PwgpAjax', array( 196 'ajaxUrl' => admin_url('admin-ajax.php'), 197 'nonce' => wp_create_nonce('piwigopress-admin-nonce') 198 )); 192 199 wp_enqueue_script( 'jquery-ui-draggable' ); 193 200 wp_enqueue_script( 'jquery-ui-droppable' ); … … 197 204 } 198 205 add_action('wp_footer', PWGP_NAME . '_load_in_footer'); 206 207 // proxy a categories call from another server 208 function PiwigoPress_ajax_categories() { 209 $url = PWGP_secure($_POST['url']); 210 $nonce = $_POST['nonce']; 211 212 // check nonce and permissions 213 if (!wp_verify_nonce($nonce, 'piwigopress-admin-nonce') || 214 (!current_user_can('edit_posts') && !current_user_can('edit_pages'))) { 215 http_response_code(400); 216 die; 217 } 218 219 $url.= "ws.php?format=json&method=pwg.categories.getList&recursive=true"; 220 $response = pwg_get_contents($url); 221 if (is_wp_error($response)) { 222 http_response_code(400); 223 $error_message = $response->get_error_message(); 224 echo "Error: $error_message"; 225 } else { 226 header("Content-Type: application/json"); 227 echo $response['body']; 228 } 229 exit; 230 } 231 add_action('wp_ajax_pwgp-categories', PWGP_NAME . '_ajax_categories'); 232 233 // proxy thumbnails call from another server 234 function PiwigoPress_ajax_thumbnails() { 235 require_once('piwigopress_thumbnails_reloader.php'); 236 exit; 237 } 238 add_action('wp_ajax_pwgp-thumbnails', PWGP_NAME . '_ajax_thumbnails'); 199 239 200 240 function PiwigoPress_register_plugin() { … … 203 243 add_action('admin_head', PWGP_NAME . '_load_in_head'); 204 244 } 205 206 245 add_action('init', PWGP_NAME . '_register_plugin'); 207 246 … … 222 261 return $links; 223 262 } 224 225 add_filter( 'plugin_row_meta', PWGP_NAME . '_plugin_links', 10, 2 ); 263 add_filter( 'plugin_row_meta', PWGP_NAME . '_plugin_links', 10, 2 ); 264 226 265 # vim:set expandtab tabstop=2 shiftwidth=2 autoindent smartindent: # 227 ?> 266 -
piwigopress/trunk/piwigopress_admin.php
r1136944 r1141552 2 2 if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */ 3 3 if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */ 4 if (!defined('PWGP_VERSION')) define('PWGP_VERSION','2.2.8'); 5 if (!function_exists('pwg_get_contents')) include 'PiwigoPress_get.php'; 4 require_once('PiwigoPress_get.php'); 6 5 7 6 if(!class_exists('PiwigoPress_Admin')){ … … 206 205 207 206 # vim:set expandtab tabstop=2 shiftwidth=2 autoindent smartindent: # 208 ?> 207 -
piwigopress/trunk/readme.txt
r1136944 r1141552 3 3 Tags: galleries, pictures, randomize, shortcode, gallery, integration, photos, drag, drop, widget, media, piwigo 4 4 Requires at least: 2.8.4 5 Tested up to: 4. 1.16 Stable tag: 2.2 85 Tested up to: 4.2 6 Stable tag: 2.29 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 173 173 9. Expected result on your page or post of your Wordpress blog. 174 174 175 == Copyright/License == 176 177 PiwigoPress WordPress Plugin 178 179 Copyright 2009-2012 VDigital 180 Copyright 2014-2015 Norbert Preining 181 182 Contributions by 183 184 Rüdiger Schulz 2015 (copyright transfered) 185 186 PiwigoPress is distributed under the terms of the GNU GPL version 2+ 187 188 This program is free software: you can redistribute it and/or modify 189 it under the terms of the GNU General Public License as published by 190 the Free Software Foundation, either version 2 of the License, or 191 (at your option) any later version. 192 193 This program is distributed in the hope that it will be useful, 194 but WITHOUT ANY WARRANTY; without even the implied warranty of 195 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 196 GNU General Public License for more details. 197 198 You should have received a copy of the GNU General Public License 199 along with this program. If not, see if not, write to the Free Software 200 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 201 175 202 == Changelog == 203 204 = 2.29 = 205 * security related improvements by Rüdiger Schulz, big thanks! 176 206 177 207 = 2.28 =
Note: See TracChangeset
for help on using the changeset viewer.