Changeset 4216


Ignore:
Timestamp:
Nov 5, 2009, 11:15:41 PM (11 years ago)
Author:
vdigital
Message:

[PiwigoPress]

  • Alternate pwg_get_contents (cURL)
  • Generated \r\n in code
  • Readme FAQ
Location:
extensions/piwigopress
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/piwigopress/PiwigoPress_code.php

    r4125 r4216  
    6565                echo '<ul style="clear: both;"><li>' . __('Pictures categories','pwg') . '<ul>';
    6666                foreach ($cats["result"]["categories"] as $cat) {
    67                         echo '<li><a title="' . $cat['name'] . '" href="' . $piwigo_url . 'index.php?category/' . $cat['id'] . '">' . $cat['name'] . '</a></li>';
     67                        echo '<li><a title="' . $cat['name'] . '" href="' . $piwigo_url . 'index.php?category/' . $cat['id'] . '">' . $cat['name'] . '</a></li>'."\r\n";
    6868                }
    69                 echo '</ul></li></ul>';
     69                echo '</ul></li></ul>'."\r\n";
    7070        }
    7171}
     
    7676
    7777if ($most_visited == 'true')
    78         echo '<li><a title="' . __('Most visited','pwg') . '" href="' . $piwigo_url . 'index.php?most_visited' . '">' . __('Most visited','pwg') . '</a></li>';
     78        echo '<li><a title="' . __('Most visited','pwg') . '" href="' . $piwigo_url . 'index.php?most_visited' . '">' . __('Most visited','pwg') . '</a></li>'."\r\n";
    7979
    8080if ($best_rated == 'true')
    81         echo '<li><a title="' . __('Best rated','pwg') . '" href="' . $piwigo_url . 'index.php?best_rated' . '">' . __('Best rated','pwg') . '</a></li>';
     81        echo '<li><a title="' . __('Best rated','pwg') . '" href="' . $piwigo_url . 'index.php?best_rated' . '">' . __('Best rated','pwg') . '</a></li>'."\r\n";
    8282
    8383if ($most_commented == 'true')
    84         echo '<li><a title="' . __('Most commented','pwg') . '" href="' . $piwigo_url . 'index.php?most_commented' . '">' . __('Most commented','pwg') . '</a></li>';
     84        echo '<li><a title="' . __('Most commented','pwg') . '" href="' . $piwigo_url . 'index.php?most_commented' . '">' . __('Most commented','pwg') . '</a></li>'."\r\n";
    8585
    8686if ($random == 'true')
    87         echo '<li><a title="' . __('Random','pwg') . '" href="' . $piwigo_url . 'random.php' . '">' . __('Random','pwg') . '</a></li>';
     87        echo '<li><a title="' . __('Random','pwg') . '" href="' . $piwigo_url . 'random.php' . '">' . __('Random','pwg') . '</a></li>'."\r\n";
    8888
    8989if ($recent_pics == 'true')
    90         echo '<li><a title="' . __('Recent pics','pwg') . '" href="' . $piwigo_url . 'index.php?recent_pics' . '">' . __('Recent pics','pwg') . '</a></li>';
     90        echo '<li><a title="' . __('Recent pics','pwg') . '" href="' . $piwigo_url . 'index.php?recent_pics' . '">' . __('Recent pics','pwg') . '</a></li>'."\r\n";
    9191
    9292if ($calendar == 'true')
    93         echo '<li><a title="' . __('Calendar','pwg') . '" href="' . $piwigo_url . 'index.php?created-monthly-calendar' . '">' . __('Calendar','pwg') . '</a></li>';
     93        echo '<li><a title="' . __('Calendar','pwg') . '" href="' . $piwigo_url . 'index.php?created-monthly-calendar' . '">' . __('Calendar','pwg') . '</a></li>'."\r\n";
    9494
    9595if ($tags == 'true')
    96         echo '<li><a title="' . __('Tags','pwg') . '" href="' . $piwigo_url . 'tags.php' . '">' . __('Tags','pwg') . '</a></li>';
     96        echo '<li><a title="' . __('Tags','pwg') . '" href="' . $piwigo_url . 'tags.php' . '">' . __('Tags','pwg') . '</a></li>'."\r\n";
    9797
    9898if ($comments == 'true')
    99         echo '<li><a title="' . __('Comments','pwg') . '" href="' . $piwigo_url . 'comments.php' . '">' . __('Comments','pwg') . '</a></li>';
     99        echo '<li><a title="' . __('Comments','pwg') . '" href="' . $piwigo_url . 'comments.php' . '">' . __('Comments','pwg') . '</a></li>'."\r\n";
    100100
    101101
    102102if ($most_visited == 'true' or $best_rated == 'true' or
    103103    $most_commented == 'true' or $random == 'true' or $recent_pics == 'true' or
    104     $calendar == 'true' or $tags == 'true' or $comments == 'true') echo '</ul>';
     104    $calendar == 'true' or $tags == 'true' or $comments == 'true') echo '</ul>'."\r\n";
    105105
    106106echo $after_widget;
  • extensions/piwigopress/PiwigoPress_get.php

    r4125 r4216  
    1919        $pwg_prev_host = $host;
    2020        $mode = $pwg_mode;
    21         //$mode = 'ch'; // Forcing a test '' all, 'fs' fsockopen, 'ch' cURL
     21        // $mode = 'ch'; // Forcing a test '' all, 'fs' fsockopen, 'ch' cURL
    2222
    2323// 1 - The simplest solution: file_get_contents
     
    3434        }
    3535        if ( $mode == '' ) $mode = 'fs';
    36         if ( $pwg_mode == '' ) $pwg_mode = 'fs';
     36        if ( $pwg_mode == '' ) $pwg_mode = 'fs'; // Remind it
    3737// 2 - Often accepted access: fsockopen
    3838        if ($mode == 'fs') {
     
    5656                }
    5757        }
    58         $return["stat"] = 'failed';
    59         $pwg_mode = 'failed';
    60         return serialize($return);
    6158
    62 // Not active cURL right now
    63         if ( $pwg_mode == 'fs' ) $pwg_mode = 'ch';
     59        if ( $pwg_mode == 'fs' ) $pwg_mode = 'ch'; // Remind it
    6460// 3 - Sometime another solution: curl_exec
    6561// See http://fr2.php.net/manual/en/curl.installation.php
    6662  if (function_exists('curl_init') and $pwg_mode == 'ch') {
    6763                $ch = @curl_init();
     64                @curl_setopt($ch, CURLOPT_URL, $url);
     65                @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    6866                @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
    69                 @curl_setopt($ch, CURLOPT_URL, $url);
    7067                @curl_setopt($ch, CURLOPT_HEADER, 1);
    7168                @curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
     
    7673                $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
    7774                @curl_close($value);
    78                 if ($value !== false and $status >= 200 and $status < 400)
    79                                 $value = substr($value, $header_length);
     75                if ($value !== false and $status >= 200 and $status < 400) {
     76                        $value = substr($value, $header_length);
     77                        // echo '<br/>-ch- ('. $value . ') <br/>';
     78                        return $value;
     79                }
     80                else $pwg_mode = 'failed'; // Sorry but remind it as well
    8081        }
    8182
    8283        // No other solutions
    8384        $return["stat"] = 'failed';
    84         echo '<br/>- pwg_get_contents: failed on file_get, fsockopen and cURL processes<br/>';
    85         $pwg_mode = 'failed';
     85        // echo '<br/>- pwg_get_contents: failed on file_get, fsockopen and cURL processes<br/>';
    8686        return serialize($return);
    8787}
  • extensions/piwigopress/piwigopress.php

    r4125 r4216  
    7373                        register_widget('PiwigoPress');
    7474}
     75
     76// Add gallery pictures
     77function PiwigoPress_media_buttons() {
     78}
    7579add_action('widgets_init', PWGP_NAME . '_Init');
     80add_action('media_buttons', PWGP_NAME . '_media_buttons');
    7681?>
  • extensions/piwigopress/readme.txt

    r4129 r4216  
    6868== Frequently Asked Questions ==
    6969
    70 Currently, none.
     70No thumbnail are displayed.
     71Since (12) months and no public pictures since July 2005): Try 99 or 0 months!
     72Class CSS includes a display: none; Check your css!
     73Private Category instead of public; Check the selected category!
     74
     75Category (0) since (0) months and correct CSS class, then check:
     76- Locked Gallery
     77- Mandatory subscription
     78- All private categories
     79- All locked categories
     80- Picture privacy level (> 0 : must be 0 ---)
     81
     82
     83
     84Example of Class:
     85.img-shadow {
     86  float:left;
     87  background: url(images/shadowAlpha.png) no-repeat bottom right !important;
     88  background: url(images/shadow.gif) no-repeat bottom right;
     89  margin: 10px 0 0 10px !important;
     90  margin: 10px 0 0 5px;
     91  }
     92 
     93.img-shadow img {
     94  display: block;
     95  position: relative;
     96  background-color: #fff;
     97  border: 1px solid #a9a9a9;
     98  margin: -6px 6px 6px -6px;
     99  padding: 4px;
     100  }
     101       
     102        Will be included in future releases:
     103        http://www.vdigital.org/sharing/wp-content/themes/green-apples/images/shadowAlpha.png
     104        http://www.vdigital.org/sharing/wp-content/themes/green-apples/images/shadow.gif
    71105
    72106= A question that someone might have =
     
    81115
    82116== Changelog ==
     117
     118= 1.05 =
     119* Alternate pwg_get_contents (cURL)
    83120
    84121= 1.04 =
Note: See TracChangeset for help on using the changeset viewer.