Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: <sam2kb@us...> - 2012-03-05 01:37:50
|
Revision: 1238 http://evocms-plugins.svn.sourceforge.net/evocms-plugins/?rev=1238&view=rev Author: sam2kb Date: 2012-03-05 01:37:36 +0000 (Mon, 05 Mar 2012) Log Message: ----------- Added Paths: ----------- avatars_plugin/branches/2.2.7/Changelog.txt avatars_plugin/branches/2.2.7/Readme.html avatars_plugin/branches/2.2.7/_admin_area.php avatars_plugin/branches/2.2.7/_avatars.plugin.php avatars_plugin/branches/2.2.7/_profile_area.php avatars_plugin/branches/2.2.7/includes/ avatars_plugin/branches/2.2.7/includes/basic.css avatars_plugin/branches/2.2.7/includes/default.jpg avatars_plugin/branches/2.2.7/includes/jquerylightbox/ avatars_plugin/branches/2.2.7/includes/jquerylightbox/css/ avatars_plugin/branches/2.2.7/includes/jquerylightbox/css/jquery.lightbox-0.5.css avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/ avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-blank.gif avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-close.gif avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-next.gif avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-prev.gif avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-ico-loading.gif avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/ avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.js avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.pack.js avatars_plugin/branches/2.2.7/installation/ avatars_plugin/branches/2.2.7/installation/demo_skin.zip avatars_plugin/branches/2.2.7/installation/hack1.txt avatars_plugin/branches/2.2.7/installation/hack2.txt avatars_plugin/branches/2.2.7/installation/hack3.txt avatars_plugin/branches/2.2.7/installation/hack4.txt avatars_plugin/branches/2.2.7/installation/hack5.txt avatars_plugin/branches/2.2.7/installation/install_b2evo-2.4.5.zip avatars_plugin/branches/2.2.7/installation/installation.txt avatars_plugin/branches/2.2.7/locales/ avatars_plugin/branches/2.2.7/locales/messages.pot avatars_plugin/branches/2.2.7/locales/ru_RU/ avatars_plugin/branches/2.2.7/locales/ru_RU/LC_MESSAGES/ avatars_plugin/branches/2.2.7/locales/ru_RU/LC_MESSAGES/messages.po avatars_plugin/branches/2.2.7/locales/ru_RU/_global.php avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/ avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/LC_MESSAGES/ avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/LC_MESSAGES/messages.po avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/_global.php avatars_plugin/branches/2.2.7/resources/ avatars_plugin/branches/2.2.7/resources/functions/ avatars_plugin/branches/2.2.7/resources/functions/.image.funcs.test.php avatars_plugin/branches/2.2.7/resources/functions/_files.funcs.php avatars_plugin/branches/2.2.7/resources/functions/_general.funcs.php avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.php avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.txt avatars_plugin/branches/2.2.7/resources/functions/_scan_dir.funcs.php avatars_plugin/branches/2.2.7/resources/readme.txt Added: avatars_plugin/branches/2.2.7/Changelog.txt =================================================================== --- avatars_plugin/branches/2.2.7/Changelog.txt (rev 0) +++ avatars_plugin/branches/2.2.7/Changelog.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,142 @@ +==================================================== +/** + * B2evolution Avatars Plugin + * + * The Avatars Plugin allows you to attach avatars (display pictures, gravatars, profile pics, etc) to a user, blog, post and category. + * You upload avatars within the b2evo adminstration, with either a large or small (or both) avatar images. + * If a large avatar image is specified then lightbox functionality is seen, as when the user clicks the small avatar, the large avatar will show in a lightbox. + * It makes use of the GD2 Image and the Gallery Plugin’s Libraries allowing for images to be resized and compressed to specified values. + * + * @name B2evolution Avatars Plugin: _avatars.plugin.php + * @version 2.2.7 + * @package plugins + * + * {@internal Below is a list of authors who have contributed to design/coding of this plugin: } + * @author balupton: Benjamin Lupton - {@link http://www.balupton.com} + * @author sam2kb: Russian b2evolution - {@link http://ru.b2evo.net/} + * + * Built on code originally released by balupton: Benjamin LUPTON - {@link http://www.balupton.com/} + * @copyright (c) 2006-2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @copyright (c) 2008 Russian b2evolution - {@link http://ru.b2evo.net/} + * + * @license GNU General Public License 2 (GPL) - {@link http://www.opensource.org/licenses/gpl-license.php} + */ +==================================================== + + RELEASE NOTES: + + Required b2evolution v2.4.0 and up + + Website: + http://forums.b2evolution.net/viewtopic.php?t=15641 + +==================================================== + + Changelog: + v2.2.7 - 24/11/2008 + * Fixed compatibility issues with jQuery plugins + * Added demo summary.php with blog avatars + + v2.2.6 - 19/10/2008 + * Fixed: large avatars displayed in lightbox group. + + v2.2.5 - 13/10/2008 + * Plugin switched to standard Lightbox libraries + * Lightbox works in backoffice + * Fixed compatibility issues with jQuery Lightbox plugin + * Improved and simplified skin tags + + v2.2.0 - 29/07/2008 + * New: Guests avatars (currently Gravatars only, but it's very easy to add any other type) + * New: The Plugin installer checks if avatars directories were properly created (finally) + * Many minor bug fixes and improvements, code cleanup + + v2.1.0 - 27/06/2008 + * New: Post avatars + * New: Custom image size for each avatar type (user, blog, category, post) + * New: Collapsible admin avatars fieldset + * Fixed: User profile layout bug with avatars fieldset + + v2.0.1 - 02/06/2008 + * Fixed: Error when checking permissions of non-existing group + * Fixed: Strange error, thanks to ¥åßßå + + v2.0.0 - 24/05/2008 + * Upgraded to support b2evo 2.x versions + * Translation support + * New: Upload user avatars from user profile (frontend) + * New: Restrict by user group + * New: Restrict by user level + * New: Maximum allowed file size + * New: Custom JPEG image quality for small and large avatars + * New: Custom avatars folder location + * Fixed: Error with .png images in PHP5.2 and up (wrong compression level) + * Fixed: Image extension was not lowercased and caused "File not found" errors + * Fixed: Default avatar image deleted automatically together with the small avatar + * Fixed: Image path for "close" icon when the large avatar is displayed + * Fixed: Small avatar image height was hard-coded in CSS + * Note: The following features are not supported/upgraded yet (Post avatars, Crop and Exact image resize modes) + + +==================================================== +b2evo 1.x versions + + v1.1.0.0-beta - 02/12/2007 @ 10:37 (GMT+08:00) + * Uses the newest resource library + * Now supports all supportable types of images + * Uses jQuery v1.2 (Older versions uses prototype and scriptaculous) + * This fixes all the wierd bugs, like the page not displaying, or buttons not working + * Uses jQuery Lightbox Plugin (v0.2.1-beta) + * Now there is a option on uninstall if you want to keep the avatars + * Support / Credit-Link now obeys the setting + * Now actually supports IE... Can't believe it didn't support it before! + ^ Note: A special thanks needs to go out to Sue Kendrick (http://www.suekendrick.co.uk) from (http://writelink.co.uk) for sponsoring this release. + + v1.0.2.0-beta - 10/08/2007 @ 03:07 (GMT+08:00) + * Updated the get_avatar function, now returns $avatar['exists'] and $avatar['skin'] and $avatar['avatar'] (which is always true) + * Updated get_avatar_display to + function get_avatar_display ( $avatar, $style = '', $before = '', $after = '', $none = '' ) + * Fixed admin avatar displays when 'Display Default Avatar' is disabled + * Updated skin.txt to reflect latest changes + + v1.0.1.0-beta - 30/07/2007 @ 22:00 (GMT+08:00) + * Re-packaged with correct _images.funcs.php file + * Stops gallery plugin conflicts even with gallery plugin v1.2.5.2-final + * Added new setting "Display Default Avatar" if this is unchecked then NULL will be returned when no avatar is present in get_avatar + * If a defualt avatar was returned with get_avatar, avatar['name'] is now 'default' + + v1.0.0.0-beta - 15/07/2007 @ 19:59 (GMT+08:00) + * Nearly complete re-write, so it finally completes my dream of what the avatars plugin should be! + * Removed customizability of avatar_types (no one used it, and no one cares) + * Added ability to upload avatars within b2evolution + * Hacked up administration so avatars are displayed for post and user browsing + * Avatars include the small image, and a optional large image + * Large and Small images have customizable sizes and resize modes + * Large avatars include lightbox functionality! + * Built from my Sample Renderer Plugin and some parts of my Gallery Plugin + + v0.3.0.0 - 13/11/2006 @ 23:10 (GMT+08:00) + * Fixed the 'Fixed' incompatabilities with the gallery plugin + * Changed 'no_image' to 'no_avatar' + * Made it so it would detect the extension of no_avatar and use it appropriatly + * Made it so if no 'no_avatar' image exists, get_avatar returns NULL + - This is cause for extra handling of the get_avatar call (See new Usage->Part 1->1) + + v0.2.1.0 - 13/11/2006 @ 23:10 (GMT+08:00) + * 'Fixed' incompatabilities with the gallery plugin + + v0.2.0.0 - 02/11/2006 @ 00:55 (GMT+08:00) + * Fixed installation problems + * Removed delete avatars' media directory on exit + * Added the function $Avatars->get_type_links() + which can be used for the user to change their avatar types if they can. + + v0.1.0.0 - 08/09/2006 @ 00:22 (GMT+08:00); + * Ported over lightality's avatar class into a plugin + +==================================================== + + INSTALLATION; + + Refer to installation/installation.txt + \ No newline at end of file Added: avatars_plugin/branches/2.2.7/Readme.html =================================================================== --- avatars_plugin/branches/2.2.7/Readme.html (rev 0) +++ avatars_plugin/branches/2.2.7/Readme.html 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,91 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Avatars Plugin usage</title> +<style type="text/css"> +body { font-size:90% } +h2 { font-size:130% } +h4 { font-size:120%; margin:25px 0 5px 0; padding:0 } +h5 { font-size:80%; margin:0; padding:0 } +.code { padding:10px; font-family: Courier, 'Courier New', sans-serif; font-size: 80%; color: #006600; background-color: #e6e6e6; border: #D1D7DC solid 2px; overflow:auto; white-space:nowrap } +.style1 {color: #660099} +</style> +</head> +<body> +<h1>Avatars plugin v2.2.7</h1> + +<h4>THE DEFAULT METHOD</h4> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">function</span><span style="color: rgb(0, 0, 187);"> display_avatar</span><span style="color: rgb(0, 119, 0);">( array(<br /> + <span style="color: rgb(221, 0, 0);">'type' </span>=> <span style="color: rgb(221, 0, 0);">'user'</span>, <span style="color: rgb(255, 153, 0);">// Avatar type.</span><br /> + </span><span style="color: rgb(221, 0, 0);">'id' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">''</span><span style="color: rgb(0, 119, 0);">, <span style="color: rgb(255, 153, 0);">// Optional ID. Example: 'id' => 3,<br /> + // to display avatar of user/post/category/blog #3</span><br /> + </span><span style="color: rgb(221, 0, 0);">'before' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'<div>'</span><span style="color: rgb(0, 119, 0);">, <span style="color: rgb(255, 153, 0);">// Before image block.</span><br /> + </span><span style="color: rgb(221, 0, 0);">'after' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'</div>'</span><span style="color: rgb(0, 119, 0);">, <span style="color: rgb(255, 153, 0);">// After image block.</span><br /> + </span><span style="color: rgb(221, 0, 0);">'style' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">''</span><span style="color: rgb(0, 119, 0);">, <span style="color: rgb(255, 153, 0);">// Image style e.g. margin:5px.</span><br /> + ));</span></span></blockquote> +<p>So to use that look below</p> + +<h4>To include the CURRENT USER avatar use:</h4> +<h5>Put this code in any place</h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);"> if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> + {<br /> + </span><span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">display_avatar</span><span style="color: rgb(0, 119, 0);">( array(<br /> + </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'user'</span><span style="color: rgb(0, 119, 0);">,<br /> + ));<br /> + }</span></span></blockquote> + +<h4>To include the POST AUTHOR avatar use:</h4> +<h5>Put this code in posts loop, usually in <span class="style1">index.main.php</span> or <span class="style1">posts.main.php</span> or <span class="style1">single.main.php</span></h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> +{<br /> + <span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>-><span style="color: rgb(0, 0, 187);">display_avatar</span>( array(<br /> + </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'post_author'</span><span style="color: rgb(0, 119, 0);">,<br /> + ));<br /> + }</span></span></blockquote> + + +<h4>To include the COMMENT AUTHOR avatar use:</h4> +<h5>Put this code in comments loop, usually in <span class="style1">_item_comment.inc.php</span></h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> +{<br /> + <span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>-><span style="color: rgb(0, 0, 187);">display_avatar</span>( array(<br /> + <span style="color: rgb(221, 0, 0);">'type' </span>=> <span style="color: rgb(221, 0, 0);">'comment_author'</span>,<br /> + </span><span style="color: rgb(221, 0, 0);">'comment' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">$Comment</span><span style="color: rgb(0, 119, 0);">,<br /> ));<br /> + <br /> + </span><span style="color: rgb(255, 153, 0);">// You can add optional paramethers to control gravatars and other visitor avatar types<br /> + // Example:<br /> + // 'default' => 'http://img_url.jpg',<br /> + // 'size' => '',<br /> + // 'rating' => '',<br /> +</span><span style="color: rgb(0, 119, 0);">}</span></span></blockquote> + +<h4>To include the POST avatar use:</h4> +<h5>Put this code in posts loop, usually in <span class="style1">index.main.php</span> or <span class="style1">posts.main.php</span> or <span class="style1">single.main.php</span></h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> +{<br /> + <span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>-><span style="color: rgb(0, 0, 187);">display_avatar</span>( array(<br /> + </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'post'</span><span style="color: rgb(0, 119, 0);">,<br /> + ));<br /> + }</span></span></blockquote> + +<h4>To include the CATEGORY avatar of the current post use:</h4> +<h5>Put this code in posts loop, usually in <span class="style1">index.main.php</span> or <span class="style1">posts.main.php</span> or <span class="style1">single.main.php</span></h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> +{<br /> + <span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>-><span style="color: rgb(0, 0, 187);">display_avatar</span>( array(<br /> + </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'category'</span><span style="color: rgb(0, 119, 0);">,<br /> + ));<br /> + }</span></span></blockquote> + +<h4>To include the BLOG avatar use:</h4> +<h5>Put this code in any place</h5> +<blockquote class="code"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">if ( isset(<span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>) )<br /> +{<br /> + <span style="color: rgb(0, 0, 187);">$GLOBALS[<span style="color: rgb(221, 0, 0);">'avatars_Plugin'</span>]</span>-><span style="color: rgb(0, 0, 187);">display_avatar</span>( array(<br /> + </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'blog'</span><span style="color: rgb(0, 119, 0);">,<br /> + ));<br /> + }</span></span></blockquote> + +</body> +</html> Added: avatars_plugin/branches/2.2.7/_admin_area.php =================================================================== --- avatars_plugin/branches/2.2.7/_admin_area.php (rev 0) +++ avatars_plugin/branches/2.2.7/_admin_area.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,117 @@ +<?php +/** + * B2evolution Avatars Plugin + * + * The Avatars Plugin allows you to attach avatars (display pictures, gravatars, profile pics, etc) to a user, blog, post and category. + * You upload avatars within the b2evo adminstration, with either a large or small (or both) avatar images. + * If a large avatar image is specified then lightbox functionality is seen, as when the user clicks the small avatar, the large avatar will show in a lightbox. + * It makes use of the GD2 Image and the Gallery Plugin\x92s Libraries allowing for images to be resized and compressed to specified values. + * + * @name B2evolution Avatars Plugin: _avatars.plugin.php + * @version 2.2.7 + * @package plugins + * + * {@internal Below is a list of authors who have contributed to design/coding of this file: } + * @author sam2kb: Russian b2evolution - {@link http://ru.b2evo.net/} + * @author balupton: Benjamin Lupton - {@link http://www.balupton.com} + * + * Built on code originally released by balupton: Benjamin LUPTON - {@link http://www.balupton.com/} + * @copyright (c) 2006-2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @copyright (c) 2008 by Russian b2evolution - {@link http://ru.b2evo.net/} + * + * @license GNU General Public License 2 (GPL) - {@link http://www.opensource.org/licenses/gpl-license.php} + */ + +global $baseurl; +?> + +<div id="<?php echo $this->code; ?>_area"> + <div class="fieldset_title"> + <div class="fieldset_title_right"> + <div class="fieldset_title_bg" onclick="toggle_clickopen('avatars')"><?php echo $this->T_('Avatars').' <img src="'.$baseurl.'/rsc/icons/expand.gif" align="bottom" id="clickimg_avatars" />'; ?></div> + </div> + </div> + <fieldset> + <div style="padding-top:10px; clear:both" id="clickdiv_avatars"> + + <div class="label"> + <input type="hidden" name="avatar_runonce" value="true" /> + <input type="hidden" name="avatar_name" value="<?php echo $avatar_name ?>" /> + <input type="hidden" name="avatar_type" value="<?php echo $avatar_type ?>" /> + <?php + $avatar = $this->get_avatar($avatar_type, $avatar_name, 'default'); + if( $avatar_type == 'post' ) + { + echo $this->get_avatar_display($avatar, 'float:left; display:block; margin:0 25px 5px 5px'); + } + else + { + echo $this->get_avatar_display($avatar, 'float:right; display:block; margin:0 5px 5px 5px'); + } + ?> + </div> + + <div> + <div style="float:left; padding-left:10px; margin:0 25px 0 0"> + <?php + $large_width = $this->Settings->get( 'avatar_'.$avatar_type.'_large_width' ); + $large_height = $this->Settings->get( 'avatar_'.$avatar_type.'_large_height' ); + echo $this->T_('Large Avatar'); + if ( !($large_width === $large_height && $large_height === 0) ) + echo ' <span class="notes">('.$this->T_('Up to').' '.$large_width.'x'.$large_height.').</span>'; + ?><br /><input name="avatar_large_file" id="avatar_large_file" type="file" /> + + <label for="avatar_large_delete" style="display:block; margin:3px 0 0 0; padding:0"> + <input type="checkbox" name="avatar_large_delete" id="avatar_large_delete" /> <?php echo $this->T_('Remove Large Avatar') ?> + </label> + </div> + + <div style="float:left; margin:0; padding:0"> + <?php + $small_width = $this->Settings->get( 'avatar_'.$avatar_type.'_small_width' ); + $small_height = $this->Settings->get( 'avatar_'.$avatar_type.'_small_height' ); + echo $this->T_('Small Avatar'); + if ( !($small_width === $small_height && $small_height === 0) ) + echo ' <span class="notes">('.$this->T_('Up to').' '.$small_width.'x'.$small_height.').</span>'; + ?><br /><input name="avatar_small_file" id="avatar_small_file" type="file" /> + + <label for="avatar_small_delete" style="display:block; margin:3px 0 0 0; padding:0"> + <input type="checkbox" name="avatar_small_delete" id="avatar_small_delete" /> <?php echo $this->T_('Remove Small Avatar') ?> + </label> + </div> + </div> + + <div style="padding-bottom:5px; clear:both"></div> + + </div> + </fieldset> +</div> +<script type="text/javascript"> +//<![CDATA[ +<?php if( $this->Settings->get('area_collapse') ) { echo 'toggle_clickopen(\'avatars\');'; } ?> + +jQuery(document).ready(function() +{ // Let's do our stuff + jQuery('form.fform').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data'); // encoding is for IE, IE is sure wierd + + <?php + if( $admin_area === 'user' ) + { // Remove fieldset that contains the hack setting ?> + jQuery('form.fform > fieldset:has(#edit_plugin_<?php echo $this->ID; ?>_set_user_settings_hack)').remove(); + <?php + } + + if( $admin_area === 'post' ) + { + ?> + jQuery('form#item_checkchanges').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data'); + <?php + } + else + { ?> + jQuery('div#evo_avatars_area').insertBefore('form.fform > fieldset:has(input.SaveButton)'); + <?php + } ?> +}); +//]]> +</script> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/_avatars.plugin.php =================================================================== --- avatars_plugin/branches/2.2.7/_avatars.plugin.php (rev 0) +++ avatars_plugin/branches/2.2.7/_avatars.plugin.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,2340 @@ +<?php +/** + * B2evolution Avatars Plugin + * + * The Avatars Plugin allows you to attach avatars (display pictures, gravatars, profile pics, etc) to a user, blog, post and category. + * You upload avatars within the b2evo adminstration, with either a large or small (or both) avatar images. + * If a large avatar image is specified then lightbox functionality is seen, as when the user clicks the small avatar, the large avatar will show in a lightbox. + * It makes use of the GD2 Image and the Gallery Plugin\x92s Libraries allowing for images to be resized and compressed to specified values. + * + * @name B2evolution Avatars Plugin: _avatars.plugin.php + * @version 2.2.7 + * @package plugins + * + * {@internal Below is a list of authors who have contributed to design/coding of this file: } + * @author balupton: Benjamin Lupton - {@link http://www.balupton.com} + * @author sam2kb: Russian b2evolution - {@link http://ru.b2evo.net/} + * + * Built on code originally released by balupton: Benjamin LUPTON - {@link http://www.balupton.com/} + * @copyright (c) 2006-2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @copyright (c) 2008 by Russian b2evolution - {@link http://ru.b2evo.net/} + * + * @license GNU General Public License 2 (GPL) - {@link http://www.opensource.org/licenses/gpl-license.php} + */ + + +// Load the resources +$dir = dirname(__file__).'/resources/'; +require_once($dir.'functions/_scan_dir.funcs.php'); +scan_dir( $dir, 'inc_php', 'require_once($path);' ); + +// Define our class +class avatars_Plugin extends Plugin +{ + /** + * Variables below MUST be overriden by plugin implementations, + * either in the subclass declaration or in the subclass constructor. + */ + var $name = 'Avatars'; + var $code = 'evo_avatars'; + var $priority = 60; + var $version = '2.2.7'; + var $group = 'ru.b2evo.net'; + var $author = 'balupton, sam2kb'; + var $author_url = 'http://ru.b2evo.net/';; + var $help_url = 'http://forums.b2evolution.net/viewtopic.php?p=75770';; + + var $apply_rendering = 'lazy'; + var $number_of_installs = 1; + + + /** + * install_dir - directory containig avatars folder. + * Must be created before installing the plugin. + * e.g. /www/htdocs/blog/[ $install_dir ]avatars/ + */ + var $install_dir = 'media/'; + + var $media_url; + var $media_path; + + var $avatars_dir = 'avatars/'; + var $avatars_url; + var $avatars_path; + + var $temp_folder; + + // + var $avatars = NULL; + + var $avatar_types_size = 4; + var $avatar_types = array( 'user', 'blog', 'category', 'post' ); + + var $image_types_size = 1; + var $image_types = array( 'gif', 'jpeg', 'jpg', 'png' ); + + var $do_form_request_ran = false; + var $admin_avatars = NULL; + var $lightbox_plugin = false; + + + function PluginInit( & $params ) + { + global $Plugins, $Messages, $baseurl, $admin_url, $basepath, $IMAGE_EXTENSIONS; + + define_image_vars(); + $this->image_types = $IMAGE_EXTENSIONS; + $this->image_types_size = sizeof($this->image_types); + + $this->short_desc = $this->T_('Let\'s you \'easily\' add avatars/icons to various things.'); + $this->long_desc = $this->T_('Let\'s you \'easily\' add avatars/icons to ').implode(', ',$this->avatar_types).'.'; + + $this->media_url = $baseurl.'media/'; + $this->media_path = $basepath.'media/'; + + // Install in custom dir + $this->avatars_url = $baseurl.$this->install_dir.$this->avatars_dir; + $this->avatars_path = $basepath.$this->install_dir.$this->avatars_dir; + + $this->temp_folder = $this->avatars_path.'_temp/'; + + if( ($jqplug = & $Plugins->get_by_code('ADjQLightbox')) !== false ) + { + $choose_lightbox = $jqplug->Settings->get('choose_lightbox'); + if( $jqplug->status == 'enabled' && !empty($choose_lightbox) ) + { + if( $choose_lightbox == 'standard' ) + { // We're going to use lightbox plugin's libraries + $this->lightbox_plugin = 'standard'; + } + else + { // We can't use lightbox plugin's libraries and we can't include ours, + // Display the error + $this->lightbox_plugin = NULL; + + if( !defined('JQUERYPLUGIN_ERROR') ) + { + define('JQUERYPLUGIN_ERROR', true); + $url = $admin_url.'?ctrl=plugins&action=edit_settings&plugin_ID='.$jqplug->ID; + $Messages->head = 'Avatars plugin'; + $Messages->add( sprintf( $this->T_('In order to display large avatars in lightbox you should select the "standard" lightbox version in %s!'), '<b><a href="'.$url.'">jQuery Lightbox plugin</a></b>'), 'error' ); + } + } + } + } + } + + # ============================================================================= + # PLUGIN SETTINGS + + /** + * Define here default settings that are then available in the backoffice. + * + * You can access them in the plugin through the member object + * {@link Plugin::Settings}, e.g.: + * <code>$this->Settings->get( 'my_param' );</code> + * + * You probably don't need to set or change values (other than the + * defaultvalues), but if you know what you're doing, see + * {@link PluginSettings}, where {@link Plugin::Settings} gets derived from. + * + * NOTE: this method gets called by b2evo when instantiating the plugin + * settings and when the settings get displayed for editing in the backoffice. + * In the second case, $params['for_editing'] will be true. + * + * @param array Associative array of parameters (since 1.9). + * 'for_editing': true, if the settings get queried for editing; + * false, if they get queried for instantiating {@link Plugin::Settings}. + * @return array + * The array to be returned should define the names of the settings as keys (max length is 30 chars) + * and assign an array with the following keys to them (only 'label' is required): + * + */ + + function has_gd2 ( ) + { + return function_exists('imagejpeg'); + } + + function GetDefaultSettings( & $params ) + { + $has_gd2 = $this->has_gd2(); + + $large_min = 10; + $large_max = 1024; + $large_default = 400; + + $small_min = 10; + $small_max = 300; + $small_default = 60; + + $r = array( + // ============================================== + // Plugin settings + + 'avatar_group_ids' => array( + 'label' => $this->T_('User Groups'), + 'note' => '<br />'.$this->T_('Disable avatars for these user groups. Separate by ,'), + 'type' => 'text', + 'defaultvalue' => 'Basic Users, Bloggers', + 'maxlength' => 130, + 'size' => 75, + ), + + 'avatar_user_level' => array( + 'label' => $this->T_('Minimum User level'), + 'type' => 'integer', + 'note' => '[ 0 - 11 ]<br />[ 0 ] - '.$this->T_('Enable for all users.').'<br />[ 11 ] - '.$this->T_('Disable for all users.'), + 'defaultvalue' => '0', + 'size' => 2, + 'maxlength' => 2, + 'valid_range' => array( 'min' => 0, 'max' => 11 ), + ), + + 'avatar_filesize' => array( + 'label' => $this->T_('Maximum file size'), + 'type' => 'integer', + 'note' => $this->T_('KB').'.<br />[ 10 - 5000 ]', + 'defaultvalue' => '500', + 'size' => 4, + 'maxlength' => 4, + 'valid_range' => array( 'min' => 10, 'max' => 5000 ), + ), + + 'display_default_avatar' => array( + 'label' => $this->T_('Display default avatar'), + 'defaultvalue' => '1', + 'type' => 'checkbox', + 'note' => $this->T_('Should the default avatar be displayed if no avatar exists?'), + ), + + 'use_gd2' => array( + 'label' => $this->T_('Use image resizing'), + 'disabled' => !$has_gd2, + 'defaultvalue' => '1', + 'type' => 'checkbox', + 'note' => $this->T_('Should we use image resizing?'), + ), + + 'area_collapse' => array( + 'label' => $this->T_('Collapsed avatars area'), + 'defaultvalue' => 0, + 'type' => 'checkbox', + 'note' => $this->T_('Should we display the admin avatars upload area collapsed?'), + ), + + 'display_next' => array( + 'label' => $this->T_('Display next avatar'), + 'defaultvalue' => 0, + 'type' => 'checkbox', + 'note' => $this->T_('If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar.'), + ), + + 'display_next_default' => array( + 'label' => $this->T_('Display next default image'), + 'defaultvalue' => 0, + 'type' => 'checkbox', + 'note' => $this->T_('If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>.'), + ), + + 'plugin_end' => array( + 'layout' => 'end_fieldset', + ), + + // ============================================== + // Image settings + + 'image_start' => array( + 'layout' => 'begin_fieldset', + 'label' => $this->T_('Image settings'), + ), + + 'avatar_large_quality' => array( + 'label' => $this->T_('Large avatar JPEG quality'), + 'type' => 'integer', + 'note' => '%.', + 'defaultvalue' => '85', + 'size' => 2, + 'maxlength' => 2, + 'valid_range' => array( 'min' => 5, 'max' => 99 ), + ), + + 'avatar_large_mode' => array( + 'label' => $this->T_('Large avatar image re-size mode'), + 'disabled' => !$has_gd2, + 'type' => 'select', + 'defaultvalue' => 'area', + 'options' => array( + 'none' => $this->T_('None'), + 'area' => $this->T_('Area'), + //'exact' => $this->T_('Exact'), + //'crop' => $this->T_('Crop') + ), + 'note' => + '<br/>'. + '[ '.$this->T_('None'). ' ] - '.$this->T_('No Resizing Occurs').'.<br/>'. + '[ '.$this->T_('Area'). ' ] - '.$this->T_('Image is resized proportionally to fit within the given area').'.<br/>' + //'[ '.$this->T_('Exact').' - '.$this->T_('Image is resized to fit the given values exactly').' ]<br/>'. + //'[ '.$this->T_('Crop').' - '.$this->T_('The Image will be cropped to fit into the given area.').' ]' + ), + + 'avatar_small_quality' => array( + 'label' => $this->T_('Small avatar JPEG quality'), + 'type' => 'integer', + 'note' => $this->T_('%').'.', + 'defaultvalue' => '95', + 'size' => 2, + 'maxlength' => 2, + 'valid_range' => array( 'min' => 5, 'max' => 99 ), + ), + + 'avatar_small_mode' => array( + 'label' => $this->T_('Small avatar image re-size mode'), + 'disabled' => !$has_gd2, + 'type' => 'select', + 'defaultvalue' => 'area', + 'options' => array( + 'none' => $this->T_('None'), + 'area' => $this->T_('Area') + //'exact' => $this->T_('Exact'), + //'crop' => $this->T_('Crop') + ), + 'note' => + '<br/>'. + '[ '.$this->T_('None'). ' ] - '.$this->T_('No Resizing Occurs').'.<br/>'. + '[ '.$this->T_('Area'). ' ] - '.$this->T_('Image is resized proportionally to fit within the given area').'.<br/>' + //'[ '.$this->T_('Exact').' - '.$this->T_('Image is resized to fit the given values exactly').' ]<br/>'. + //'[ '.$this->T_('Crop').' - '.$this->T_('The Image will be cropped to fit into the given area.').' ]' + ), + + 'image_end' => array( + 'layout' => 'end_fieldset', + ), + + // ============================================== + // Sizes + + 'sizes_start' => array( + 'layout' => 'begin_fieldset', + 'label' => $this->T_('Avatar sizes (Optional)'), + ), + + 'large_start' => array( + 'layout' => 'begin_fieldset', + 'label' => $this->T_('Large avatars'), + ), + + 'avatar_user_large_width' => array( + 'label' => $this->T_('User avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_user_large_height' => array( + 'label' => $this->T_('User avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_blog_large_width' => array( + 'label' => $this->T_('Blog avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_blog_large_height' => array( + 'label' => $this->T_('Blog avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_category_large_width' => array( + 'label' => $this->T_('Category avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_category_large_height' => array( + 'label' => $this->T_('Category avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_post_large_width' => array( + 'label' => $this->T_('Post avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'avatar_post_large_height' => array( + 'label' => $this->T_('Post avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$large_min.' - '.$large_max.' ]', + 'defaultvalue' => $large_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $large_min, 'max' => $large_max ), + ), + + 'large_end' => array( + 'layout' => 'end_fieldset', + ), + + 'small_start' => array( + 'layout' => 'begin_fieldset', + 'label' => $this->T_('Small avatars'), + ), + + 'avatar_user_small_width' => array( + 'label' => $this->T_('User avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_user_small_height' => array( + 'label' => $this->T_('User avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_blog_small_width' => array( + 'label' => $this->T_('Blog avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_blog_small_height' => array( + 'label' => $this->T_('Blog avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_category_small_width' => array( + 'label' => $this->T_('Category avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_category_small_height' => array( + 'label' => $this->T_('Category avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_post_small_width' => array( + 'label' => $this->T_('Post avatar width'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'avatar_post_small_height' => array( + 'label' => $this->T_('Post avatar height'), + 'disabled' => !$has_gd2, + 'type' => 'integer', + 'note' => $this->T_('Pixels').'. [ '.$small_min.' - '.$small_max.' ]', + 'defaultvalue' => $small_default, + 'size' => 3, + 'maxlength' => 4, + 'valid_range' => array( 'min' => $small_min, 'max' => $small_max ), + ), + + 'small_end' => array( + 'layout' => 'end_fieldset', + ), + + 'sizes_end' => array( + 'layout' => 'end_fieldset', + ), + + ); + + return $r; + } + +// ========================================================================== + + function install() + { + global $Messages; + + $r = mkdir_r( $this->temp_folder ); + $r = mkdir_r( $this->avatars_path.'default/' ); + $r = mkdir_r( $this->avatars_path.'default/blog/' ); + $r = mkdir_r( $this->avatars_path.'default/category/' ); + $r = mkdir_r( $this->avatars_path.'default/post/' ); + $r = mkdir_r( $this->avatars_path.'default/user/' ); + + if( !$r ) + { + $dir_list = '<br />'.$this->temp_folder.'<br />'. + $this->avatars_path.'default/<br />'. + $this->avatars_path.'default/blog/<br />'. + $this->avatars_path.'default/category/<br />'. + $this->avatars_path.'default/post/<br />'. + $this->avatars_path.'default/user/'; + + $Messages->add( sprintf( $this->T_('You must create the following directories with write permissions (777):%s'), $dir_list), 'error' ); + } + + if( !is_file($this->avatars_path.'default/default.jpg') ) + { + if( ! @copy( dirname(__FILE__).'/includes/default.jpg', $this->avatars_path.'default/default.jpg' ) ) + { + $Messages->add( sprintf( $this->T_('You must copy the file default.jpg from "avatars_plugin/includes/" to %s'), + $this->avatars_path.'default/' ), 'error' ); + } + } + return true; + } + + function uninstall() + { + rmdir_r( $this->avatars_path ); + return !is_dir( $this->avatars_path ); + } + + function check_user_perms() + { + global $current_User, $GroupCache; + // Check user perms + if( !is_logged_in() || ( is_object($this->Settings) && ($current_User->get('level') < $this->Settings->get('avatar_user_level')) ) ) + { return NULL; } + + if( is_object($GroupCache) && is_object($this->Settings) && $this->Settings->get('avatar_group_ids') ) + { + $avatar_group_ids = explode( ',' , $this->Settings->get('avatar_group_ids') ); + + foreach ( $avatar_group_ids as $avatar_group_id ) + { + if( trim($avatar_group_id) ) + { + $Group = & $GroupCache->get_by_name( trim($avatar_group_id), false, false ); + + if( is_object($Group) && $current_User->get('group_ID') == $Group->ID ) + { return NULL; } + } + } + } + + return true; + } + +// ========================================================================== + + function get_avatars() + { // Scan $this->avatars_path for avatars + + // Get the avatars_path contents, including everything + $avatars = scan_dir( $this->avatars_path, '/^([\\/\\\\\\w \\.])+?\.('.implode('|', $this->image_types).')/', NULL, NULL, 'tree2' ); + // var_export($avatars, false); + return $avatars; + } + + function get_avatar_display( $avatar, $style = NULL, $before = NULL, $after = NULL, $none = NULL ) + { + if( is_array($avatar) && !empty($avatar['avatar']) ) + { /* we have avatar */ } + elseif( !empty($avatar) ) + { // Get avatar + $avatar = $this->get_avatar($avatar); + } + + if( empty($avatar) ) + return $none; + + $height = NULL; + $width = NULL; + + $result = $before; + + if( !empty($avatar['lightbox']) ) + { + $result .= '<a href="'.$avatar['large_url'].'" title="'.$avatar['title'].'" class="lightbox_avatar" target="_blank">'; + } + + if( !empty($style) ) + $style = 'style="'.$style.'" '; + + if( !empty($avatar['width']) ) + $width = 'width="'.$avatar['width'].'" '; + + if( !empty($avatar['height']) ) + $height = 'height="'.$avatar['height'].'" '; + + $result .= + '<img '. + $style. + 'class="avatars_plugin_avatar avatars_plugin_avatar_'.$avatar['type'].'" '. + 'src="'.$avatar['url'].'" '. + $width. + $height. + 'title="'.$avatar['title'].'" '. + 'alt="'.$avatar['title'].'" '. + '/>'; + + if( !empty($avatar['lightbox']) ) + $result .= '</a>'; + + $result .= $after; + + return $result; + } + + + function get_avatar( $avatar_type, $avatar_name = NULL, $avatar_skin = '#', $params = array() ) + { // Get the path and url of a avatar + + if( $avatar_skin == '#' ) + $avatar_skin = 'default'; + + if( empty($avatar_name) ) + { + if( is_array($avatar_type) && !empty($avatar_type['type']) && !empty($avatar_type['name']) ) + { // We have an array format + $avatar = $avatar_type; + $avatar_name = $avatar['name']; + $avatar_type = $avatar['type']; + if( !empty($avatar['skin']) ) + $avatar_skin = $avatar['skin']; + unset($avatar); + } + else + { + $avatar_name = 'default'; + } + } + + // ------ + + if( is_null($this->avatars) ) + $this->avatars = $this->get_avatars(); + + // ------ + + //echo $avatar_name.' - '.gettype( $avatar_name ); + + $avatar_title = $avatar_name; + + if( is_numeric($avatar_name) || is_object($avatar_name) ) + { + switch ( $avatar_type ) + { + case 'user': + $UserCache = & get_Cache( 'UserCache' ); + + if( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Item' ) + { // Post author + $User = & $UserCache->get_by_ID( $avatar_name->creator_user_ID, true, false ); + } + elseif( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Comment' ) + { // Comment author + if( !empty($avatar_name->author_user_ID) ) + { + $User = & $UserCache->get_by_ID( $avatar_name->author_user_ID, true, false ); + } + else + { // Ungeristered user, display visitor avatar ( gravatar, ) + return $this->get_visitor_avatar( $avatar_name, $params ); + } + } + elseif( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'User' ) + { // Current user + $User = $avatar_name; + } + else + { // Assume the avatar_name is the user id + $User = & $UserCache->get_by_ID($avatar_name, true, false); + } + + // Got a user (maybe) + if( !$User ) + { // If getting the user class was unsuccessful lets still try with the id + $avatar_title = 'User no longer exists'; + unset($User); + break; + } + $avatar_name = $User->ID; + $avatar_title = $User->get('preferredname'); + break; + + case 'blog': + $BlogCache = & get_Cache( 'BlogCache' ); + + if( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Item' ) + { + $blog_ID = $avatar_name->blog_ID; + $Blog = & $BlogCache->get_by_ID( $avatar_name ); + } + elseif( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Blog' ) + { + $Blog = $avatar_name; + } + else + { + $Blog = & $BlogCache->get_by_ID( $avatar_name ); + } + + if( empty($Blog) ) + { + $avatar_title = 'Blog no longer exists'; + unset($Blog); + break; + } + $avatar_name = $Blog->ID; + $avatar_title = $Blog->name; + break; + + case 'category': + if( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Item' ) + { + $Item = $avatar_name; + $avatar_name = $Item->main_cat_ID; + } + $cat = get_the_category_by_ID( $avatar_name, false ); + + if( empty($cat) ) + { + $avatar_title = 'Category no longer exists'; + break; + } + $avatar_title = $cat['cat_name']; + break; + + case 'post': + if( is_object($avatar_name) && ucfirst(get_class($avatar_name)) === 'Item' ) + { + $Item = $avatar_name; + } + else + { + $ItemCache = & get_Cache( 'ItemCache' ); + $Item = & $ItemCache->get_by_ID( $avatar_name ); + } + $avatar_name = $Item->ID; + $avatar_title = $Item->get('title'); + break; + } + } + + // ------ + + # Blah + $large_url = $large_path = $avatar_large = $avatar = NULL; + + # Do some preps + if( !isset($this->avatars[$avatar_skin]) ) + $this->avatars[$avatar_skin] = array(); + if( !isset($this->avatars[$avatar_skin][$avatar_type]) ) + $this->avatars[$avatar_skin][$avatar_type] = array(); + + # Check if the avatar name exists + if( isset($this->avatars[$avatar_skin][$avatar_type][$avatar_name]) ) + { $exists = true; + $avatar = $this->avatars[$avatar_skin][$avatar_type][$avatar_name]; + if( isset($this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large']; + } + + # Check if the avatar name exists in the default directory + elseif( isset($this->avatars['default'][$avatar_type][$avatar_name]) ) + { + $exists = true; + $avatar = $this->avatars['default'][$avatar_type][$avatar_name]; + if( isset($this->avatars['default'][$avatar_type][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_type][$avatar_name.'.large']; + } + + # Check if the default avatar for the type exists + elseif( isset($this->avatars[$avatar_skin][$avatar_type]['default']) ) + { + $exists = false; + $avatar_name = 'default'; + $avatar = $this->avatars[$avatar_skin][$avatar_type][$avatar_name]; + if( isset($this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large']; + } + # Check if the default avatar for the type exists + elseif( isset($this->avatars['default'][$avatar_type]['default']) ) + { + $exists = false; + $avatar_name = 'default'; + $avatar = $this->avatars['default'][$avatar_type][$avatar_name]; + if( isset($this->avatars['default'][$avatar_type][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_type][$avatar_name.'.large']; + } + + # Check if the avatar exists in the skin + elseif( isset($this->avatars[$avatar_skin][$avatar_name]) ) + { + $exists = true; + $avatar = $this->avatars[$avatar_skin][$avatar_name]; + if( isset($this->avatars[$avatar_skin][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin][$avatar_name.'.large']; + } + + # Check if the default avatar for the skin exists + elseif( isset($this->avatars[$avatar_skin]['default']) ) + { + $exists = false; + + // If default post image not found use category image, then blog image + if( $avatar_type == 'post' && !is_file( $this->avatars_path.'default/post/default.jpg' ) && $this->Settings->get('display_next_default') ) + { + $avatar_name = 'default'; + + if( is_file( $this->avatars_path.'default/category/default.jpg' ) ) + { // Use default category image + $avatar = $this->avatars[$avatar_skin]['category'][$avatar_name]; + if( isset($this->avatars[$avatar_skin]['category'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin]['category'][$avatar_name.'.large']; + } + elseif( is_file( $this->avatars_path.'default/blog/default.jpg' ) ) + { // Use default blog image + $avatar = $this->avatars[$avatar_skin]['blog'][$avatar_name]; + if( isset($this->avatars[$avatar_skin]['blog'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin]['blog'][$avatar_name.'.large']; + } + else + { // Use main default image + $avatar = $this->avatars['default'][$avatar_name]; + if( isset($this->avatars['default'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_name.'.large']; + } + } + elseif( $avatar_type == 'post' && !is_file( $this->avatars_path.'default/post/default.jpg' ) && $this->Settings->get('display_next') ) + { + global $ItemCache; + + $Item = & $ItemCache->get_by_ID( $avatar_name ); + $avatar_title = $Item->get('title'); + + if( is_file( $this->avatars_path.'default/category/'.$Item->main_cat_ID.'.jpg' ) ) + { // Use default category image + $avatar_name = $Item->main_cat_ID; + $avatar = $this->avatars[$avatar_skin]['category'][$avatar_name]; + if( isset($this->avatars[$avatar_skin]['category'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin]['category'][$avatar_name.'.large']; + } + elseif( is_file( $this->avatars_path.'default/blog/'.$Item->blog_ID.'.jpg' ) ) + { // Use default blog image + $avatar_name = $Item->blog_ID; + $avatar = $this->avatars[$avatar_skin]['blog'][$avatar_name]; + if( isset($this->avatars[$avatar_skin]['blog'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin]['blog'][$avatar_name.'.large']; + } + else + { // Use main default image + $avatar_name = 'default'; + $avatar = $this->avatars['default'][$avatar_name]; + if( isset($this->avatars['default'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_name.'.large']; + } + } + else + { + $avatar_name = 'default'; + $avatar = $this->avatars[$avatar_skin][$avatar_name]; + if( isset($this->avatars[$avatar_skin][$avatar_name.'.large']) ) + $avatar_large = $this->avatars[$avatar_skin][$avatar_name.'.large']; + } + } + + # Check if the avatar exists in the default skin + elseif( isset($this->avatars['default'][$avatar_name]) ) + { + $exists = true; + $avatar = $this->avatars['default'][$avatar_name]; + if( isset($this->avatars['default'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_name.'.large']; + } + + # Check if the default avatar exists in the default skin + elseif( isset($this->avatars['default']['default']) ) + { + $exists = false; + $avatar_name = 'default'; + $avatar = $this->avatars['default'][$avatar_name]; + if( isset($this->avatars['default'][$avatar_name.'.large']) ) + $avatar_large = $this->avatars['default'][$avatar_name.'.large']; + } + # Use no avatar + else + { + return NULL; + } + + # We have found a avatar + + # Check if it is default + if( $exists === false && !$this->Settings->get('display_default_avatar') ) + return NULL; + + + # Large Avatar + if( $avatar_large ) + { + $large_url = $this->avatars_url.$avatar_large; + $large_path = $this->avatars_path.$avatar_large; + $lightbox = 1; + } + else + { + $lightbox = ''; + } + + # Avatar + $avatar = array( + 'avatar' => true, + 'exists' => var_export($exists, true), + 'path' => $this->avatars_path.$avatar, + 'url' => $this->avatars_url.$avatar, + 'title' => $avatar_title, + 'name' => $avatar_name, + 'type' => $avatar_type, + 'skin' => $avatar_skin, + 'large_path'=> $large_path, + 'large_url' => $large_url, + 'lightbox' => $lightbox, + ); + return $avatar; + } + + + function display_avatar( $params ) + { + global $Messages; + + $avatar_name = NULL; + $opt_params = array(); + + if( !isset($params['id']) ) { $params['id'] = ''; } + if( !isset($params['style']) ) { $params['style'] = ''; } + if( !isset($params['before']) ) { $params['before'] = '<div style="float:left">'; } + if( !isset($params['after']) ) { $params['after'] = '</div>'; } + if( !isset($params['noavatar']) ) { $params['noavatar'] = '<p>No avatar</p>'; } + + if( is_numeric($params['id']) ) + { // We already have avatar's name (ID) + $avatar_name = $params['id']; + } + else + { + switch( $params['type'] ) + + + + + { + case 'user': + global $current_User; + if ( is_object($current_User) ) + { // Current user avatar + $avatar_name = $current_User; + } + break; + + case 'post_author': + global $Item; + if ( is_object($Item) ) + { // Post author avatar + $avatar_name = $Item; + $params['type'] = 'user'; + } + else + { + $wrong_place = sprintf( $this->T_('Put this %s avatars code in posts loop, usually in %s, in %s or in %s'), + '<b>'.$params['type'].'</b>', 'index.main.php', 'posts.main.php', 'single.main.php' ); + } + break; + + case 'comment_author': + if ( is_object($params['comment']) ) + { // Comment author avatar + $avatar_name = $params['comment']; + $params['type'] = 'user'; + $opt_params = $params; + } + else + { + $wrong_place = sprintf( $this->T_('Put this %s avatars code in comments loop, usually in %s'), + '<b>'.$params['type'].'</b>', '_item_comment.inc.php' ); + } + break; + + case 'post': + global $Item; + if ( is_object($Item) ) + { // Post avatar + $avatar_name = $Item; + } + else + { + $wrong_place = sprintf( $this->T_('Put this %s avatars code in posts loop, usually in %s, in %s or in %s'), + '<b>'.$params['type'].'</b>', 'index.main.php', 'posts.main.php', 'single.main.php' ); + } + break; + + case 'category': + global $Item; + if ( is_object($Item) ) + { // Category avatar + $avatar_name = $Item; + } + else + { + $wrong_place = sprintf( $this->T_('Put this %s avatars code in posts loop, usually in %s, in %s or in %s'), + '<b>'.$params['type'].'</b>', 'index.main.php', 'posts.main.php', 'single.main.php' ); + } + break; + + case 'blog': + global $Blog; + if ( is_object($Blog) ) + { // Blog avatar + $avatar_name = $Blog->ID; + } + break; + + default: + + + + + + + + + return; + + } + + if( !empty($wrong_place) ) + { + echo '<div style="margin:5px; padding: 15px; border:1px solid #d99; background:#fbf2ee; color:#e00; text-align:left">'.$wrong_place.'</div>'; + return; + + } + } + + if( ($avatar = $this->get_avatar( $params['type'], $avatar_name, '#', $opt_params )) !== NULL ) + { // Display selected avatar + echo $this->get_avatar_display($avatar, $params['style'], $params['before'], $params['after'], $params['noavatar'] ); + } + } + + // ============================== + // Visitor avatars + + function get_visitor_avatar( $Comment, $params = array() ) + { // Gravatar + $visitor_avatar = $this->get_gravatar( $Comment, $params ); + + $avatar = array( + 'avatar' => true, + 'exists' => true, + 'url' => $visitor_avatar['url'], + 'title' => $visitor_avatar['title'], + 'name' => NULL, + 'type' => 'user', + 'skin' => 'default', + 'width' => $this->Settings->get('avatar_user_small_width'), + 'height' => $this->Settings->get('avatar_user_small_height'), + ); + return $avatar; + } + + + // Display gravatars + function get_gravatar( $Comment, $params = array() ) + { + if( empty($Comment->author_email) ) + return false; + + $url = 'http://www.gravatar.com/avatar.php?gravatar_id='.md5($Comment->author_email); + + if( !empty($params['rating']) ) + $url .= '&rating='.$params['rating']; + + if( !empty($params['size']) ) + $url .='&size='.$params['size']; + + if( !empty($params['default']) ) + $url .= '&default='.urlencode($params['default']); + + if( !empty($params['border']) ) + $url .= '&border='.$params['border']; + + return array( 'url' => $url, 'title' => $Comment->author ); + } + + + # ----------------------------------------------------------------------------- + + function upload_image ( $file_var_name ) + { + global $Messages; + + $result = NULL; + + if( isset($_FILES[$file_var_name]) && !empty($_FILES[$file_var_name]['tmp_name']) ) + { // We have a new large avatar + $result = false; + + $avatar_file = $_FILES[$file_var_name]; + + $original_name = $avatar_file['name']; + $original_extension = strtolower(substr($original_name, strrpos($original_name, '.')+1)); + if( !in_array($original_extension, $this->image_types, false) ) + { + $Messages->add( $this->T_('The image you tried to upload is not of an acceptable extension').' ['.implode(', ',$this->image_types).'].', 'error'); + } + elseif( $avatar_file['size'] > ($this->Settings->get('avatar_filesize') * 1024) ) + { + $Messages->add( sprintf($this->T_('The maximum allowed file size is %s KB.'), $this->Settings->get('avatar_filesize')), 'error'); + } + else + { // Upload Avatar + if( empty($avatar_file['error']) ) + { // File was uploaded successfully, let's upload it + $avatar_path = $this->temp_folder.basename($avatar_file['tmp_name']); + $ext = basename($avatar_file['name']); + $ext = substr($ext,strrpos($ext,'.')+1); + $ext = strtolower($ext); + $avatar_path .= '.'.$ext; + + if( isset($ext) ) + { + switch ( $ext ) + { // types + case $ext == 'png': + $GLOBALS['IMAGE_EXT'] = 'png'; + unset($ext); + break; + + default: + $GLOBALS['IMAGE_EXT'] = ''; + unset($ext); + break; + } + } + + if( move_uploaded_file($avatar_file['tmp_name'], $avatar_path) ) + { // File was moved successfully + $result = $avatar_path; + $Messages->add( $this->T_('Succesfully uploaded the image').' ['.$avatar_file['name'].'].', 'success'); + } + else + { + $Messages->add( $this->T_('Failed to upload the image').' ['.$avatar_file['name'].'].', 'error'); + } + } + else + { + $Messages->add( $this->T_('Failed to upload the image').' ['.$avatar_file['name'].'].', 'error'); + } + } + } + + return $result; + } + + function do_form_request ( $params = NULL ) + { + global $Messages; + + // Select which avatar to update + // Not needed now + /*if( isset($_POST['avatar_selected'], $_POST['avatar_userid'], $_POST['avatar_blogid']) ) + { + switch ( $_POST['avatar_selected'] ) + { + case 'user': + $_POST['avatar_name'] = $_POST['avatar_userid']; + $_POST['avatar_type'] = 'user'; + break; + + case 'blog': + $_POST['avatar_name'] = $_POST['avatar_blogid']; + $_POST['avatar_type'] = 'blog'; + break; + } + }*/ + + if( empty($_POST['avatar_name']) ) + { // Let's see if we have a id instead + switch ( true ) + { // types + case !empty( $params['User'] ) && !empty( $params['User']->ID ): + $_POST['avatar_name'] = $params['User']->ID; + break; + + default: + break; + } + } + + if( !empty($_POST['avatar_runonce']) && !empty($_POST['avatar_type']) && !empty($_POST['avatar_name']) ) + { + // Make it so we don't do this again + $this->do_form_request_ran = true; + unset($_POST['avatar_runonce']); + + // Get required variables + $avatar_type = $_POST['avatar_type']; + $avatar_name = $_POST['avatar_name']; + $avatar_skin = !empty($_POST['avatar_skin']) ? $_POST['avatar_skin'] : 'default'; + + // Set the paths + $avatar_small_path = $avatar_small_temp_path = $avatar_large_path = $avatar_large_temp_path = NULL; + + // -------------------------------------------- + // Find out whether we need to remove + $avatar_small_delete = isset($_REQUEST['avatar_small_delete']) ? true : false; + $avatar_large_delete = isset($_REQUEST['avatar_large_delete']) ? true : false; + + // Remove the avatars + if( $avatar_small_delete ) + $avatar_small_delete_result = $this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, 'small'); + + if( $avatar_large_delete ) + $avatar_large_delete_result = $this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, 'large'); + // if( $avatar_small_delete && $avatar_large_delete ) + // return $avatar_small_delete_result && $avatar_large_delete_result; + + // -------------------------------------------- + // Upload the images + $avatar_small_temp_path = $this->upload_image('avatar_small_file'); + $avatar_large_temp_path = $this->upload_image('avatar_large_file'); + + if( !$avatar_small_temp_path ) + $avatar_small_temp_path = NULL; + + if( !$avatar_large_temp_path ) + $avatar_large_temp_path = NULL; + + // -------------------------------------------- + // Add the avatars + + $avatar = $this->add_avatar($avatar_small_temp_path, $avatar_large_temp_path, $avatar_type, $avatar_name, $avatar_skin); + return $avatar; + } + + return NULL; + } + + # ----------------------------------------------------------------------------- + + function avatar_exists ( $avatar_type, $avatar_name, $avatar_skin = 'default' ) + { + return ( + isset($this->avatars[$avatar_skin]) + && isset($this->avatars[$avatar_skin][$avatar_type]) + && isset($this->avatars[$avatar_skin][$avatar_type][$avatar_name]) + ); + } + + function delete_avatar_image ( $avatar_type, $avatar_name, $avatar_skin = 'default', $image_type = NULL ) + { + global $Messages; + + $result = true; + + // Create avatar paths + $avatar_folder = $this->avatars_path.$avatar_skin.'/'.$avatar_type.'/'; + $avatar_small_path = $avatar_folder.$avatar_name.'.jpg'; + $avatar_large_path = $avatar_folder.$avatar_name.'.large.jpg'; + + // Never delete default avatars + if( $avatar_small_path == $this->avatars_path.'default/default.jpg' || + $avatar_small_path == $this->avatars_path.'default/'.$avatar_type.'/default.jpg' || + $avatar_large_path == $this->avatars_path.'default/default.jpg' || + $avatar_large_path == $this->avatars_path.'default/'.$avatar_type.'/default.jpg' ) + { + return $result; + } + + // Delete small avatar image + if( ($image_type === NULL || $image_type === 'small') && is_file($avatar_small_path) ) + { + if( unlink($avatar_small_path) ) + { + $Messages->add( sprintf($this->T_('Successfully deleted the %s avatar image.'), $image_type), 'success' ); + if( $this->avatar_exists($avatar_type, $avatar_name, $avatar_skin) ) + unset($this->avatars[$avatar_skin][$avatar_type][$avatar_name]); + } + else + { + $Messages->add( sprintf($this->T_('Failed to delete the %s avatar image.'), $image_type), 'error' ); + $result = false; + } + } + + // Delete large avatar image + if( ($image_type === NULL || $image_type === 'large') && is_file($avatar_large_path) ) + { + if( unlink($avatar_large_path) ) + { + $Messages->add( sprintf($this->T_('Successfully deleted the %s avatar image.'), $image_type), 'success' ); + if( $this->avatar_exists($avatar_type, $avatar_name.'.large', $avatar_skin) ) + unset($this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large']); + } + else + { + $Messages->add( sprintf($this->T_('Failed to delete the %s avatar image.'), $image_type), 'error' ); + $result = false; + } + } + + return $result; + } + + # ----------------------------------------------------------------------------- + + function create_avatar_image ( $avatar_temp_path, $avatar_type, $avatar_name, $avatar_skin = 'default', $image_type = 'small' ) + { + // ------------------------------------------------------------------------------------ + // Some version comparing stuff for beta versions + + /* + echo '<!-- create_avatar_image'. + "\r\n".print_r($avatar_temp_path, true). + "\r\n".print_r($avatar_type,true). + "\r\n".print_r($avatar_name,true). + "\r\n".print_r($avatar_skin,true). + "\r\n".print_r($image_type,true). + "\r\n".'-->'."\r\n"; + */ + + $v_new = 9; + $f_name = 'remake_image'; + $v_name = $f_name.'_version'; + global $$v_name; + if( isset($$v_name) ) + { + $v_old = & $$v_name; + if( floor($v_old) < floor($v_new) ) + { + return $this->create_avatar_image_old($avatar_temp_path, $avatar_type, $avatar_name, $avatar_skin, $image_type); + } + } + + + // ------------------------------------------------------------------------------------ + // Set some pre vars + + global $Messages; + + // ------------------------------------------------------------------------------------ + // Create avatar path + + $ext = basename($avatar_temp_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $ext = strtolower($ext); + $ext = 'jpg'; + + $avatar_folder = $this->avatars_path.$avatar_skin.'/'.$avatar_type.'/'; + $avatar_path = $avatar_folder.$avatar_name.($image_type === 'large' ? '.large' : '' ).'.'.$ext; + + if( isset($image_type) && $ext == 'png' ) + { + $GLOBALS['IMAGE_EXT'] = 'png'; + } else { + $GLOBALS['IMAGE_EXT'] = ''; + } + + // ------------------------------------------------------------------------------------ + // Get onto it + + // Remove the image if it exists + if( !$this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, $image_type) ) + { // Removing the image failed + return false; + } + + // Do we support image resizing? + if( $this->Settings->get('use_gd2') ) + { // Yes we do + + // Set the variables to use + $image = $avatar_temp_path; + + $width_new = $this->Settings->get('avatar_'.$avatar_type.'_'.$image_type.'_width'); + $height_new = $this->Settings->get('avatar_'.$avatar_type.'_'.$image_type.'_height'); + + $resize_mode = $this->Settings->get('avatar_'.$image_type.'_mode'); + $max_filesize = 0; + + if( isset($GLOBALS['IMAGE_EXT']) ) + { + switch ( $GLOBALS['IMAGE_EXT'] ) + { // types + case 'png': + + $quality = $image_type === 'large' ? 9 : 9; + unset($GLOBALS['IMAGE_EXT']); + break; + + default : + $quality = $this->Settings->get('avatar_'.$image_type.'_quality'); + break; + } + } + + // Get the remade image + $remake_image = compact( + 'image', + 'width_new', 'height_new', + 'resize_mode', 'max_filesize', 'quality', + 'image_type', 'image_extension' + ); + + /*echo '<!-- create_avatar_image:remake_image'. + "\r\n".print_r($remake_image, true). + "\r\n".'-->'."\r\n";*/ + + $avatar_image = remake_image($remake_image); + + // Write the image + if( $avatar_image ) + { // Image Creation was succcess + if( ($fp = fopen($avatar_path,'w')) && fwrite($fp, $avatar_image) && fclose($fp) ) + { + $Messages->add( sprintf($this->T_('Successfully created the %s avatar.'), $image_type), 'success' ); + } + else + { + $Messages->add( sprintf($this->T_('Failed writing the %s avatar.'), $image_type), 'error' ); + return false; + } + } + else + { + $Messages->add( sprintf($this->T_('Failed to create the %s avatar.'), $image_type), 'error' ); + return false; + } + + // Delete the temp file + if( !unlink($avatar_temp_path) ) + { + $Messages->add( sprintf($this->T_('Failed to delete the temporary %s avatar image.'), $image_type), 'error' ); + return false; + } + } + else + { // We don't support image resizing + + // So let's move the image + if( rename($avatar_temp_path, $avatar_path) ) + { + $Messages->add( sprintf($this->T_('Successfully moved the %s avatar to it\'s correct location. [ %d ]'), $image_type, $avatar_path), 'success' ); + } + else + { // Moving failed + $Messages->add( sprintf($this->T_('Failed to move the %s avatar image to it\'s correct location.'), $image_type), 'error' ); + // Delete the temp file + if( !unlink($avatar_temp_path) ) + { + $Messages->add( sprintf($this->T_('Failed to delete the temporary %s avatar image.'), $image_type), 'error' ); + } + return false; + } + } + + return true; + } + + function create_avatar_image_old ( $avatar_temp_path, $avatar_type, $avatar_name, $avatar_skin = 'default', $image_type = 'small' ) + { + global $Messages; + + // ------------------------------------------------------------------------------------ + // Create avatar path + + $avatar_folder = $this->avatars_path.$avatar_skin.'/'.$avatar_type.'/'; + $avatar_path = $avatar_folder.$avatar_name.($image_type === 'large' ? '.large' : '' ).'.jpg'; + + // ------------------------------------------------------------------------------------ + // Get onto it + + // Remove the image if it exists + if( !$this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, $image_type) ) + { // Removing the image failed + return false; + } + + // Do we support image resizing? + if( $this->Settings->get('use_gd2') ) + { // Yes we do + + // Create the large image + $avatar_image = remake_image(array( + 'image' => $avatar_temp_path, + 'width' => $this->Settings->get('avatar_'.$avatar_type.'_'.$image_type.'_width'), + 'height' => $this->Settings->get('avatar_'.$avatar_type.'_'.$image_type.'_height'), + 'mode' => $this->Settings->get('avatar_'.$image_type.'_mode'), + 'size' => 0, + 'quality' => 95, + 'debug' => true + )); + + // Write the large image + if( $avatar_image ) + { // Image Creation was succcess + if( ($fp = fopen($avatar_path,'w')) && fwrite($fp, $avatar_image) && fclose($fp) ) + $Messages->add( sprintf($this->T_('Successfully created the %s avatar.'), $image_type), 'success' ); + else { + $Messages->add( sprintf($this->T_('Failed writing the %s avatar.'), $image_type), 'error' ); + return false; + } + } + else { + $Messages->add( sprintf($this->T_('Failed to create the %s avatar.'), $image_type), 'error' ); + return false; + } + + // Delete the temp file + if( !unlink($avatar_temp_path) ) + { + $Messages->add( sprintf($this->T_('Failed to delete the temporary %s avatar image.'), $image_type), 'error' ); + return false; + } + } + else + { // We don't support image resizing + + // So let's move the image + if( rename($avatar_temp_path, $avatar_path) ) + { + $Messages->add( sprintf($this->T_('Successfully moved the %s avatar to it\'s correct location. [ %d ]'), $image_type, $avatar_path), 'success' ); + } + else + { // Moving failed + $Messages->add( sprintf($this->T_('Failed to move the %s avatar image to it\'s correct location.'), $image_type), 'error' ); + // Delete the temp file + if( !unlink($avatar_temp_path) ) + { + $Messages->add( sprintf($this->T_('Failed to delete the temporary %s avatar image.'), $image_type), 'error' ); + } + return false; + } + } + + return true; + } + + # ----------------------------------------------------------------------------- + + function add_avatar( $avatar_small_temp_path, $avatar_large_temp_path /* = NULL */, $avatar_type, $avatar_name, $avatar_skin = 'default' ) + { + global $Messages; + + if( empty($avatar_small_temp_path) && empty($avatar_large_temp_path) ) + return NULL; + + // ------------------------------------------------------------------------------------ + // Create avatar paths + + $avatar_folder = $this->avatars_path.$avatar_skin.'/'.$avatar_type.'/'; + + $avatar = $this->get_avatar($avatar_type, $avatar_name, $avatar_skin); + if( !empty($avatar) && !empty($avatar['path']) ) + $avatar_small_path = $avatar['path']; + else + { + $ext = basename($avatar_small_temp_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $avatar_small_path = $avatar_folder.$avatar_name.'.'.$ext; + $this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, 'small'); + } + + if( !empty($avatar) && !empty($avatar['large_path']) ) + $avatar_large_path = $avatar['large_path']; + else + { + $ext = basename($avatar_large_temp_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $avatar_large_path = $avatar_folder.$avatar_name.'.large.'.$ext; + $this->delete_avatar_image($avatar_type, $avatar_name, $avatar_skin, 'large'); + } + + // ------------------------------------------------------------------------------------ + // Check if we have a small avatar, and if we don't try copy the large avatar over + + if( !$avatar_small_temp_path && !is_file($avatar_small_path) ) + { // No small avatar exists + + // Get the path to try and copy + if( $avatar_large_temp_path ) + $avatar_large_copy_path = $avatar_large_temp_path; + elseif( is_file($avatar_large_path) ) + $avatar_large_copy_path = $avatar_large_path; + else + $avatar_large_copy_path = NULL; + + // Do the work + if( $avatar_large_copy_path ) + { // A large avatar exists + // SO let's copy the large avatar over for use for the small avatar + $ext = basename($avatar_large_copy_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $avatar_small_temp_path = $this->temp_folder.basename($avatar_large_copy_path).'.'.$ext; + if( copy($avatar_large_copy_path, $avatar_small_temp_path) ) + { // Copy went well + $Messages->add( $this->T_('Successfully copied the large avatar image for use for the small avatar image.'), 'success'); + } else + { // Copy went bad + $Messages->add( $this->T_('Unsuccessfully copied the large avatar image for use for the small avatar image.'), 'error'); + return false; + } + } else + { // Copy went bad + $Messages->add( $this->T_('No small avatar exists! And no large avatar exists to use for the small avatar either!'), 'error'); + return false; + } + } + + // ------------------------------------------------------------------------------------ + // Create the large avatar image + if( $avatar_large_temp_path ) + { + if( !$this->create_avatar_image($avatar_large_temp_path, $avatar_type, $avatar_name, $avatar_skin, 'large') ) + return false; + else + { // Add the avatar to the list + // We do extension stuff, because the $avatar_large_path might be of a old extension + // and we cannot simply use temp path because that has a cryptic/temp name + $basename = basename($avatar_large_path); + $basename = substr($basename, 0, strrpos($basename, '.')+1); // remove extension + $ext = basename($avatar_large_temp_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $basename .= $ext; + $this->avatars[$avatar_skin][$avatar_type][$avatar_name.'.large'] = $avatar_skin.'/'.$avatar_type.'/'.$basename; + } + } + + // Create the small avatar image + if( $avatar_small_temp_path ) + { + if( !$this->create_avatar_image($avatar_small_temp_path, $avatar_type, $avatar_name, $avatar_skin, 'small') ) + return false; + else + { // Add the avatar to the list + // We do extension stuff, because the $avatar_large_path might be of a old extension + // and we cannot simply use temp path because that has a cryptic/temp name + $basename = basename($avatar_small_path); + $basename = substr($basename, 0, strrpos($basename, '.')+1); // remove extension + $ext = basename($avatar_small_temp_path); + $ext = substr($ext,strrpos($ext,'.')+1); + $basename .= $ext; + $this->avatars[$avatar_skin][$avatar_type][$avatar_name] = $avatar_skin.'/'.$avatar_type.'/'.$basename; + } + } + + // ------------------------------------------------------------------------------------ + + return $this->get_avatar($avatar_type, $avatar_name, $avatar_skin); + } + + # ----------------------------------------------------------------------------- + + function admin_avatars( & $params ) + { // Finds out if we are needed + + // ---------------------------------------------------- + // Check to see if we have already found out if we are needed + + if( $this->admin_avatars !== NULL && !empty($this->admin_avatars) ) + return $this->admin_avatars; + + // ---------------------------------------------------- + // Set globals + + global $ctrl, $tab, $action, $user_ID, $cat_ID, $edited_Item, $blog; // find our where we are + + // ---------------------------------------------------- + // If we haven't constructed yet, let's construct + + if( is_null($this->avatars) ) + $this->avatars = $this->get_avatars(); + + // ---------------------------------------------------- + // So let's find out what avatar form we should display + + $admin_area = $avatar_name = $avatar_type = NULL; + switch ( true ) + { + case $ctrl === 'coll_settings' && $tab === 'general' && !empty($blog): + $avatar_type = 'blog'; + $avatar_name = $blog; + $admin_area = 'blog'; + break; + + case $ctrl === 'chapters' && !empty($cat_ID) && $action !== 'delete': + $avatar_type = 'category'; + $avatar_name = $cat_ID; + $admin_area = 'category'; + break; + + case $ctrl === 'items' && ( $action === 'edit' || $action === 'edit_switchtab' ): + $avatar_type = 'post'; + $avatar_name = $edited_Item->ID; + $admin_area = 'post'; + break; + + case $ctrl === 'users' && ($action === 'new_user' || $action === 'edit_user'): + // var_export($action); + $avatar_type = 'user'; + $avatar_name = $user_ID; + $admin_area = 'user'; + break; + } + + // ---------------------------------------------------- + + $this->admin_avatars = array( + 'avatar_type' => $avatar_type, + 'avatar_name' => $avatar_name, + 'admin_area' => $admin_area + ); + + return $this->admin_avatars; + } + +// ========================================================================== + + /** + * Event handler: Called before the plugin is going to be installed. + * + * This is the hook to create any DB tables or the like. + * + * If you just want to add a note, use {@link Plugin::msg()} (and return true). + * + * @return true|string True, if the plugin can be enabled/activated, + * a string with an error/note otherwise. + */ + function BeforeInstall() + { // So we can check the requirements + return $this->install(); + } + + /** + * Event handler: Called before the plugin is going to be un-installed. + * + * This is the hook to remove any files or the like - tables with canonical names + * (see {@link Plugin::get_sql_table()}, are handled internally. + */ + function BeforeUninstall( & $params ) + { + if( $params['unattended'] ) + { // Auto + $del = true; + } + else + { // User + if( isset($_POST[$this->code.'__unlink_dir']) ) + { // Second step + $del = $_POST[$this->code.'__unlink_dir'] === '1'; + } + else + { // First step + return NULL; // display payload + } + } + + if( $del ) + { // Delete Files + $result = $this->uninstall(); + global $Messages; + $Messages->add( $result ? $this->T_('Successfully removed all avatars.') : $this->T_('Failed deleting all avatars for this plugin.'), + $result ? 'success' : 'error' ); + return $result; + } + else + { // Keep files + global $Messages; + $Messages->add( $this->T_('All avatars were kept.'), 'note'); + return true; + } + } + + /** + * Event handler: Gets invoked to display the payload before uninstalling the plugin. + * + * You have to request a call to this during the plugin uninstall procedure by + * returning NULL in {@link BeforeUninstall()}. + * + * @param array Associative array of parameters. + * 'Form': The {@link Form} that asks the user for confirmation (by reference). + * If your plugin uses canonical table names (see {@link Plugin::get_sql_table()}), + * there will be already a list of those tables included in it. + * Do not end the form, just add own inputs or hidden keys to it. + */ + function BeforeUninstallPayload( & $params ) + { + ?> + <input name="<?php echo $this->code.'__unlink_dir'; ?>" type="hidden" value="0" /> + <label> + <input name="<?php echo $this->code.'__unlink_dir'; ?>" type="checkbox" value="1" /> + <span class="notes"><?php echo $this->T_('Permanently delete any avatars?') ?></span> + </label> + <?php + } + +# ============================================================================= +# ADMIN AREA FUNCTIONS/EVENTS + + /** + * Event handler: Gets invoked before the main payload in the backoffice. + */ + function AdminBeginPayload() + { + global $ctrl, $blog; + + switch ( true ) + { + // Posts + case $ctrl === 'items': + // Users + case $ctrl === 'users': + // Blogs + //case $ctrl === 'collections' && $blog === 0: + // Categories + case $ctrl === 'chapters': + ob_start(); // start our avatar hackage + break; + + default: + return NULL; + } + return true; + } + + /** + * Event handler: Gets invoked when our tab is selected and should get displayed. + * + * Do your output here. + * + * @return boolean did we display something? + */ + function AdminEndPayload() + { + // ======================================================= + + global $ctrl, $blog, $action, $user_ID; + + $do_payload_hack = false; + + switch ( true ) + { + // Handled in AdminItemDisplayFieldset + case $ctrl === 'items' && ( $action === 'edit' || $action === 'edit_switchtab' ): + return NULL; + + // Delete usersettings hack fieldset + case $ctrl === 'users' && ( !empty($user_ID) || $action === 'new_user' ): + //<div class="fieldset_title"><div class="fieldset_title_right">...<div class="fieldset_title_bg">Avatars</div></div></div> + $regex = '/((<div .*?class="fieldset_title".*?><div .*?class="fieldset_title_right".*?>)[\s]+?<div .*?class="fieldset_title_bg".*?>Avatars<\\/div.*?><\\/div.*?><\\/div.*?>)/e'; + $replace = ''; + $do_payload_hack = true; + break; + + // Posts + case $ctrl === 'items': + + //<div id="item_70822">...<div class="bContent"> + $regex = '/(<div .*?id="item_([0-9]+)".*?>[\s\S]+?<div .*?class=".*?bContent.*?".*?>)/e'; + $replace = + '$this->get_avatar_display( '. + // avatar + 'array("type" => "post", "name" => $2, "skin" => "admin"), '. + // style + '"margin:3px; float:right;", '. + // before + 'str_replace("\\\'", "\'", "$1"), '. + // after + '"", '. + // none + 'str_replace("\\\'", "\'", "$1") '. + ')'; + $do_payload_hack = true; + break; + + // Users + case $ctrl === 'users': + $regex = '/<td class="">(<a href="\\?ctrl=users&user_ID=([0-9]+).+?>.+?<\\/a>)<\\/td>/e'; + $replace = + '"<td class=\"\">".$this->get_avatar_display( '. + /* avatar */ + 'array("type" => "user", "name" => $2, "skin" => "admin"), '. + /* style */ + '"margin:4px 0", '. + /* before */ + '"<div style=\"float:left\">", '. + /* after */ + '"</div><div style=\"margin-top:'.(round($this->Settings->get('avatar_user_small_height')/2)-5).'px; margin-left:'. + ($this->Settings->get('avatar_user_small_width')+15).'px\" >".str_replace("\\\'", "\'", "$1")."</div>", '. + /* none */ + 'str_replace("\\\'", "\'", "$1") '. + ')."</td>"'; + $do_payload_hack = true; + break; + + // Blogs + case $ctrl === 'collections' && $blog === 0: + break; // event is never fired + /* + $regex = '/(<a .*?href=".*?\\?ctrl=collections&blog=([0-9]+).*? title="Properties".*?>.*?<\\/a>.*?)(<\\/td>)/e'; + $replace = + '"<div style=\"margin-top:'.(round($this->Settings->get('avatar_small_height')/2)-3).'px;\" >".str_replace("\\\'", "\'", "$1")."</div>"'. + '.$this->get_avatar_display($this->get_avatar("user", $2, "admin"), "margin:3px; margin-left:0px; margin-right:10px; float:right;")'. + '.str_replace("\\\'", "\'", "$3")'; + $do_payload_hack = true; + //<a href="/balupton.com/packages/b2evolution/admin.php?ctrl=collections&blog=1" title="Properties" + break; + */ + + // Categories + case $ctrl === 'chapters': + break; + + default: + break; + } + + if( $do_payload_hack ) + { + $payload_contents = ob_get_contents(); + ob_end_clean(); + + $payload_contents = preg_replace($regex, $replace, $payload_contents); + echo $payload_contents; + } + + // ======================================================= + + // Check user permissions + if( ! $this->check_user_perms() ) + return NULL; + + // Find out if a avatar group applies for our current area + extract( $this->admin_avatars($params) ); + + if( empty($avatar_type) ) + { // We are not needed + return NULL; + } + + // Find out if this event applies for our current area + switch ( $admin_area ) + { + case 'blog': + break; + + case 'post': + break; + + case 'category': + case 'user': + $this->do_form_request(); + if( $this->do_form_request_ran ) + { // We do not need this if the form ran + return NULL; + break; + } + break; + } + + // ---------------------------------------------------- + // We are needed + + // Include our admin area + require(dirname(__FILE__).'/_admin_area.php'); + + return true; + } + + function UserProfileUpdate( & $params ) + { + // Check user permissions + if( ! $this->check_user_perms() ) + return NULL; + + $this->do_form_request(); + if( $this->do_form_request_ran ) + { // We do not need this if the form ran + return NULL; + } + + // ---------------------------------------------------- + // We are needed + + // Include our profile area + require(dirname(__FILE__).'/_profile_area.php'); + + return true; + } + + # ----------------------------------------------------------------------------- + + /** + * Define here default user settings that are then available in the backoffice. + * + * You can access them in the plugin through the member object + * {@link $UserSettings}, e.g.: + * <code>$this->UserSettings->get( 'my_param' );</code> + * + * This method behaves exactly like {@link Plugin::GetDefaultSettings()}, + * except that it defines user specific settings instead of global settings. + * + * @see Plugin::GetDefaultSettings() + * @param array Associative array of parameters. + * 'for_editing': true, if the settings get queried for editing; + * false, if they get queried for instantiating {@link Plugin::$UserSettings}. + * @return array See {@link Plugin::GetDefaultSettings()}. + */ + function GetDefaultUserSettings() + { + // Check user permissions + if( ! $this->check_user_perms() ) + return NULL; + + return array( + 'user_settings_hack' => array( + 'label' => 'hack to get user settings update to work', + 'type' => 'checkbox', + 'defaultvalue' => '0', + ), + ); + } + + + /** + * Event handler: Called as action just before updating the {@link Plugin::$UserSettings plugin's user settings}. + * + * The "regular" settings from {@link GetDefaultUserSettings()} have been set into + * {@link Plugin::$UserSettings}, but get saved into DB after this method has been called. + * + * Use this to catch custom input fields from {@link PluginUserSettingsEditDisplayAfter()} or + * add notes/errors through {@link Plugin::msg()}. + * + * @param array Associative array of parameters + * - 'User': the {@link User} for which the settings get updated + * - 'action': "save", "reset" (since b2evo EVO_NEXT_VERSION - before there was only "save") + * + * @return false|NULL Return false to prevent the settings from being updated to DB. + */ + function PluginUserSettingsUpdateAction( & $params ) + { + return $this->do_form_request($params); + } + + # ----------------------------------------------------------------------------- + + /** + * Event handler: called at the end of {@link Item::dbinsert() inserting + * a item/post into the database}, which means it has been created. + * + * @param array Associative array of parameters + * - 'Item': the related Item (by reference) + * - 'dbchanges': array with DB changes; a copy of {@link Item::dbchanges()}, + * before they got applied (since 1.9) + */ + function AfterItemInsert( & $params ) + { + global $Messages, $Session; + //$Messages->clear('all'); + + $result = $this->do_form_request(); + + $Session->set( 'Messages', $Messages ); + //$Session->dbsave(); + + return $result; + } + + + /** + * Event handler: called at the end of {@link Item::dbupdate() updating + * an item/post in the database}, which means that it has been changed. + * + * @param array Associative array of parameters + * - 'Item': the related Item (by reference) + * - 'dbchanges': array with DB changes; a copy of {@link Item::dbchanges()}, + * before they got applied (since 1.9) + */ + function AfterItemUpdate( & $params ) + { + return $this->AfterItemInsert($params); + } + + + /** + * Event handler: called at the end of {@link Item::dbdelete() deleting + * an item/post from the database}. + * + * @param array Associative array of parameters + * - 'Item': the related Item (by reference) + */ + function AfterItemDelete( & $params ) + { + return $this->delete_avatar_image('post', $params['Item']->ID); + } + + # ----------------------------------------------------------------------------- + + /** + * The AdminDisplayItemFormFieldset Event + ** + * This function displays our little form/area in the 'Write/Edit Post' page. + * What it does: + * Searches the post with our $search expression + * If something is found, then our plugin is needed - return true; + * Otherwise our plugin is not needed - return false; + * + */ + + /** + * Event handler: Called at the end of the "Edit item" form. + * + * @param array Associative array of parameters + * - 'Form': the {@link Form} object (by reference) + * - 'Item': the Item which gets edited (by reference) + * - 'edit_layout': "simple", "expert", etc. (users, hackers, plugins, etc. may create their own layouts in addition to these) + * NOTE: Please respect the "simple" mode, which should display only the most simple things! + * @return boolean did we display something? + */ + function AdminDisplayItemFormFieldset( & $params ) + { + // Comment the below statement out if you want your plugin shown in simple view + if( $params['edit_layout'] === 'simple' ) + return false; + + // Check user permissions + if( ! $this->check_user_perms() ) + return NULL; + + // Find out if a avatar group applies for our current area + extract( $this->admin_avatars($params) ); + if( empty($avatar_type) ) + { // We are not needed + return NULL; + } + + // ---------------------------------------------------- + // We are needed + + // Include our admin area + require( dirname(__FILE__).'/_admin_area.php' ); + + return true; + } + + + /** + * Event handler: Called when ending the admin html head section. + * + * @param array Associative array of parameters + * @return boolean did we do something? + */ + function AdminEndHtmlHead( & $params ) + { + global $ctrl, $blog, $plugins_url; + + switch ( true ) + { + // Posts + case $ctrl === 'items': + // Users + case $ctrl === 'users': + // Blogs + case $ctrl === 'collections' && $blog === 0: + // Categories + case $ctrl === 'chapters': + break; + + default: + // Find out if a avatar group applies for our current area + extract($this->admin_avatars($params)); + if( empty($avatar_type) ) + { // We are not needed + return NULL; + } + + // Find out if this event applies for our current area + switch ( $admin_area ) + { + case 'blog': + $this->do_form_request($params); + break; + + case 'post': + break; + + case 'category': + case 'user': + $this->do_form_request($params); + if( $this->do_form_request_ran ) + { // We do not need this if the form ran + return NULL; + break; + } + break; + } + break; + } + + // ---------------------------------------------------- + // We are needed + + $this->SkinBeginHtmlHead($params); + + return true; + } + + + +// ============================================================================= +// SKIN FUNCTIONS/EVENTS + + /** + * The SkinBeginHtmlHead Event + ** + * This function displays our and HEAD html code we want inside the skin (Eg. Stylsheets, Javascript). + * + * Event handler: Called during the display of the Skins's Html Head section. + * + * @param array Associative array of parameters + * @return boolean did we do something? + */ + function SkinBeginHtmlHead( & $params ) + { + global $Plugins, $plugins_url; + + // Make it easier for our skinner + $GLOBALS['avatars_Plugin'] = & $Plugins->get_by_code($this->code); + + // Include Avatar's CSS files + require_css( $plugins_url.'avatars_plugin/includes/basic.css', false ); + require_css( $plugins_url.'avatars_plugin/includes/jquerylightbox/css/jquery.lightbox-0.5.css', false ); + + // Set the background avatar if it exists + $background_avatar = $this->get_avatar( NULL, 'background', 'default' ); + if( !empty($background_avatar) ) + { + echo "\n\t".'<style type="text/css"> + img.avatars_plugin_avatar { background:url("'.$background_avatar['url'].'") no-repeat white center } + </style>'."\n"; + } + + // ============================= + // Include SCRIPTS + + $jqcode = '<script type="text/javascript"> + //<![CDATA[ + jQuery.noConflict(); + (function($) { + $(function() { + $(\'a.lightbox_avatar\') + .each(function(i){$(this).lightBox({ + imageLoading: \''.$plugins_url.'avatars_plugin/includes/jquerylightbox/images/lightbox-ico-loading.gif\', + imageBtnPrev: \''.$plugins_url.'avatars_plugin/includes/jquerylightbox/images/lightbox-btn-prev.gif\', + imageBtnNext: \''.$plugins_url.'avatars_plugin/includes/jquerylightbox/images/lightbox-btn-next.gif\', + imageBtnClose: \''.$plugins_url.'avatars_plugin/includes/jquerylightbox/images/lightbox-btn-close.gif\', + imageBlank: \''.$plugins_url.'avatars_plugin/includes/jquerylightbox/images/lightbox-blank.gif\', + txtImage: \''.$this->T_('Image').'\', + txtOf: \''.$this->T_('of').'\' + }) + }) + }) + })(jQuery) + + var $ = jQuery.noConflict(); + //]]> + </script>'; + + require_js( '#jquery#' ); + add_headline( $jqcode ); + + if( empty($this->lightbox_plugin) || is_admin_page() ) + { // Include js if jQuery Lightbox plugin is disabled + // or if we are on admin page + require_js( $plugins_url.'avatars_plugin/includes/jquerylightbox/js/jquery.lightbox-0.5.pack.js', false ); + } + + return true; + } + +} + +?> Added: avatars_plugin/branches/2.2.7/_profile_area.php =================================================================== --- avatars_plugin/branches/2.2.7/_profile_area.php (rev 0) +++ avatars_plugin/branches/2.2.7/_profile_area.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,90 @@ +<?php +/** + * B2evolution Avatars Plugin + * + * The Avatars Plugin allows you to attach avatars (display pictures, gravatars, profile pics, etc) to a user, blog, post and category. + * You upload avatars within the b2evo adminstration, with either a large or small (or both) avatar images. + * If a large avatar image is specified then lightbox functionality is seen, as when the user clicks the small avatar, the large avatar will show in a lightbox. + * It makes use of the GD2 Image and the Gallery Plugin\x92s Libraries allowing for images to be resized and compressed to specified values. + * + * @name B2evolution Avatars Plugin: _avatars.plugin.php + * @version 2.2.7 + * @package plugins + * + * {@internal Below is a list of authors who have contributed to design/coding of this file: } + * @author sam2kb: Russian b2evolution - {@link http://ru.b2evo.net/} + * @author balupton: Benjamin Lupton - {@link http://www.balupton.com} + * + * Built on code originally released by balupton: Benjamin LUPTON - {@link http://www.balupton.com/} + * @copyright (c) 2006-2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @copyright (c) 2008 by Russian b2evolution - {@link http://ru.b2evo.net/} + * + * @license GNU General Public License 2 (GPL) - {@link http://www.opensource.org/licenses/gpl-license.php} + */ + +global $UserSettings, $current_User, $disp; + +if( isset($disp) && $disp == 'profile' ) +{ +?> +<fieldset class="<?php echo $this->classname.'fieldset'; ?> renderer_plugin" id="<?php echo $this->code; ?>_area"> +<div class="label"> + <label><?php echo $this->T_('Avatars').':'?></label> +</div> +<div> + <div class="label" style="margin-right:0px; float:left"> + <input type="hidden" name="avatar_runonce" value="true" /> + <input type="hidden" name="avatar_name" value="<?php echo $current_User->ID ?>" /> + <input type="hidden" name="avatar_type" value="user" /> + <?php + $avatar = $this->get_avatar('user', $current_User, 'default'); + echo $this->get_avatar_display($avatar); + ?> + </div> + <div class="input" style="padding-bottom:10px; margin:0 0 0 15px; float:left"> + <div> + <?php + $large_width = $this->Settings->get('avatar_user_large_width'); + $large_height = $this->Settings->get('avatar_user_large_height'); + echo '<span style="font-weight:bold">'.$this->T_('Large Avatar').'</span>'; + if ( !($large_width === $large_height && $large_height === 0) ) + echo ' <span class="notes">('.$this->T_('Up to').' '.$large_width.'x'.$large_height.').</span>'; + ?> + <br /> + <input name="avatar_large_file" id="avatar_large_file" type="file" size="15" /> + <label for="avatar_large_delete" style="margin-top:5px; height:20px; display:block; font-weight:normal"> + <input type="checkbox" name="avatar_large_delete" id="avatar_large_delete" /> + <?php echo $this->T_('Remove Avatar') ?></label> + </div> + + <div style="margin-top:20px"> + <?php + $small_width = $this->Settings->get('avatar_user_small_width'); + $small_height = $this->Settings->get('avatar_user_small_height'); + echo '<span style="font-weight:bold; padding-bottom:3px">'.$this->T_('Small Avatar').'</span>'; + if ( !($small_width === $small_height && $small_height === 0) ) + echo ' <span class="notes">('.$this->T_('Up to').' '.$small_width.'x'.$small_height.').</span>'; + ?> + <br /> + <input name="avatar_small_file" id="avatar_small_file" type="file" size="15" /> + <label for="avatar_small_delete" style="margin-top:5px; height:20px; display:block; font-weight:normal"> + <input type="checkbox" name="avatar_small_delete" id="avatar_small_delete" /> + <?php echo $this->T_('Remove Avatar') ?></label> + </div> + </div> +</div> +</fieldset> + +<script type="text/javascript"> +//<![CDATA[ + jQuery(document).ready(function() + { + jQuery('form#ProfileForm').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data'); + + }); +//]]> +</script> + +<?php +} +?> Added: avatars_plugin/branches/2.2.7/includes/basic.css =================================================================== --- avatars_plugin/branches/2.2.7/includes/basic.css (rev 0) +++ avatars_plugin/branches/2.2.7/includes/basic.css 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,7 @@ +img.avatars_plugin_avatar +{ + margin:7px; + padding:1px; + border:1px solid #CCCCCC; + background-color:white; +} \ No newline at end of file Added: avatars_plugin/branches/2.2.7/includes/default.jpg =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/default.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/css/jquery.lightbox-0.5.css =================================================================== --- avatars_plugin/branches/2.2.7/includes/jquerylightbox/css/jquery.lightbox-0.5.css (rev 0) +++ avatars_plugin/branches/2.2.7/includes/jquerylightbox/css/jquery.lightbox-0.5.css 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,100 @@ +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.5.css + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.5 + * @date April 11, 2008 + * @category jQuery plugin + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ +#jquery-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 90; + width: 100%; + height: 500px; +} +#jquery-lightbox { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 100; + text-align: center; + line-height: 0; +} +#jquery-lightbox a img { border: none; } +#lightbox-container-image-box { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; +} +#lightbox-container-image { padding: 10px; } +#lightbox-loading { + position: absolute; + top: 40%; + left: 0%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; +} +#lightbox-nav { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + z-index: 10; +} +#lightbox-container-image-box > #lightbox-nav { left: 0; } +#lightbox-nav a { outline: none;} +#lightbox-nav-btnPrev, #lightbox-nav-btnNext { + width: 49%; + height: 100%; + display: block; +} +#lightbox-nav-btnPrev { + left: 0; + float: left; +} +#lightbox-nav-btnNext { + right: 0; + float: right; +} +#lightbox-container-image-data-box { + font: 10px Verdana, Helvetica, sans-serif; + background-color: #fff; + margin: 0 auto; + line-height: 1.4em; + overflow: auto; + width: 100%; + padding: 0 10px 0; +} +#lightbox-container-image-data { + padding: 0 10px; + color: #666; +} +#lightbox-container-image-data #lightbox-image-details { + width: 70%; + float: left; + text-align: left; +} +#lightbox-image-details-caption { font-weight: bold; } +#lightbox-image-details-currentNumber { + display: block; + clear: left; + padding-bottom: 1.0em; +} +#lightbox-secNav-btnClose { + width: 66px; + float: right; + padding-bottom: 0.7em; +} \ No newline at end of file Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-blank.gif =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-blank.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-close.gif =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-close.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-next.gif =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-next.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-prev.gif =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-btn-prev.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-ico-loading.gif =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/includes/jquerylightbox/images/lightbox-ico-loading.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.js =================================================================== --- avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.js (rev 0) +++ avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.js 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,472 @@ +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.5.js + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.5 + * @date April 11, 2008 + * @category jQuery plugin + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ + +// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias +(function($) { + /** + * $ is an alias to jQuery object + * + */ + $.fn.lightBox = function(settings) { + // Settings to configure the jQuery lightBox plugin how you like + settings = jQuery.extend({ + // Configuration related to overlay + overlayBgColor: '#000', // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color. + overlayOpacity: 0.8, // (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9 + // Configuration related to navigation + fixedNavigation: false, // (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface. + // Configuration related to images + imageLoading: 'images/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon + imageBtnPrev: 'images/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image + imageBtnNext: 'images/lightbox-btn-next.gif', // (string) Path and the name of the next button image + imageBtnClose: 'http://localhost/b2evolution/2/plugins/avatars_plugin/includes/jquerylightbox/images/lightbox-btn-close.gif';, // (string) Path and the name of the close btn + imageBlank: 'images/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel) + // Configuration related to container image box + containerBorderSize: 10, // (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value + containerResizeSpeed: 400, // (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default. + // Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts. + txtImage: 'Image', // (string) Specify text "Image" + txtOf: 'of', // (string) Specify text "of" + // Configuration related to keyboard navigation + keyToClose: 'c', // (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to. + keyToPrev: 'p', // (string) (p = previous) Letter to show the previous image + keyToNext: 'n', // (string) (n = next) Letter to show the next image. + // Don\xB4t alter these variables in any way + imageArray: [], + activeImage: 0 + },settings); + // Caching the jQuery object with all elements matched + var jQueryMatchedObj = this; // This, in this context, refer to jQuery object + /** + * Initializing the plugin calling the start function + * + * @return boolean false + */ + function _initialize() { + _start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked + return false; // Avoid the browser following the link + } + /** + * Start the jQuery lightBox plugin + * + * @param object objClicked The object (link) whick the user have clicked + * @param object jQueryMatchedObj The jQuery object with all elements matched + */ + function _start(objClicked,jQueryMatchedObj) { + // Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay. + $('embed, object, select').css({ 'visibility' : 'hidden' }); + // Call the function to create the markup structure; style some elements; assign events in some elements. + _set_interface(); + // Unset total images in imageArray + settings.imageArray.length = 0; + // Unset image active information + settings.activeImage = 0; + // We have an image set? Or just an image? Let\xB4s see it. + if ( jQueryMatchedObj.length == 1 ) { + settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title'))); + } else { + // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references + for ( var i = 0; i < jQueryMatchedObj.length; i++ ) { + settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'))); + } + } + while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) { + settings.activeImage++; + } + // Call the function that prepares image exibition + _set_image_to_view(); + } + /** + * Create the jQuery lightBox plugin interface + * + * The HTML markup will be like that: + <div id="jquery-overlay"></div> + <div id="jquery-lightbox"> + <div id="lightbox-container-image-box"> + <div id="lightbox-container-image"> + <img src="../fotos/XX.jpg" id="lightbox-image"> + <div id="lightbox-nav"> + <a href="#" id="lightbox-nav-btnPrev"></a> + <a href="#" id="lightbox-nav-btnNext"></a> + </div> + <div id="lightbox-loading"> + <a href="#" id="lightbox-loading-link"> + <img src="../images/lightbox-ico-loading.gif"> + </a> + </div> + </div> + </div> + <div id="lightbox-container-image-data-box"> + <div id="lightbox-container-image-data"> + <div id="lightbox-image-details"> + <span id="lightbox-image-details-caption"></span> + <span id="lightbox-image-details-currentNumber"></span> + </div> + <div id="lightbox-secNav"> + <a href="#" id="lightbox-secNav-btnClose"> + <img src="../images/lightbox-btn-close.gif"> + </a> + </div> + </div> + </div> + </div> + * + */ + function _set_interface() { + // Apply the HTML markup into body tag + $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>'); + // Get page sizes + var arrPageSizes = ___getPageSize(); + // Style overlay and show it + $('#jquery-overlay').css({ + backgroundColor: settings.overlayBgColor, + opacity: settings.overlayOpacity, + width: arrPageSizes[0], + height: arrPageSizes[1] + }).fadeIn(); + // Get page scroll + var arrPageScroll = ___getPageScroll(); + // Calculate top and left offset for the jquery-lightbox div object and show it + $('#jquery-lightbox').css({ + top: arrPageScroll[1] + (arrPageSizes[3] / 10), + left: arrPageScroll[0] + }).show(); + // Assigning click events in elements to close overlay + $('#jquery-overlay,#jquery-lightbox').click(function() { + _finish(); + }); + // Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects + $('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() { + _finish(); + return false; + }); + // If window was resized, calculate the new overlay dimensions + $(window).resize(function() { + // Get page sizes + var arrPageSizes = ___getPageSize(); + // Style overlay and show it + $('#jquery-overlay').css({ + width: arrPageSizes[0], + height: arrPageSizes[1] + }); + // Get page scroll + var arrPageScroll = ___getPageScroll(); + // Calculate top and left offset for the jquery-lightbox div object and show it + $('#jquery-lightbox').css({ + top: arrPageScroll[1] + (arrPageSizes[3] / 10), + left: arrPageScroll[0] + }); + }); + } + /** + * Prepares image exibition; doing a image\xB4s preloader to calculate it\xB4s size + * + */ + function _set_image_to_view() { // show the loading + // Show the loading + $('#lightbox-loading').show(); + if ( settings.fixedNavigation ) { + $('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); + } else { + // Hide some elements + $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); + } + // Image preload process + var objImagePreloader = new Image(); + objImagePreloader.onload = function() { + $('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]); + // Perfomance an effect in the image container resizing it + _resize_container_image_box(objImagePreloader.width,objImagePreloader.height); + // clear onLoad, IE behaves irratically with animated gifs otherwise + objImagePreloader.onload=function(){}; + }; + objImagePreloader.src = settings.imageArray[settings.activeImage][0]; + }; + /** + * Perfomance an effect in the image container resizing it + * + * @param integer intImageWidth The image\xB4s width that will be showed + * @param integer intImageHeight The image\xB4s height that will be showed + */ + function _resize_container_image_box(intImageWidth,intImageHeight) { + // Get current width and height + var intCurrentWidth = $('#lightbox-container-image-box').width(); + var intCurrentHeight = $('#lightbox-container-image-box').height(); + // Get the width and height of the selected image plus the padding + var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the image\xB4s width and the left and right padding value + var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image\xB4s height and the left and right padding value + // Diferences + var intDiffW = intCurrentWidth - intWidth; + var intDiffH = intCurrentHeight - intHeight; + // Perfomance the effect + $('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); }); + if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) { + if ( $.browser.msie ) { + ___pause(250); + } else { + ___pause(100); + } + } + $('#lightbox-container-image-data-box').css({ width: intImageWidth }); + $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) }); + }; + /** + * Show the prepared image + * + */ + function _show_image() { + $('#lightbox-loading').hide(); + $('#lightbox-image').fadeIn(function() { + _show_image_data(); + _set_navigation(); + }); + _preload_neighbor_images(); + }; + /** + * Show the image information + * + */ + function _show_image_data() { + $('#lightbox-container-image-data-box').slideDown('fast'); + $('#lightbox-image-details-caption').hide(); + if ( settings.imageArray[settings.activeImage][1] ) { + $('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show(); + } + // If we have a image set, display 'Image X of X' + if ( settings.imageArray.length > 1 ) { + $('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show(); + } + } + /** + * Display the button navigations + * + */ + function _set_navigation() { + $('#lightbox-nav').show(); + + // Instead to define this configuration in CSS file, we define here. And it\xB4s need to IE. Just. + $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); + + // Show the prev button, if not the first image in set + if ( settings.activeImage != 0 ) { + if ( settings.fixedNavigation ) { + $('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }) + .unbind() + .bind('click',function() { + settings.activeImage = settings.activeImage - 1; + _set_image_to_view(); + return false; + }); + } else { + // Show the images button for Next buttons + $('#lightbox-nav-btnPrev').unbind().hover(function() { + $(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }); + },function() { + $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); + }).show().bind('click',function() { + settings.activeImage = settings.activeImage - 1; + _set_image_to_view(); + return false; + }); + } + } + + // Show the next button, if not the last image in set + if ( settings.activeImage != ( settings.imageArray.length -1 ) ) { + if ( settings.fixedNavigation ) { + $('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }) + .unbind() + .bind('click',function() { + settings.activeImage = settings.activeImage + 1; + _set_image_to_view(); + return false; + }); + } else { + // Show the images button for Next buttons + $('#lightbox-nav-btnNext').unbind().hover(function() { + $(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }); + },function() { + $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); + }).show().bind('click',function() { + settings.activeImage = settings.activeImage + 1; + _set_image_to_view(); + return false; + }); + } + } + // Enable keyboard navigation + _enable_keyboard_navigation(); + } + /** + * Enable a support to keyboard navigation + * + */ + function _enable_keyboard_navigation() { + $(document).keydown(function(objEvent) { + _keyboard_action(objEvent); + }); + } + /** + * Disable the support to keyboard navigation + * + */ + function _disable_keyboard_navigation() { + $(document).unbind(); + } + /** + * Perform the keyboard actions + * + */ + function _keyboard_action(objEvent) { + // To ie + if ( objEvent == null ) { + keycode = event.keyCode; + escapeKey = 27; + // To Mozilla + } else { + keycode = objEvent.keyCode; + escapeKey = objEvent.DOM_VK_ESCAPE; + } + // Get the key in lower case form + key = String.fromCharCode(keycode).toLowerCase(); + // Verify the keys to close the ligthBox + if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) { + _finish(); + } + // Verify the key to show the previous image + if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) { + // If we\xB4re not showing the first image, call the previous + if ( settings.activeImage != 0 ) { + settings.activeImage = settings.activeImage - 1; + _set_image_to_view(); + _disable_keyboard_navigation(); + } + } + // Verify the key to show the next image + if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) { + // If we\xB4re not showing the last image, call the next + if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) { + settings.activeImage = settings.activeImage + 1; + _set_image_to_view(); + _disable_keyboard_navigation(); + } + } + } + /** + * Preload prev and next images being showed + * + */ + function _preload_neighbor_images() { + if ( (settings.imageArray.length -1) > settings.activeImage ) { + objNext = new Image(); + objNext.src = settings.imageArray[settings.activeImage + 1][0]; + } + if ( settings.activeImage > 0 ) { + objPrev = new Image(); + objPrev.src = settings.imageArray[settings.activeImage -1][0]; + } + } + /** + * Remove jQuery lightBox plugin HTML markup + * + */ + function _finish() { + $('#jquery-lightbox').remove(); + $('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); }); + // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay. + $('embed, object, select').css({ 'visibility' : 'visible' }); + } + /** + / THIRD FUNCTION + * getPageSize() by quirksmode.com + * + * @return Array Return an array with page width, height and window width, height + */ + function ___getPageSize() { + var xScroll, yScroll; + if (window.innerHeight && window.scrollMaxY) { + xScroll = window.innerWidth + window.scrollMaxX; + yScroll = window.innerHeight + window.scrollMaxY; + } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac + xScroll = document.body.scrollWidth; + yScroll = document.body.scrollHeight; + } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari + xScroll = document.body.offsetWidth; + yScroll = document.body.offsetHeight; + } + var windowWidth, windowHeight; + if (self.innerHeight) { // all except Explorer + if(document.documentElement.clientWidth){ + windowWidth = document.documentElement.clientWidth; + } else { + windowWidth = self.innerWidth; + } + windowHeight = self.innerHeight; + } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode + windowWidth = document.documentElement.clientWidth; + windowHeight = document.documentElement.clientHeight; + } else if (document.body) { // other Explorers + windowWidth = document.body.clientWidth; + windowHeight = document.body.clientHeight; + } + // for small pages with total height less then height of the viewport + if(yScroll < windowHeight){ + pageHeight = windowHeight; + } else { + pageHeight = yScroll; + } + // for small pages with total width less then width of the viewport + if(xScroll < windowWidth){ + pageWidth = xScroll; + } else { + pageWidth = windowWidth; + } + arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); + return arrayPageSize; + }; + /** + / THIRD FUNCTION + * getPageScroll() by quirksmode.com + * + * @return Array Return an array with x,y page scroll values. + */ + function ___getPageScroll() { + var xScroll, yScroll; + if (self.pageYOffset) { + yScroll = self.pageYOffset; + xScroll = self.pageXOffset; + } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict + yScroll = document.documentElement.scrollTop; + xScroll = document.documentElement.scrollLeft; + } else if (document.body) {// all other Explorers + yScroll = document.body.scrollTop; + xScroll = document.body.scrollLeft; + } + arrayPageScroll = new Array(xScroll,yScroll); + return arrayPageScroll; + }; + /** + * Stop the code execution from a escified time in milisecond + * + */ + function ___pause(ms) { + var date = new Date(); + curDate = null; + do { var curDate = new Date(); } + while ( curDate - date < ms); + }; + // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once + return this.unbind('click').click(_initialize); + }; +})(jQuery); // Call and execute the function immediately passing the jQuery object \ No newline at end of file Added: avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.pack.js =================================================================== --- avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.pack.js (rev 0) +++ avatars_plugin/branches/2.2.7/includes/jquerylightbox/js/jquery.lightbox-0.5.pack.js 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,14 @@ +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.5.js + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.5 + * @date April 11, 2008 + * @category jQuery plugin + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ +eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<I.B;i++){4.h.1J(v 1m(I[i].17(\'J\'),I[i].17(\'2v\')))}}2n(4.h[4.9][0]!=1e.17(\'J\')){4.9++}D()}6 1O(){$(\'m\').31(\'<e g="q-13"></e><e g="q-5"><e g="5-s-b-w"><e g="5-s-b"><1w g="5-b"><e 2V="" g="5-k"><a J="#" g="5-k-V"></a><a J="#" g="5-k-X"></a></e><e g="5-Y"><a J="#" g="5-Y-29"><1w W="\'+4.1M+\'"></a></e></e></e><e g="5-s-b-T-w"><e g="5-s-b-T"><e g="5-b-A"><1i g="5-b-A-1t"></1i><1i g="5-b-A-1g"></1i></e><e g="5-1s"><a J="#" g="5-1s-22"><1w W="\'+4.1W+\'"></a></e></e></e></e>\');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r<H){1z=H}j{1z=r}7(o<y){1B=o}j{1B=y}21=v 1m(1B,1z,y,H);u 21};6 1p(){f o,r;7(Z.1Z){r=Z.1Z;o=Z.2M}j 7(d.t&&d.t.1F){r=d.t.1F;o=d.t.1Y}j 7(d.m){r=d.m.1F;o=d.m.1Y}2q=v 1m(o,r);u 2q};6 1H(2C){f 2x=v 2w();1q=2h;3h{f 1q=v 2w()}2n(1q-2x<2C)};u N.11(\'C\').C(20)}})(23);',62,204,'||||settings|lightbox|function|if||activeImage||image||document|div|var|id|imageArray||else|nav|css|body||xScroll||jquery|yScroll|container|documentElement|return|new|box||windowWidth|arrPageSizes|details|length|click|_set_image_to_view|show|false|window|windowHeight|jQueryMatchedObj|href|background|no|url|this|repeat|height|objImagePreloader|arrPageScroll|width|data|keycode|btnPrev|src|btnNext|loading|self||unbind|objEvent|overlay|key||gif|getAttribute|images|imageBlank|_finish|hide|left|fixedNavigation|objClicked|containerBorderSize|currentNumber|innerHeight|span|Image|bind|clientWidth|Array|intWidth|intImageWidth|___getPageScroll|curDate|intImageHeight|secNav|caption|btn|imageBtnPrev|img|escapeKey|intHeight|pageHeight|clientHeight|pageWidth|transparent|___getPageSize|imageBtnNext|scrollTop|_disable_keyboard_navigation|___pause|intDiffW|push|intCurrentHeight|intCurrentWidth|imageLoading|_resize_container_image_box|_set_interface|onload|visibility|select|object|top|embed|fadeIn|imageBtnClose|_start|scrollLeft|pageYOffset|_initialize|arrayPageSize|btnClose|jQuery|offsetHeight|scrollHeight|innerWidth||scrollMaxY|link|remove|objPrev|objNext|keyToNext|keyCode|keyToPrev|overlayOpacity|null|_keyboard_action|keyToClose|_enable_keyboard_navigation|right|hover|while|txtOf|html|arrayPageScroll|_preload_neighbor_images|txtImage|_set_navigation|_show_image_data|title|Date|date|_show_image|intDiffH|containerResizeSpeed|overlayBgColor|ms|attr|hidden|blank|resize|extend|close|opacity|backgroundColor|next|pageXOffset|fn|offsetWidth|scrollWidth|prev|scrollMaxX|visible|fadeOut|toLowerCase|style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{})) \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/demo_skin.zip =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/installation/demo_skin.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/installation/hack1.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/hack1.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/hack1.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,22 @@ + /** + * Event handler: Gets invoked before the main payload in the backoffice. + */ + function AdminBeginPayload() + { + } + + + /** + * Event handler: Gets invoked after the main payload in the backoffice. + */ + function AdminEndPayload() + { + } + + + /** + * Event handler: Gets invoked before the user profile update. + */ + function UserProfileUpdate() + { + } \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/hack2.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/hack2.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/hack2.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,27 @@ + /** + * Display the end of a payload block + * + * Note: it is possible to display several payload blocks on a single page. + * The first block uses the "sub" template, the others "block". + * @see disp_payload_begin() + */ + function disp_payload_end() + { + global $Plugins; + + if( empty($this->displayed_sub_end) ) + { + $Plugins->trigger_event( 'AdminEndPayload' ); + + $name = 'sub'; + $this->displayed_sub_end = 1; + } + else + { + $name = 'block'; + } + + $template = $this->get_template( $name ); + + echo $template['end']; + } \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/hack3.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/hack3.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/hack3.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,3 @@ + 'AdminBeginPayload' => '', + 'AdminEndPayload' => '', + 'UserProfileUpdate' => '', \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/hack4.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/hack4.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/hack4.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,3 @@ +$ProfileForm->end_fieldset(); + +$Plugins->trigger_event( 'UserProfileUpdate' ); \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/hack5.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/hack5.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/hack5.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,2 @@ +// Do the update: +$Plugins->trigger_event( 'UserProfileUpdate' ); \ No newline at end of file Added: avatars_plugin/branches/2.2.7/installation/install_b2evo-2.4.5.zip =================================================================== (Binary files differ) Property changes on: avatars_plugin/branches/2.2.7/installation/install_b2evo-2.4.5.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: avatars_plugin/branches/2.2.7/installation/installation.txt =================================================================== --- avatars_plugin/branches/2.2.7/installation/installation.txt (rev 0) +++ avatars_plugin/branches/2.2.7/installation/installation.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,20 @@ +==================================================== + Avatars Plugin (for b2evo 2.x) / By sam2kb - http://ru.b2evo.net +==================================================== + + INSTALLATION: + + A) Some files within b2evolution must be modified for the Avatars plugin to function correctly. + You can do this manually, or just replace the files with the files included in install_b2evo_v2.4.5.zip (For b2evo v2.4.2 and v2.4.5 only) + Demo evopress skin is included in demo_skin.zip + + For the manual approach: + 1. Around line 837, in /inc/plugins/_plugin.class.php, you will see the AdminBeginPayload function, make it look like hack1.txt + 2. Around line 503, in /skins_adm/_adminUI_general.class.php, you will see the disp_payload_end function, make it look like hack2.txt + 3. Around line 111, in /inc/plugins/model/_plugins_admin.class.php, you will see the first line of hack3.txt (AdminBeginPayload etc), make it look like hack3.txt + 4. Around line 103, in /skins/_profile.disp.php, you will see the first line of hack4.txt, make it look like hack4.txt + 5. Around line 107, in /htsrv/profile_update.php, you will see the first line of hack5.txt, make it look like hack5.txt + + B) Upload the 'avatars_plugin' folder to your 'plugins' directory. + + C) In the b2evo backoffice, go to "Global settings" -> "Plugins install" -> "Install new" -> Click "Install" for the "Avatars" Plugin. \ No newline at end of file Added: avatars_plugin/branches/2.2.7/locales/messages.pot =================================================================== --- avatars_plugin/branches/2.2.7/locales/messages.pot (rev 0) +++ avatars_plugin/branches/2.2.7/locales/messages.pot 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,378 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Francois PLANQUE +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@...>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://fplanque.net/\n"; +"POT-Creation-Date: 2008-10-19 17:42-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@...>\n" +"Language-Team: LANGUAGE <LL@...>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: _admin_area.php:31 +#: _profile_area.php:32 +msgid "Avatars" +msgstr "" + +#: _admin_area.php:59 +#: _profile_area.php:49 +msgid "Large Avatar" +msgstr "" + +#: _admin_area.php:61 +#: _admin_area.php:75 +#: _profile_area.php:51 +#: _profile_area.php:66 +msgid "Up to" +msgstr "" + +#: _admin_area.php:65 +msgid "Remove Large Avatar" +msgstr "" + +#: _admin_area.php:73 +#: _profile_area.php:64 +msgid "Small Avatar" +msgstr "" + +#: _admin_area.php:79 +msgid "Remove Small Avatar" +msgstr "" + +#: _avatars.plugin.php:89 +msgid "Let's you 'easily' add avatars/icons to various things." +msgstr "" + +#: _avatars.plugin.php:90 +msgid "Let's you 'easily' add avatars/icons to " +msgstr "" + +#: _avatars.plugin.php:120 +#, php-format +msgid "In order to display large avatars in lightbox you should select the \"standard\" lightbox version in %s!" +msgstr "" + +#: _avatars.plugin.php:176 +msgid "User Groups" +msgstr "" + +#: _avatars.plugin.php:177 +msgid "Disable avatars for these user groups. Separate by ," +msgstr "" + +#: _avatars.plugin.php:185 +msgid "Minimum User level" +msgstr "" + +#: _avatars.plugin.php:187 +msgid "Enable for all users." +msgstr "" + +#: _avatars.plugin.php:187 +msgid "Disable for all users." +msgstr "" + +#: _avatars.plugin.php:195 +msgid "Maximum file size" +msgstr "" + +#: _avatars.plugin.php:197 +msgid "KB" +msgstr "" + +#: _avatars.plugin.php:205 +msgid "Display default avatar" +msgstr "" + +#: _avatars.plugin.php:208 +msgid "Should the default avatar be displayed if no avatar exists?" +msgstr "" + +#: _avatars.plugin.php:212 +msgid "Use image resizing" +msgstr "" + +#: _avatars.plugin.php:216 +msgid "Should we use image resizing?" +msgstr "" + +#: _avatars.plugin.php:220 +msgid "Collapsed avatars area" +msgstr "" + +#: _avatars.plugin.php:223 +msgid "Should we display the admin avatars upload area collapsed?" +msgstr "" + +#: _avatars.plugin.php:227 +msgid "Display next avatar" +msgstr "" + +#: _avatars.plugin.php:230 +msgid "If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar." +msgstr "" + +#: _avatars.plugin.php:234 +msgid "Display next default image" +msgstr "" + +#: _avatars.plugin.php:237 +msgid "If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>." +msgstr "" + +#: _avatars.plugin.php:249 +msgid "Image settings" +msgstr "" + +#: _avatars.plugin.php:253 +msgid "Large avatar JPEG quality" +msgstr "" + +#: _avatars.plugin.php:263 +msgid "Large avatar image re-size mode" +msgstr "" + +#: _avatars.plugin.php:268 +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:297 +#: _avatars.plugin.php:304 +msgid "None" +msgstr "" + +#: _avatars.plugin.php:269 +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:298 +#: _avatars.plugin.php:305 +msgid "Area" +msgstr "" + +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:304 +msgid "No Resizing Occurs" +msgstr "" + +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:305 +msgid "Image is resized proportionally to fit within the given area" +msgstr "" + +#: _avatars.plugin.php:282 +msgid "Small avatar JPEG quality" +msgstr "" + +#: _avatars.plugin.php:284 +msgid "%" +msgstr "" + +#: _avatars.plugin.php:292 +msgid "Small avatar image re-size mode" +msgstr "" + +#: _avatars.plugin.php:319 +msgid "Avatar sizes (Optional)" +msgstr "" + +#: _avatars.plugin.php:324 +msgid "Large avatars" +msgstr "" + +#: _avatars.plugin.php:328 +#: _avatars.plugin.php:425 +msgid "User avatar width" +msgstr "" + +#: _avatars.plugin.php:331 +#: _avatars.plugin.php:342 +#: _avatars.plugin.php:353 +#: _avatars.plugin.php:364 +#: _avatars.plugin.php:375 +#: _avatars.plugin.php:386 +#: _avatars.plugin.php:397 +#: _avatars.plugin.php:408 +#: _avatars.plugin.php:428 +#: _avatars.plugin.php:439 +#: _avatars.plugin.php:450 +#: _avatars.plugin.php:461 +#: _avatars.plugin.php:472 +#: _avatars.plugin.php:483 +#: _avatars.plugin.php:494 +#: _avatars.plugin.php:505 +msgid "Pixels" +msgstr "" + +#: _avatars.plugin.php:339 +#: _avatars.plugin.php:436 +msgid "User avatar height" +msgstr "" + +#: _avatars.plugin.php:350 +#: _avatars.plugin.php:447 +msgid "Blog avatar width" +msgstr "" + +#: _avatars.plugin.php:361 +#: _avatars.plugin.php:458 +msgid "Blog avatar height" +msgstr "" + +#: _avatars.plugin.php:372 +#: _avatars.plugin.php:469 +msgid "Category avatar width" +msgstr "" + +#: _avatars.plugin.php:383 +#: _avatars.plugin.php:480 +msgid "Category avatar height" +msgstr "" + +#: _avatars.plugin.php:394 +#: _avatars.plugin.php:491 +msgid "Post avatar width" +msgstr "" + +#: _avatars.plugin.php:405 +#: _avatars.plugin.php:502 +msgid "Post avatar height" +msgstr "" + +#: _avatars.plugin.php:421 +msgid "Small avatars" +msgstr "" + +#: _avatars.plugin.php:547 +#, php-format +msgid "You must create the following directories with write permissions (777):%s" +msgstr "" + +#: _avatars.plugin.php:554 +#, php-format +msgid "You must copy the file default.jpg from \"avatars_plugin/includes/\" to %s" +msgstr "" + +#: _avatars.plugin.php:1005 +#: _avatars.plugin.php:1032 +#: _avatars.plugin.php:1045 +#, php-format +msgid "Put this %s avatars code in posts loop, usually in %s, in %s or in %s" +msgstr "" + +#: _avatars.plugin.php:1019 +#, php-format +msgid "Put this %s avatars code in comments loop, usually in %s" +msgstr "" + +#: _avatars.plugin.php:1138 +msgid "The image you tried to upload is not of an acceptable extension" +msgstr "" + +#: _avatars.plugin.php:1142 +#, php-format +msgid "The maximum allowed file size is %s KB." +msgstr "" + +#: _avatars.plugin.php:1173 +msgid "Succesfully uploaded the image" +msgstr "" + +#: _avatars.plugin.php:1177 +#: _avatars.plugin.php:1182 +msgid "Failed to upload the image" +msgstr "" + +#: _avatars.plugin.php:1310 +#: _avatars.plugin.php:1326 +#, php-format +msgid "Successfully deleted the %s avatar image." +msgstr "" + +#: _avatars.plugin.php:1316 +#: _avatars.plugin.php:1332 +#, php-format +msgid "Failed to delete the %s avatar image." +msgstr "" + +#: _avatars.plugin.php:1451 +#: _avatars.plugin.php:1533 +#, php-format +msgid "Successfully created the %s avatar." +msgstr "" + +#: _avatars.plugin.php:1455 +#: _avatars.plugin.php:1535 +#, php-format +msgid "Failed writing the %s avatar." +msgstr "" + +#: _avatars.plugin.php:1461 +#: _avatars.plugin.php:1540 +#, php-format +msgid "Failed to create the %s avatar." +msgstr "" + +#: _avatars.plugin.php:1468 +#: _avatars.plugin.php:1486 +#: _avatars.plugin.php:1547 +#: _avatars.plugin.php:1565 +#, php-format +msgid "Failed to delete the temporary %s avatar image." +msgstr "" + +#: _avatars.plugin.php:1478 +#: _avatars.plugin.php:1557 +#, php-format +msgid "Successfully moved the %s avatar to it's correct location. [ %d ]" +msgstr "" + +#: _avatars.plugin.php:1482 +#: _avatars.plugin.php:1561 +#, php-format +msgid "Failed to move the %s avatar image to it's correct location." +msgstr "" + +#: _avatars.plugin.php:1632 +msgid "Successfully copied the large avatar image for use for the small avatar image." +msgstr "" + +#: _avatars.plugin.php:1635 +msgid "Unsuccessfully copied the large avatar image for use for the small avatar image." +msgstr "" + +#: _avatars.plugin.php:1640 +msgid "No small avatar exists! And no large avatar exists to use for the small avatar either!" +msgstr "" + +#: _avatars.plugin.php:1797 +msgid "Successfully removed all avatars." +msgstr "" + +#: _avatars.plugin.php:1797 +msgid "Failed deleting all avatars for this plugin." +msgstr "" + +#: _avatars.plugin.php:1804 +msgid "All avatars were kept." +msgstr "" + +#: _avatars.plugin.php:1827 +msgid "Permanently delete any avatars?" +msgstr "" + +#: _avatars.plugin.php:2293 +msgid "Image" +msgstr "" + +#: _avatars.plugin.php:2294 +msgid "of" +msgstr "" + +#: _profile_area.php:57 +#: _profile_area.php:72 +msgid "Remove Avatar" +msgstr "" Added: avatars_plugin/branches/2.2.7/locales/ru_RU/LC_MESSAGES/messages.po =================================================================== --- avatars_plugin/branches/2.2.7/locales/ru_RU/LC_MESSAGES/messages.po (rev 0) +++ avatars_plugin/branches/2.2.7/locales/ru_RU/LC_MESSAGES/messages.po 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,404 @@ +msgid "" +msgstr "" +"Project-Id-Version: Avatars plugin 2.2.6\n" +"Report-Msgid-Bugs-To: http://fplanque.net/\n"; +"POT-Creation-Date: 2008-10-19 17:42-0400\n" +"PO-Revision-Date: 2008-10-19 17:44-0500\n" +"Last-Translator: Alex\n" +"Language-Team: Russian b2evolution\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Russian\n" +"X-Poedit-Country: RUSSIAN FEDERATION\n" + +#: _admin_area.php:31 +#: _profile_area.php:32 +msgid "Avatars" +msgstr "Аватары" + +#: _admin_area.php:59 +#: _profile_area.php:49 +msgid "Large Avatar" +msgstr "Большой аватар" + +#: _admin_area.php:61 +#: _admin_area.php:75 +#: _profile_area.php:51 +#: _profile_area.php:66 +msgid "Up to" +msgstr "Макс." + +#: _admin_area.php:65 +msgid "Remove Large Avatar" +msgstr "Удалить большой аватар" + +#: _admin_area.php:73 +#: _profile_area.php:64 +msgid "Small Avatar" +msgstr "Маленький аватар" + +#: _admin_area.php:79 +msgid "Remove Small Avatar" +msgstr "Удалить маленикий аватар" + +#: _avatars.plugin.php:89 +msgid "Let's you 'easily' add avatars/icons to various things." +msgstr "Позволяет использовать аватары" + +#: _avatars.plugin.php:90 +msgid "Let's you 'easily' add avatars/icons to " +msgstr "Работает со следующими типами изображений:" + +#: _avatars.plugin.php:120 +#, php-format +msgid "In order to display large avatars in lightbox you should select the \"standard\" lightbox version in %s!" +msgstr "Для отображения больших аватаров с использованием \"lightbox\" вы должны выбрать стандартную версию lightbox \"standard\" в настройках плагина %s!" + +#: _avatars.plugin.php:176 +msgid "User Groups" +msgstr "Группы пользователей" + +#: _avatars.plugin.php:177 +msgid "Disable avatars for these user groups. Separate by ," +msgstr "Отключить аватары для этих групп. Группы разделяйте запятыми." + +#: _avatars.plugin.php:185 +msgid "Minimum User level" +msgstr "Минимальный уровень пользователя" + +#: _avatars.plugin.php:187 +msgid "Enable for all users." +msgstr "Разрешить всем пользователям." + +#: _avatars.plugin.php:187 +msgid "Disable for all users." +msgstr "Запретить всем пользователям." + +#: _avatars.plugin.php:195 +msgid "Maximum file size" +msgstr "Максимальный размер файла для загрузки" + +#: _avatars.plugin.php:197 +msgid "KB" +msgstr "Кб" + +#: _avatars.plugin.php:205 +msgid "Display default avatar" +msgstr "Отображать аватар по умолчанию" + +#: _avatars.plugin.php:208 +msgid "Should the default avatar be displayed if no avatar exists?" +msgstr "Должен ли быть показан аватар по умолчанию при отсутствии аватара пользователя?" + +#: _avatars.plugin.php:212 +msgid "Use image resizing" +msgstr "Использовать изменение размера изображений" + +#: _avatars.plugin.php:216 +msgid "Should we use image resizing?" +msgstr "Должны ли мы использовать изменение размера изображений?" + +#: _avatars.plugin.php:220 +msgid "Collapsed avatars area" +msgstr "Свернутая панель аватаров" + +#: _avatars.plugin.php:223 +msgid "Should we display the admin avatars upload area collapsed?" +msgstr "Должны ли мы показывать панель загрузки аватаров свернутой?" + +#: _avatars.plugin.php:227 +msgid "Display next avatar" +msgstr "Отображать следующий аватар" + +#: _avatars.plugin.php:230 +msgid "If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar." +msgstr "В случае когда ни аватара записи ни картинки по умолчанию для записей не загружено - показывать аватар категории, если и его нет - показывать аватар блога." + +#: _avatars.plugin.php:234 +msgid "Display next default image" +msgstr "Отображать следующую картинку по умолчанию" + +#: _avatars.plugin.php:237 +msgid "If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>." +msgstr "В случае когда ни аватара записи ни картинки по умолчанию для записей не загружено - показывать картинку по умолчанию для категорий, если и ее нет - показывать картинку по умолчанию для блогов.<br /><br />ВНИМАНИЕ: Функция <b>Отображать следующую картинку по умолчанию</b> имеет больший приоритет чем <b>Отображать следующий аватар</b>." + +#: _avatars.plugin.php:249 +msgid "Image settings" +msgstr "Параметры изображений" + +#: _avatars.plugin.php:253 +msgid "Large avatar JPEG quality" +msgstr "JPEG качество большого аватара" + +#: _avatars.plugin.php:263 +msgid "Large avatar image re-size mode" +msgstr "Способ уменьшения большого аватара" + +#: _avatars.plugin.php:268 +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:297 +#: _avatars.plugin.php:304 +msgid "None" +msgstr "Не применять" + +#: _avatars.plugin.php:269 +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:298 +#: _avatars.plugin.php:305 +msgid "Area" +msgstr "Пропорционально" + +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:304 +msgid "No Resizing Occurs" +msgstr "Без уменьшения размеров" + +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:305 +msgid "Image is resized proportionally to fit within the given area" +msgstr "Изображение уменьшается пропорционально, вписываясь в заданные размеры" + +#: _avatars.plugin.php:282 +msgid "Small avatar JPEG quality" +msgstr "JPEG качество маленького аватара" + +#: _avatars.plugin.php:284 +msgid "%" +msgstr "%" + +#: _avatars.plugin.php:292 +msgid "Small avatar image re-size mode" +msgstr "Способ уменьшения маленького аватара" + +#: _avatars.plugin.php:319 +msgid "Avatar sizes (Optional)" +msgstr "Размеры аватаров (Дополнительно)" + +#: _avatars.plugin.php:324 +msgid "Large avatars" +msgstr "Большие аватары" + +#: _avatars.plugin.php:328 +#: _avatars.plugin.php:425 +msgid "User avatar width" +msgstr "Ширина аватара пользователя" + +#: _avatars.plugin.php:331 +#: _avatars.plugin.php:342 +#: _avatars.plugin.php:353 +#: _avatars.plugin.php:364 +#: _avatars.plugin.php:375 +#: _avatars.plugin.php:386 +#: _avatars.plugin.php:397 +#: _avatars.plugin.php:408 +#: _avatars.plugin.php:428 +#: _avatars.plugin.php:439 +#: _avatars.plugin.php:450 +#: _avatars.plugin.php:461 +#: _avatars.plugin.php:472 +#: _avatars.plugin.php:483 +#: _avatars.plugin.php:494 +#: _avatars.plugin.php:505 +msgid "Pixels" +msgstr "Пикселей" + +#: _avatars.plugin.php:339 +#: _avatars.plugin.php:436 +msgid "User avatar height" +msgstr "Высота аватара пользователя" + +#: _avatars.plugin.php:350 +#: _avatars.plugin.php:447 +msgid "Blog avatar width" +msgstr "Ширина аватара блога" + +#: _avatars.plugin.php:361 +#: _avatars.plugin.php:458 +msgid "Blog avatar height" +msgstr "Высота аватара блога" + +#: _avatars.plugin.php:372 +#: _avatars.plugin.php:469 +msgid "Category avatar width" +msgstr "Ширина аватара категории" + +#: _avatars.plugin.php:383 +#: _avatars.plugin.php:480 +msgid "Category avatar height" +msgstr "Высота аватара категории" + +#: _avatars.plugin.php:394 +#: _avatars.plugin.php:491 +msgid "Post avatar width" +msgstr "Ширина аватара записи" + +#: _avatars.plugin.php:405 +#: _avatars.plugin.php:502 +msgid "Post avatar height" +msgstr "Высота аватара записи" + +#: _avatars.plugin.php:421 +msgid "Small avatars" +msgstr "Маленькие аватары" + +#: _avatars.plugin.php:547 +#, php-format +msgid "You must create the following directories with write permissions (777):%s" +msgstr "Вы должны создать следующие директории с разрешениями на запись (777):%s" + +#: _avatars.plugin.php:554 +#, php-format +msgid "You must copy the file default.jpg from \"avatars_plugin/includes/\" to %s" +msgstr "Вы должны скопировать файл default.jpg из \"avatars_plugin/includes/\" в %s" + +#: _avatars.plugin.php:1005 +#: _avatars.plugin.php:1032 +#: _avatars.plugin.php:1045 +#, php-format +msgid "Put this %s avatars code in posts loop, usually in %s, in %s or in %s" +msgstr "Скопируйте этот код для %s аватаров в цикл записей (posts loop), обычно в файл %s или %s или %s" + +#: _avatars.plugin.php:1019 +#, php-format +msgid "Put this %s avatars code in comments loop, usually in %s" +msgstr "Скопируйте этот код для %s аватаров в цикл комментариев (comments loop), обычно в файл %s" + +#: _avatars.plugin.php:1138 +msgid "The image you tried to upload is not of an acceptable extension" +msgstr "Файл, который вы загружаете, должен иметь одно из следующих расширений" + +#: _avatars.plugin.php:1142 +#, php-format +msgid "The maximum allowed file size is %s KB." +msgstr "Максимальный размер загружаемого файла не должен превышать %s Кб." + +#: _avatars.plugin.php:1173 +msgid "Succesfully uploaded the image" +msgstr "Успешно загружено изображение" + +#: _avatars.plugin.php:1177 +#: _avatars.plugin.php:1182 +msgid "Failed to upload the image" +msgstr "Не удалось загрузить изображение" + +#: _avatars.plugin.php:1310 +#: _avatars.plugin.php:1326 +#, php-format +msgid "Successfully deleted the %s avatar image." +msgstr "Аватар успешно удален. ( %s )" + +#: _avatars.plugin.php:1316 +#: _avatars.plugin.php:1332 +#, php-format +msgid "Failed to delete the %s avatar image." +msgstr "Не удалось удалить аватар. ( %s )" + +#: _avatars.plugin.php:1451 +#: _avatars.plugin.php:1533 +#, php-format +msgid "Successfully created the %s avatar." +msgstr "Аватар успешно создан. ( %s )" + +#: _avatars.plugin.php:1455 +#: _avatars.plugin.php:1535 +#, php-format +msgid "Failed writing the %s avatar." +msgstr "Не удалось записать аватар. ( %s )" + +#: _avatars.plugin.php:1461 +#: _avatars.plugin.php:1540 +#, php-format +msgid "Failed to create the %s avatar." +msgstr "Не удалось создать аватар. ( %s )" + +#: _avatars.plugin.php:1468 +#: _avatars.plugin.php:1486 +#: _avatars.plugin.php:1547 +#: _avatars.plugin.php:1565 +#, php-format +msgid "Failed to delete the temporary %s avatar image." +msgstr "Не удалось удалить временный аватар. ( %s )" + +#: _avatars.plugin.php:1478 +#: _avatars.plugin.php:1557 +#, php-format +msgid "Successfully moved the %s avatar to it's correct location. [ %d ]" +msgstr "Аватар успешно перемещен. [ %d ]" + +#: _avatars.plugin.php:1482 +#: _avatars.plugin.php:1561 +#, php-format +msgid "Failed to move the %s avatar image to it's correct location." +msgstr "Не удалось переместить аватар. ( %s )" + +#: _avatars.plugin.php:1632 +msgid "Successfully copied the large avatar image for use for the small avatar image." +msgstr "Аватар успешно скопирован." + +#: _avatars.plugin.php:1635 +msgid "Unsuccessfully copied the large avatar image for use for the small avatar image." +msgstr "Не удалось скопировать аватар." + +#: _avatars.plugin.php:1640 +msgid "No small avatar exists! And no large avatar exists to use for the small avatar either!" +msgstr "Аватар не найден!" + +#: _avatars.plugin.php:1797 +msgid "Successfully removed all avatars." +msgstr "Все аватары были успешно удалены." + +#: _avatars.plugin.php:1797 +msgid "Failed deleting all avatars for this plugin." +msgstr "Не удалось удалить аватары." + +#: _avatars.plugin.php:1804 +msgid "All avatars were kept." +msgstr "Аватары были сохранены." + +#: _avatars.plugin.php:1827 +msgid "Permanently delete any avatars?" +msgstr "Удалить все аватары." + +#: _avatars.plugin.php:2293 +msgid "Image" +msgstr "Изображение" + +#: _avatars.plugin.php:2294 +msgid "of" +msgstr "из" + +#: _profile_area.php:57 +#: _profile_area.php:72 +msgid "Remove Avatar" +msgstr "Удалить аватар" + +#~ msgid "Avatar" +#~ msgstr "Аватар" +#~ msgid "0 - 11<br />[ 0 - Enable for all ]<br />[ 11 - Disable for all ]" +#~ msgstr "0 - 11<br />[ 0 - Разрешить всем ]<br />[ 11 - Запретить всем ]" +#~ msgid "KB.<br />[ 10 - 3000 ]" +#~ msgstr "Кб.<br />[ 10 - 3000 ]" +#~ msgid "Small avatar width" +#~ msgstr "Ширина маленького аватара" +#~ msgid "Small avatar height" +#~ msgstr "Высота маленького аватара" +#~ msgid "User avatar" +#~ msgstr "Пользователь" +#~ msgid "Update this avatar" +#~ msgstr "Обновить этот аватар" +#~ msgid "Blog avatar" +#~ msgstr "Блог" +#~ msgid "Avatar image" +#~ msgstr "Размер изображения" +#~ msgid "Up to " +#~ msgstr "Макс. " +#~ msgid "Show Support?" +#~ msgstr "Показать ссылку поддержки?" +#~ msgid "Adds a credit link for this plugin." +#~ msgstr "Добавить ссылку автора к плагину." +#~ msgid "Successfully deleted the large avatar image." +#~ msgstr "Аватар успешно удален." +#~ msgid "Failed to delete the large avatar image." +#~ msgstr "Не удалось удалить аватар." + Added: avatars_plugin/branches/2.2.7/locales/ru_RU/_global.php =================================================================== --- avatars_plugin/branches/2.2.7/locales/ru_RU/_global.php (rev 0) +++ avatars_plugin/branches/2.2.7/locales/ru_RU/_global.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,86 @@ +<?php +/* + * Global lang file + * This file was generated automatically from messages.po + */ +if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); + + +$trans['ru_RU'] = array( + '' => "Project-Id-Version: Avatars plugin 2.2.7\nReport-Msgid-Bugs-To: http://fplanque.net/\nPOT-Creation-Date: 2008-10-19 17:42-0400\nPO-Revision-Date: 2008-10-19 17:44-0500\nLast-Translator: Alex\nLanguage-Team: Russian b2evolution\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nX-Poedit-Language: Russian\nX-Poedit-Country: RUSSIAN FEDERATION\n", + 'Avatars' => "Аватары", + 'Large Avatar' => "Большой аватар", + 'Up to' => "Макс.", + 'Remove Large Avatar' => "Удалить большой аватар", + 'Small Avatar' => "Маленький аватар", + 'Remove Small Avatar' => "Удалить маленикий аватар", + 'Let\'s you \'easily\' add avatars/icons to various things.' => "Позволяет использовать аватары", + 'Let\'s you \'easily\' add avatars/icons to ' => "Работает со следующими типами изображений:", + 'In order to display large avatars in lightbox you should select the "standard" lightbox version in %s!' => "Для отображения больших аватаров с использованием \"lightbox\" вы должны выбрать стандартную версию lightbox \"standard\" в настройках плагина %s!", + 'User Groups' => "Группы пользователей", + 'Disable avatars for these user groups. Separate by ,' => "Отключить аватары для этих групп. Группы разделяйте запятыми.", + 'Minimum User level' => "Минимальный уровень пользователя", + 'Enable for all users.' => "Разрешить всем пользователям.", + 'Disable for all users.' => "Запретить всем пользователям.", + 'Maximum file size' => "Максимальный размер файла для загрузки", + 'KB' => "Кб", + 'Display default avatar' => "Отображать аватар по умолчанию", + 'Should the default avatar be displayed if no avatar exists?' => "Должен ли быть показан аватар по умолчанию при отсутствии аватара пользователя?", + 'Use image resizing' => "Использовать изменение размера изображений", + 'Should we use image resizing?' => "Должны ли мы использовать изменение размера изображений?", + 'Collapsed avatars area' => "Свернутая панель аватаров", + 'Should we display the admin avatars upload area collapsed?' => "Должны ли мы показывать панель загрузки аватаров свернутой?", + 'Display next avatar' => "Отображать следующий аватар", + 'If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar.' => "В случае когда ни аватара записи ни картинки по умолчанию для записей не загружено - показывать аватар категории, если и его нет - показывать аватар блога.", + 'Display next default image' => "Отображать следующую картинку по умолчанию", + 'If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>.' => "В случае когда ни аватара записи ни картинки по умолчанию для записей не загружено - показывать картинку по умолчанию для категорий, если и ее нет - показывать картинку по умолчанию для блогов.<br /><br />ВНИМАНИЕ: Функция <b>Отображать следующую картинку по умолчанию</b> имеет больший приоритет чем <b>Отображать следующий аватар</b>.", + 'Image settings' => "Параметры изображений", + 'Large avatar JPEG quality' => "JPEG качество большого аватара", + 'Large avatar image re-size mode' => "Способ уменьшения большого аватара", + 'None' => "Не применять", + 'Area' => "Пропорционально", + 'No Resizing Occurs' => "Без уменьшения размеров", + 'Image is resized proportionally to fit within the given area' => "Изображение уменьшается пропорционально, вписываясь в заданные размеры", + 'Small avatar JPEG quality' => "JPEG качество маленького аватара", + '%' => "%", + 'Small avatar image re-size mode' => "Способ уменьшения маленького аватара", + 'Avatar sizes (Optional)' => "Размеры аватаров (Дополнительно)", + 'Large avatars' => "Большие аватары", + 'User avatar width' => "Ширина аватара пользователя", + 'Pixels' => "Пикселей", + 'User avatar height' => "Высота аватара пользователя", + 'Blog avatar width' => "Ширина аватара блога", + 'Blog avatar height' => "Высота аватара блога", + 'Category avatar width' => "Ширина аватара категории", + 'Category avatar height' => "Высота аватара категории", + 'Post avatar width' => "Ширина аватара записи", + 'Post avatar height' => "Высота аватара записи", + 'Small avatars' => "Маленькие аватары", + 'You must create the following directories with write permissions (777):%s' => "Вы должны создать следующие директории с разрешениями на запись (777):%s", + 'You must copy the file default.jpg from "avatars_plugin/includes/" to %s' => "Вы должны скопировать файл default.jpg из \"avatars_plugin/includes/\" в %s", + 'Put this %s avatars code in posts loop, usually in %s, in %s or in %s' => "Скопируйте этот код для %s аватаров в цикл записей (posts loop), обычно в файл %s или %s или %s", + 'Put this %s avatars code in comments loop, usually in %s' => "Скопируйте этот код для %s аватаров в цикл комментариев (comments loop), обычно в файл %s", + 'The image you tried to upload is not of an acceptable extension' => "Файл, который вы загружаете, должен иметь одно из следующих расширений", + 'The maximum allowed file size is %s KB.' => "Максимальный размер загружаемого файла не должен превышать %s Кб.", + 'Succesfully uploaded the image' => "Успешно загружено изображение", + 'Failed to upload the image' => "Не удалось загрузить изображение", + 'Successfully deleted the %s avatar image.' => "Аватар успешно удален. ( %s )", + 'Failed to delete the %s avatar image.' => "Не удалось удалить аватар. ( %s )", + 'Successfully created the %s avatar.' => "Аватар успешно создан. ( %s )", + 'Failed writing the %s avatar.' => "Не удалось записать аватар. ( %s )", + 'Failed to create the %s avatar.' => "Не удалось создать аватар. ( %s )", + 'Failed to delete the temporary %s avatar image.' => "Не удалось удалить временный аватар. ( %s )", + 'Successfully moved the %s avatar to it\'s correct location. [ %d ]' => "Аватар успешно перемещен. [ %d ]", + 'Failed to move the %s avatar image to it\'s correct location.' => "Не удалось переместить аватар. ( %s )", + 'Successfully copied the large avatar image for use for the small avatar image.' => "Аватар успешно скопирован.", + 'Unsuccessfully copied the large avatar image for use for the small avatar image.' => "Не удалось скопировать аватар.", + 'No small avatar exists! And no large avatar exists to use for the small avatar either!' => "Аватар не найден!", + 'Successfully removed all avatars.' => "Все аватары были успешно удалены.", + 'Failed deleting all avatars for this plugin.' => "Не удалось удалить аватары.", + 'All avatars were kept.' => "Аватары были сохранены.", + 'Permanently delete any avatars?' => "Удалить все аватары.", + 'Image' => "Изображение", + 'of' => "из", + 'Remove Avatar' => "Удалить аватар", +); +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/LC_MESSAGES/messages.po =================================================================== --- avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/LC_MESSAGES/messages.po (rev 0) +++ avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/LC_MESSAGES/messages.po 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,404 @@ +msgid "" +msgstr "" +"Project-Id-Version: Avatars plugin 2.2.6\n" +"Report-Msgid-Bugs-To: http://fplanque.net/\n"; +"POT-Creation-Date: 2008-10-19 17:42-0400\n" +"PO-Revision-Date: 2008-10-19 17:44-0500\n" +"Last-Translator: Alex\n" +"Language-Team: Russian b2evolution\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=windows-1251\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Russian\n" +"X-Poedit-Country: RUSSIAN FEDERATION\n" + +#: _admin_area.php:31 +#: _profile_area.php:32 +msgid "Avatars" +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0\xFB" + +#: _admin_area.php:59 +#: _profile_area.php:49 +msgid "Large Avatar" +msgstr "\xC1\xEE\xEB\xFC\xF8\xEE\xE9 \xE0\xE2\xE0\xF2\xE0\xF0" + +#: _admin_area.php:61 +#: _admin_area.php:75 +#: _profile_area.php:51 +#: _profile_area.php:66 +msgid "Up to" +msgstr "\xCC\xE0\xEA\xF1." + +#: _admin_area.php:65 +msgid "Remove Large Avatar" +msgstr "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE1\xEE\xEB\xFC\xF8\xEE\xE9 \xE0\xE2\xE0\xF2\xE0\xF0" + +#: _admin_area.php:73 +#: _profile_area.php:64 +msgid "Small Avatar" +msgstr "\xCC\xE0\xEB\xE5\xED\xFC\xEA\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0" + +#: _admin_area.php:79 +msgid "Remove Small Avatar" +msgstr "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xEC\xE0\xEB\xE5\xED\xE8\xEA\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0" + +#: _avatars.plugin.php:89 +msgid "Let's you 'easily' add avatars/icons to various things." +msgstr "\xCF\xEE\xE7\xE2\xEE\xEB\xFF\xE5\xF2 \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB" + +#: _avatars.plugin.php:90 +msgid "Let's you 'easily' add avatars/icons to " +msgstr "\xD0\xE0\xE1\xEE\xF2\xE0\xE5\xF2 \xF1\xEE \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xEC\xE8 \xF2\xE8\xEF\xE0\xEC\xE8 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9:" + +#: _avatars.plugin.php:120 +#, php-format +msgid "In order to display large avatars in lightbox you should select the \"standard\" lightbox version in %s!" +msgstr "\xC4\xEB\xFF \xEE\xF2\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xFF \xE1\xEE\xEB\xFC\xF8\xE8\xF5 \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xF1 \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xED\xE8\xE5\xEC \"lightbox\" \xE2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xE2\xFB\xE1\xF0\xE0\xF2\xFC \xF1\xF2\xE0\xED\xE4\xE0\xF0\xF2\xED\xF3\xFE \xE2\xE5\xF0\xF1\xE8\xFE lightbox \"standard\" \xE2 \xED\xE0\xF1\xF2\xF0\xEE\xE9\xEA\xE0\xF5 \xEF\xEB\xE0\xE3\xE8\xED\xE0 %s!" + +#: _avatars.plugin.php:176 +msgid "User Groups" +msgstr "\xC3\xF0\xF3\xEF\xEF\xFB \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xE5\xE9" + +#: _avatars.plugin.php:177 +msgid "Disable avatars for these user groups. Separate by ," +msgstr "\xCE\xF2\xEA\xEB\xFE\xF7\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB \xE4\xEB\xFF \xFD\xF2\xE8\xF5 \xE3\xF0\xF3\xEF\xEF. \xC3\xF0\xF3\xEF\xEF\xFB \xF0\xE0\xE7\xE4\xE5\xEB\xFF\xE9\xF2\xE5 \xE7\xE0\xEF\xFF\xF2\xFB\xEC\xE8." + +#: _avatars.plugin.php:185 +msgid "Minimum User level" +msgstr "\xCC\xE8\xED\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF3\xF0\xEE\xE2\xE5\xED\xFC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF" + +#: _avatars.plugin.php:187 +msgid "Enable for all users." +msgstr "\xD0\xE0\xE7\xF0\xE5\xF8\xE8\xF2\xFC \xE2\xF1\xE5\xEC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF\xEC." + +#: _avatars.plugin.php:187 +msgid "Disable for all users." +msgstr "\xC7\xE0\xEF\xF0\xE5\xF2\xE8\xF2\xFC \xE2\xF1\xE5\xEC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF\xEC." + +#: _avatars.plugin.php:195 +msgid "Maximum file size" +msgstr "\xCC\xE0\xEA\xF1\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF0\xE0\xE7\xEC\xE5\xF0 \xF4\xE0\xE9\xEB\xE0 \xE4\xEB\xFF \xE7\xE0\xE3\xF0\xF3\xE7\xEA\xE8" + +#: _avatars.plugin.php:197 +msgid "KB" +msgstr "\xCA\xE1" + +#: _avatars.plugin.php:205 +msgid "Display default avatar" +msgstr "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE" + +#: _avatars.plugin.php:208 +msgid "Should the default avatar be displayed if no avatar exists?" +msgstr "\xC4\xEE\xEB\xE6\xE5\xED \xEB\xE8 \xE1\xFB\xF2\xFC \xEF\xEE\xEA\xE0\xE7\xE0\xED \xE0\xE2\xE0\xF2\xE0\xF0 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xEF\xF0\xE8 \xEE\xF2\xF1\xF3\xF2\xF1\xF2\xE2\xE8\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF?" + +#: _avatars.plugin.php:212 +msgid "Use image resizing" +msgstr "\xC8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE8\xE7\xEC\xE5\xED\xE5\xED\xE8\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xE0 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9" + +#: _avatars.plugin.php:216 +msgid "Should we use image resizing?" +msgstr "\xC4\xEE\xEB\xE6\xED\xFB \xEB\xE8 \xEC\xFB \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE8\xE7\xEC\xE5\xED\xE5\xED\xE8\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xE0 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9?" + +#: _avatars.plugin.php:220 +msgid "Collapsed avatars area" +msgstr "\xD1\xE2\xE5\xF0\xED\xF3\xF2\xE0\xFF \xEF\xE0\xED\xE5\xEB\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2" + +#: _avatars.plugin.php:223 +msgid "Should we display the admin avatars upload area collapsed?" +msgstr "\xC4\xEE\xEB\xE6\xED\xFB \xEB\xE8 \xEC\xFB \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEF\xE0\xED\xE5\xEB\xFC \xE7\xE0\xE3\xF0\xF3\xE7\xEA\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xF1\xE2\xE5\xF0\xED\xF3\xF2\xEE\xE9?" + +#: _avatars.plugin.php:227 +msgid "Display next avatar" +msgstr "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0" + +#: _avatars.plugin.php:230 +msgid "If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar." +msgstr "\xC2 \xF1\xEB\xF3\xF7\xE0\xE5 \xEA\xEE\xE3\xE4\xE0 \xED\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8 \xED\xE8 \xEA\xE0\xF0\xF2\xE8\xED\xEA\xE8 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE7\xE0\xEF\xE8\xF1\xE5\xE9 \xED\xE5 \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8, \xE5\xF1\xEB\xE8 \xE8 \xE5\xE3\xEE \xED\xE5\xF2 - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xE1\xEB\xEE\xE3\xE0." + +#: _avatars.plugin.php:234 +msgid "Display next default image" +msgstr "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xF3\xFE \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE" + +#: _avatars.plugin.php:237 +msgid "If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>." +msgstr "\xC2 \xF1\xEB\xF3\xF7\xE0\xE5 \xEA\xEE\xE3\xE4\xE0 \xED\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8 \xED\xE8 \xEA\xE0\xF0\xF2\xE8\xED\xEA\xE8 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE7\xE0\xEF\xE8\xF1\xE5\xE9 \xED\xE5 \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE9, \xE5\xF1\xEB\xE8 \xE8 \xE5\xE5 \xED\xE5\xF2 - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE1\xEB\xEE\xE3\xEE\xE2.<br /><br />\xC2\xCD\xC8\xCC\xC0\xCD\xC8\xC5: \xD4\xF3\xED\xEA\xF6\xE8\xFF <b>\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xF3\xFE \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE</b> \xE8\xEC\xE5\xE5\xF2 \xE1\xEE\xEB\xFC\xF8\xE8\xE9 \xEF\xF0\xE8\xEE\xF0\xE8\xF2\xE5\xF2 \xF7\xE5\xEC <b>\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0</b>." + +#: _avatars.plugin.php:249 +msgid "Image settings" +msgstr "\xCF\xE0\xF0\xE0\xEC\xE5\xF2\xF0\xFB \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9" + +#: _avatars.plugin.php:253 +msgid "Large avatar JPEG quality" +msgstr "JPEG \xEA\xE0\xF7\xE5\xF1\xF2\xE2\xEE \xE1\xEE\xEB\xFC\xF8\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" + +#: _avatars.plugin.php:263 +msgid "Large avatar image re-size mode" +msgstr "\xD1\xEF\xEE\xF1\xEE\xE1 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xE1\xEE\xEB\xFC\xF8\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" + +#: _avatars.plugin.php:268 +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:297 +#: _avatars.plugin.php:304 +msgid "None" +msgstr "\xCD\xE5 \xEF\xF0\xE8\xEC\xE5\xED\xFF\xF2\xFC" + +#: _avatars.plugin.php:269 +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:298 +#: _avatars.plugin.php:305 +msgid "Area" +msgstr "\xCF\xF0\xEE\xEF\xEE\xF0\xF6\xE8\xEE\xED\xE0\xEB\xFC\xED\xEE" + +#: _avatars.plugin.php:275 +#: _avatars.plugin.php:304 +msgid "No Resizing Occurs" +msgstr "\xC1\xE5\xE7 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xF0\xE0\xE7\xEC\xE5\xF0\xEE\xE2" + +#: _avatars.plugin.php:276 +#: _avatars.plugin.php:305 +msgid "Image is resized proportionally to fit within the given area" +msgstr "\xC8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5 \xF3\xEC\xE5\xED\xFC\xF8\xE0\xE5\xF2\xF1\xFF \xEF\xF0\xEE\xEF\xEE\xF0\xF6\xE8\xEE\xED\xE0\xEB\xFC\xED\xEE, \xE2\xEF\xE8\xF1\xFB\xE2\xE0\xFF\xF1\xFC \xE2 \xE7\xE0\xE4\xE0\xED\xED\xFB\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xFB" + +#: _avatars.plugin.php:282 +msgid "Small avatar JPEG quality" +msgstr "JPEG \xEA\xE0\xF7\xE5\xF1\xF2\xE2\xEE \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" + +#: _avatars.plugin.php:284 +msgid "%" +msgstr "%" + +#: _avatars.plugin.php:292 +msgid "Small avatar image re-size mode" +msgstr "\xD1\xEF\xEE\xF1\xEE\xE1 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" + +#: _avatars.plugin.php:319 +msgid "Avatar sizes (Optional)" +msgstr "\xD0\xE0\xE7\xEC\xE5\xF0\xFB \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 (\xC4\xEE\xEF\xEE\xEB\xED\xE8\xF2\xE5\xEB\xFC\xED\xEE)" + +#: _avatars.plugin.php:324 +msgid "Large avatars" +msgstr "\xC1\xEE\xEB\xFC\xF8\xE8\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB" + +#: _avatars.plugin.php:328 +#: _avatars.plugin.php:425 +msgid "User avatar width" +msgstr "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF" + +#: _avatars.plugin.php:331 +#: _avatars.plugin.php:342 +#: _avatars.plugin.php:353 +#: _avatars.plugin.php:364 +#: _avatars.plugin.php:375 +#: _avatars.plugin.php:386 +#: _avatars.plugin.php:397 +#: _avatars.plugin.php:408 +#: _avatars.plugin.php:428 +#: _avatars.plugin.php:439 +#: _avatars.plugin.php:450 +#: _avatars.plugin.php:461 +#: _avatars.plugin.php:472 +#: _avatars.plugin.php:483 +#: _avatars.plugin.php:494 +#: _avatars.plugin.php:505 +msgid "Pixels" +msgstr "\xCF\xE8\xEA\xF1\xE5\xEB\xE5\xE9" + +#: _avatars.plugin.php:339 +#: _avatars.plugin.php:436 +msgid "User avatar height" +msgstr "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF" + +#: _avatars.plugin.php:350 +#: _avatars.plugin.php:447 +msgid "Blog avatar width" +msgstr "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE1\xEB\xEE\xE3\xE0" + +#: _avatars.plugin.php:361 +#: _avatars.plugin.php:458 +msgid "Blog avatar height" +msgstr "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE1\xEB\xEE\xE3\xE0" + +#: _avatars.plugin.php:372 +#: _avatars.plugin.php:469 +msgid "Category avatar width" +msgstr "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8" + +#: _avatars.plugin.php:383 +#: _avatars.plugin.php:480 +msgid "Category avatar height" +msgstr "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8" + +#: _avatars.plugin.php:394 +#: _avatars.plugin.php:491 +msgid "Post avatar width" +msgstr "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8" + +#: _avatars.plugin.php:405 +#: _avatars.plugin.php:502 +msgid "Post avatar height" +msgstr "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8" + +#: _avatars.plugin.php:421 +msgid "Small avatars" +msgstr "\xCC\xE0\xEB\xE5\xED\xFC\xEA\xE8\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB" + +#: _avatars.plugin.php:547 +#, php-format +msgid "You must create the following directories with write permissions (777):%s" +msgstr "\xC2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xF1\xEE\xE7\xE4\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE5 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xE8\xE8 \xF1 \xF0\xE0\xE7\xF0\xE5\xF8\xE5\xED\xE8\xFF\xEC\xE8 \xED\xE0 \xE7\xE0\xEF\xE8\xF1\xFC (777):%s" + +#: _avatars.plugin.php:554 +#, php-format +msgid "You must copy the file default.jpg from \"avatars_plugin/includes/\" to %s" +msgstr "\xC2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xF2\xFC \xF4\xE0\xE9\xEB default.jpg \xE8\xE7 \"avatars_plugin/includes/\" \xE2 %s" + +#: _avatars.plugin.php:1005 +#: _avatars.plugin.php:1032 +#: _avatars.plugin.php:1045 +#, php-format +msgid "Put this %s avatars code in posts loop, usually in %s, in %s or in %s" +msgstr "\xD1\xEA\xEE\xEF\xE8\xF0\xF3\xE9\xF2\xE5 \xFD\xF2\xEE\xF2 \xEA\xEE\xE4 \xE4\xEB\xFF %s \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xE2 \xF6\xE8\xEA\xEB \xE7\xE0\xEF\xE8\xF1\xE5\xE9 (posts loop), \xEE\xE1\xFB\xF7\xED\xEE \xE2 \xF4\xE0\xE9\xEB %s \xE8\xEB\xE8 %s \xE8\xEB\xE8 %s" + +#: _avatars.plugin.php:1019 +#, php-format +msgid "Put this %s avatars code in comments loop, usually in %s" +msgstr "\xD1\xEA\xEE\xEF\xE8\xF0\xF3\xE9\xF2\xE5 \xFD\xF2\xEE\xF2 \xEA\xEE\xE4 \xE4\xEB\xFF %s \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xE2 \xF6\xE8\xEA\xEB \xEA\xEE\xEC\xEC\xE5\xED\xF2\xE0\xF0\xE8\xE5\xE2 (comments loop), \xEE\xE1\xFB\xF7\xED\xEE \xE2 \xF4\xE0\xE9\xEB %s" + +#: _avatars.plugin.php:1138 +msgid "The image you tried to upload is not of an acceptable extension" +msgstr "\xD4\xE0\xE9\xEB, \xEA\xEE\xF2\xEE\xF0\xFB\xE9 \xE2\xFB \xE7\xE0\xE3\xF0\xF3\xE6\xE0\xE5\xF2\xE5, \xE4\xEE\xEB\xE6\xE5\xED \xE8\xEC\xE5\xF2\xFC \xEE\xE4\xED\xEE \xE8\xE7 \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xF5 \xF0\xE0\xF1\xF8\xE8\xF0\xE5\xED\xE8\xE9" + +#: _avatars.plugin.php:1142 +#, php-format +msgid "The maximum allowed file size is %s KB." +msgstr "\xCC\xE0\xEA\xF1\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF0\xE0\xE7\xEC\xE5\xF0 \xE7\xE0\xE3\xF0\xF3\xE6\xE0\xE5\xEC\xEE\xE3\xEE \xF4\xE0\xE9\xEB\xE0 \xED\xE5 \xE4\xEE\xEB\xE6\xE5\xED \xEF\xF0\xE5\xE2\xFB\xF8\xE0\xF2\xFC %s \xCA\xE1." + +#: _avatars.plugin.php:1173 +msgid "Succesfully uploaded the image" +msgstr "\xD3\xF1\xEF\xE5\xF8\xED\xEE \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5" + +#: _avatars.plugin.php:1177 +#: _avatars.plugin.php:1182 +msgid "Failed to upload the image" +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xE7\xE0\xE3\xF0\xF3\xE7\xE8\xF2\xFC \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5" + +#: _avatars.plugin.php:1310 +#: _avatars.plugin.php:1326 +#, php-format +msgid "Successfully deleted the %s avatar image." +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF3\xE4\xE0\xEB\xE5\xED. ( %s )" + +#: _avatars.plugin.php:1316 +#: _avatars.plugin.php:1332 +#, php-format +msgid "Failed to delete the %s avatar image." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )" + +#: _avatars.plugin.php:1451 +#: _avatars.plugin.php:1533 +#, php-format +msgid "Successfully created the %s avatar." +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF1\xEE\xE7\xE4\xE0\xED. ( %s )" + +#: _avatars.plugin.php:1455 +#: _avatars.plugin.php:1535 +#, php-format +msgid "Failed writing the %s avatar." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xE7\xE0\xEF\xE8\xF1\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )" + +#: _avatars.plugin.php:1461 +#: _avatars.plugin.php:1540 +#, php-format +msgid "Failed to create the %s avatar." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF1\xEE\xE7\xE4\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )" + +#: _avatars.plugin.php:1468 +#: _avatars.plugin.php:1486 +#: _avatars.plugin.php:1547 +#: _avatars.plugin.php:1565 +#, php-format +msgid "Failed to delete the temporary %s avatar image." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE2\xF0\xE5\xEC\xE5\xED\xED\xFB\xE9 \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )" + +#: _avatars.plugin.php:1478 +#: _avatars.plugin.php:1557 +#, php-format +msgid "Successfully moved the %s avatar to it's correct location. [ %d ]" +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xEF\xE5\xF0\xE5\xEC\xE5\xF9\xE5\xED. [ %d ]" + +#: _avatars.plugin.php:1482 +#: _avatars.plugin.php:1561 +#, php-format +msgid "Failed to move the %s avatar image to it's correct location." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xEF\xE5\xF0\xE5\xEC\xE5\xF1\xF2\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )" + +#: _avatars.plugin.php:1632 +msgid "Successfully copied the large avatar image for use for the small avatar image." +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xED." + +#: _avatars.plugin.php:1635 +msgid "Unsuccessfully copied the large avatar image for use for the small avatar image." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0." + +#: _avatars.plugin.php:1640 +msgid "No small avatar exists! And no large avatar exists to use for the small avatar either!" +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xED\xE5 \xED\xE0\xE9\xE4\xE5\xED!" + +#: _avatars.plugin.php:1797 +msgid "Successfully removed all avatars." +msgstr "\xC2\xF1\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB \xE1\xFB\xEB\xE8 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF3\xE4\xE0\xEB\xE5\xED\xFB." + +#: _avatars.plugin.php:1797 +msgid "Failed deleting all avatars for this plugin." +msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB." + +#: _avatars.plugin.php:1804 +msgid "All avatars were kept." +msgstr "\xC0\xE2\xE0\xF2\xE0\xF0\xFB \xE1\xFB\xEB\xE8 \xF1\xEE\xF5\xF0\xE0\xED\xE5\xED\xFB." + +#: _avatars.plugin.php:1827 +msgid "Permanently delete any avatars?" +msgstr "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE2\xF1\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB." + +#: _avatars.plugin.php:2293 +msgid "Image" +msgstr "\xC8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5" + +#: _avatars.plugin.php:2294 +msgid "of" +msgstr "\xE8\xE7" + +#: _profile_area.php:57 +#: _profile_area.php:72 +msgid "Remove Avatar" +msgstr "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0" + +#~ msgid "Avatar" +#~ msgstr "\xC0\xE2\xE0\xF2\xE0\xF0" +#~ msgid "0 - 11<br />[ 0 - Enable for all ]<br />[ 11 - Disable for all ]" +#~ msgstr "0 - 11<br />[ 0 - \xD0\xE0\xE7\xF0\xE5\xF8\xE8\xF2\xFC \xE2\xF1\xE5\xEC ]<br />[ 11 - \xC7\xE0\xEF\xF0\xE5\xF2\xE8\xF2\xFC \xE2\xF1\xE5\xEC ]" +#~ msgid "KB.<br />[ 10 - 3000 ]" +#~ msgstr "\xCA\xE1.<br />[ 10 - 3000 ]" +#~ msgid "Small avatar width" +#~ msgstr "\xD8\xE8\xF0\xE8\xED\xE0 \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" +#~ msgid "Small avatar height" +#~ msgstr "\xC2\xFB\xF1\xEE\xF2\xE0 \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0" +#~ msgid "User avatar" +#~ msgstr "\xCF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFC" +#~ msgid "Update this avatar" +#~ msgstr "\xCE\xE1\xED\xEE\xE2\xE8\xF2\xFC \xFD\xF2\xEE\xF2 \xE0\xE2\xE0\xF2\xE0\xF0" +#~ msgid "Blog avatar" +#~ msgstr "\xC1\xEB\xEE\xE3" +#~ msgid "Avatar image" +#~ msgstr "\xD0\xE0\xE7\xEC\xE5\xF0 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xFF" +#~ msgid "Up to " +#~ msgstr "\xCC\xE0\xEA\xF1. " +#~ msgid "Show Support?" +#~ msgstr "\xCF\xEE\xEA\xE0\xE7\xE0\xF2\xFC \xF1\xF1\xFB\xEB\xEA\xF3 \xEF\xEE\xE4\xE4\xE5\xF0\xE6\xEA\xE8?" +#~ msgid "Adds a credit link for this plugin." +#~ msgstr "\xC4\xEE\xE1\xE0\xE2\xE8\xF2\xFC \xF1\xF1\xFB\xEB\xEA\xF3 \xE0\xE2\xF2\xEE\xF0\xE0 \xEA \xEF\xEB\xE0\xE3\xE8\xED\xF3." +#~ msgid "Successfully deleted the large avatar image." +#~ msgstr "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF3\xE4\xE0\xEB\xE5\xED." +#~ msgid "Failed to delete the large avatar image." +#~ msgstr "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0." + Added: avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/_global.php =================================================================== --- avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/_global.php (rev 0) +++ avatars_plugin/branches/2.2.7/locales/ru_RU_cp1251/_global.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,86 @@ +<?php +/* + * Global lang file + * This file was generated automatically from messages.po + */ +if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); + + +$trans['ru_RU_cp1251'] = array( + '' => "Project-Id-Version: Avatars plugin 2.2.7\nReport-Msgid-Bugs-To: http://fplanque.net/\nPOT-Creation-Date: 2008-10-19 17:42-0400\nPO-Revision-Date: 2008-10-19 17:44-0500\nLast-Translator: Alex\nLanguage-Team: Russian b2evolution\nMIME-Version: 1.0\nContent-Type: text/plain; charset=windows-1251\nContent-Transfer-Encoding: 8bit\nX-Poedit-Language: Russian\nX-Poedit-Country: RUSSIAN FEDERATION\n", + 'Avatars' => "\xC0\xE2\xE0\xF2\xE0\xF0\xFB", + 'Large Avatar' => "\xC1\xEE\xEB\xFC\xF8\xEE\xE9 \xE0\xE2\xE0\xF2\xE0\xF0", + 'Up to' => "\xCC\xE0\xEA\xF1.", + 'Remove Large Avatar' => "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE1\xEE\xEB\xFC\xF8\xEE\xE9 \xE0\xE2\xE0\xF2\xE0\xF0", + 'Small Avatar' => "\xCC\xE0\xEB\xE5\xED\xFC\xEA\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0", + 'Remove Small Avatar' => "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xEC\xE0\xEB\xE5\xED\xE8\xEA\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0", + 'Let\'s you \'easily\' add avatars/icons to various things.' => "\xCF\xEE\xE7\xE2\xEE\xEB\xFF\xE5\xF2 \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB", + 'Let\'s you \'easily\' add avatars/icons to ' => "\xD0\xE0\xE1\xEE\xF2\xE0\xE5\xF2 \xF1\xEE \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xEC\xE8 \xF2\xE8\xEF\xE0\xEC\xE8 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9:", + 'In order to display large avatars in lightbox you should select the "standard" lightbox version in %s!' => "\xC4\xEB\xFF \xEE\xF2\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xFF \xE1\xEE\xEB\xFC\xF8\xE8\xF5 \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xF1 \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xED\xE8\xE5\xEC \"lightbox\" \xE2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xE2\xFB\xE1\xF0\xE0\xF2\xFC \xF1\xF2\xE0\xED\xE4\xE0\xF0\xF2\xED\xF3\xFE \xE2\xE5\xF0\xF1\xE8\xFE lightbox \"standard\" \xE2 \xED\xE0\xF1\xF2\xF0\xEE\xE9\xEA\xE0\xF5 \xEF\xEB\xE0\xE3\xE8\xED\xE0 %s!", + 'User Groups' => "\xC3\xF0\xF3\xEF\xEF\xFB \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xE5\xE9", + 'Disable avatars for these user groups. Separate by ,' => "\xCE\xF2\xEA\xEB\xFE\xF7\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB \xE4\xEB\xFF \xFD\xF2\xE8\xF5 \xE3\xF0\xF3\xEF\xEF. \xC3\xF0\xF3\xEF\xEF\xFB \xF0\xE0\xE7\xE4\xE5\xEB\xFF\xE9\xF2\xE5 \xE7\xE0\xEF\xFF\xF2\xFB\xEC\xE8.", + 'Minimum User level' => "\xCC\xE8\xED\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF3\xF0\xEE\xE2\xE5\xED\xFC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF", + 'Enable for all users.' => "\xD0\xE0\xE7\xF0\xE5\xF8\xE8\xF2\xFC \xE2\xF1\xE5\xEC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF\xEC.", + 'Disable for all users.' => "\xC7\xE0\xEF\xF0\xE5\xF2\xE8\xF2\xFC \xE2\xF1\xE5\xEC \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF\xEC.", + 'Maximum file size' => "\xCC\xE0\xEA\xF1\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF0\xE0\xE7\xEC\xE5\xF0 \xF4\xE0\xE9\xEB\xE0 \xE4\xEB\xFF \xE7\xE0\xE3\xF0\xF3\xE7\xEA\xE8", + 'KB' => "\xCA\xE1", + 'Display default avatar' => "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE", + 'Should the default avatar be displayed if no avatar exists?' => "\xC4\xEE\xEB\xE6\xE5\xED \xEB\xE8 \xE1\xFB\xF2\xFC \xEF\xEE\xEA\xE0\xE7\xE0\xED \xE0\xE2\xE0\xF2\xE0\xF0 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xEF\xF0\xE8 \xEE\xF2\xF1\xF3\xF2\xF1\xF2\xE2\xE8\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF?", + 'Use image resizing' => "\xC8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE8\xE7\xEC\xE5\xED\xE5\xED\xE8\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xE0 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9", + 'Should we use image resizing?' => "\xC4\xEE\xEB\xE6\xED\xFB \xEB\xE8 \xEC\xFB \xE8\xF1\xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xFC \xE8\xE7\xEC\xE5\xED\xE5\xED\xE8\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xE0 \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9?", + 'Collapsed avatars area' => "\xD1\xE2\xE5\xF0\xED\xF3\xF2\xE0\xFF \xEF\xE0\xED\xE5\xEB\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2", + 'Should we display the admin avatars upload area collapsed?' => "\xC4\xEE\xEB\xE6\xED\xFB \xEB\xE8 \xEC\xFB \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEF\xE0\xED\xE5\xEB\xFC \xE7\xE0\xE3\xF0\xF3\xE7\xEA\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xF1\xE2\xE5\xF0\xED\xF3\xF2\xEE\xE9?", + 'Display next avatar' => "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0", + 'If no <b>post</b> avatar and no default post image exists, display the category avatar, if no category avatar exists then display the blog avatar.' => "\xC2 \xF1\xEB\xF3\xF7\xE0\xE5 \xEA\xEE\xE3\xE4\xE0 \xED\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8 \xED\xE8 \xEA\xE0\xF0\xF2\xE8\xED\xEA\xE8 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE7\xE0\xEF\xE8\xF1\xE5\xE9 \xED\xE5 \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8, \xE5\xF1\xEB\xE8 \xE8 \xE5\xE3\xEE \xED\xE5\xF2 - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0 \xE1\xEB\xEE\xE3\xE0.", + 'Display next default image' => "\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xF3\xFE \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE", + 'If no <b>post</b> avatar and no default post image exists, display the default category image, if no default category image exists then display the default blog image.<br /><br />NOTE: <b>Display next default image</b> has higher priority over <b>Display next avatar</b>.' => "\xC2 \xF1\xEB\xF3\xF7\xE0\xE5 \xEA\xEE\xE3\xE4\xE0 \xED\xE8 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8 \xED\xE8 \xEA\xE0\xF0\xF2\xE8\xED\xEA\xE8 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE7\xE0\xEF\xE8\xF1\xE5\xE9 \xED\xE5 \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE9, \xE5\xF1\xEB\xE8 \xE8 \xE5\xE5 \xED\xE5\xF2 - \xEF\xEE\xEA\xE0\xE7\xFB\xE2\xE0\xF2\xFC \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE \xE4\xEB\xFF \xE1\xEB\xEE\xE3\xEE\xE2.<br /><br />\xC2\xCD\xC8\xCC\xC0\xCD\xC8\xC5: \xD4\xF3\xED\xEA\xF6\xE8\xFF <b>\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xF3\xFE \xEA\xE0\xF0\xF2\xE8\xED\xEA\xF3 \xEF\xEE \xF3\xEC\xEE\xEB\xF7\xE0\xED\xE8\xFE</b> \xE8\xEC\xE5\xE5\xF2 \xE1\xEE\xEB\xFC\xF8\xE8\xE9 \xEF\xF0\xE8\xEE\xF0\xE8\xF2\xE5\xF2 \xF7\xE5\xEC <b>\xCE\xF2\xEE\xE1\xF0\xE0\xE6\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE9 \xE0\xE2\xE0\xF2\xE0\xF0</b>.", + 'Image settings' => "\xCF\xE0\xF0\xE0\xEC\xE5\xF2\xF0\xFB \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE9", + 'Large avatar JPEG quality' => "JPEG \xEA\xE0\xF7\xE5\xF1\xF2\xE2\xEE \xE1\xEE\xEB\xFC\xF8\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0", + 'Large avatar image re-size mode' => "\xD1\xEF\xEE\xF1\xEE\xE1 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xE1\xEE\xEB\xFC\xF8\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0", + 'None' => "\xCD\xE5 \xEF\xF0\xE8\xEC\xE5\xED\xFF\xF2\xFC", + 'Area' => "\xCF\xF0\xEE\xEF\xEE\xF0\xF6\xE8\xEE\xED\xE0\xEB\xFC\xED\xEE", + 'No Resizing Occurs' => "\xC1\xE5\xE7 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xF0\xE0\xE7\xEC\xE5\xF0\xEE\xE2", + 'Image is resized proportionally to fit within the given area' => "\xC8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5 \xF3\xEC\xE5\xED\xFC\xF8\xE0\xE5\xF2\xF1\xFF \xEF\xF0\xEE\xEF\xEE\xF0\xF6\xE8\xEE\xED\xE0\xEB\xFC\xED\xEE, \xE2\xEF\xE8\xF1\xFB\xE2\xE0\xFF\xF1\xFC \xE2 \xE7\xE0\xE4\xE0\xED\xED\xFB\xE5 \xF0\xE0\xE7\xEC\xE5\xF0\xFB", + 'Small avatar JPEG quality' => "JPEG \xEA\xE0\xF7\xE5\xF1\xF2\xE2\xEE \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0", + '%' => "%", + 'Small avatar image re-size mode' => "\xD1\xEF\xEE\xF1\xEE\xE1 \xF3\xEC\xE5\xED\xFC\xF8\xE5\xED\xE8\xFF \xEC\xE0\xEB\xE5\xED\xFC\xEA\xEE\xE3\xEE \xE0\xE2\xE0\xF2\xE0\xF0\xE0", + 'Avatar sizes (Optional)' => "\xD0\xE0\xE7\xEC\xE5\xF0\xFB \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 (\xC4\xEE\xEF\xEE\xEB\xED\xE8\xF2\xE5\xEB\xFC\xED\xEE)", + 'Large avatars' => "\xC1\xEE\xEB\xFC\xF8\xE8\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB", + 'User avatar width' => "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF", + 'Pixels' => "\xCF\xE8\xEA\xF1\xE5\xEB\xE5\xE9", + 'User avatar height' => "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEF\xEE\xEB\xFC\xE7\xEE\xE2\xE0\xF2\xE5\xEB\xFF", + 'Blog avatar width' => "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE1\xEB\xEE\xE3\xE0", + 'Blog avatar height' => "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE1\xEB\xEE\xE3\xE0", + 'Category avatar width' => "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8", + 'Category avatar height' => "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xEA\xE0\xF2\xE5\xE3\xEE\xF0\xE8\xE8", + 'Post avatar width' => "\xD8\xE8\xF0\xE8\xED\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8", + 'Post avatar height' => "\xC2\xFB\xF1\xEE\xF2\xE0 \xE0\xE2\xE0\xF2\xE0\xF0\xE0 \xE7\xE0\xEF\xE8\xF1\xE8", + 'Small avatars' => "\xCC\xE0\xEB\xE5\xED\xFC\xEA\xE8\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB", + 'You must create the following directories with write permissions (777):%s' => "\xC2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xF1\xEE\xE7\xE4\xE0\xF2\xFC \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xE5 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xE8\xE8 \xF1 \xF0\xE0\xE7\xF0\xE5\xF8\xE5\xED\xE8\xFF\xEC\xE8 \xED\xE0 \xE7\xE0\xEF\xE8\xF1\xFC (777):%s", + 'You must copy the file default.jpg from "avatars_plugin/includes/" to %s' => "\xC2\xFB \xE4\xEE\xEB\xE6\xED\xFB \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xF2\xFC \xF4\xE0\xE9\xEB default.jpg \xE8\xE7 \"avatars_plugin/includes/\" \xE2 %s", + 'Put this %s avatars code in posts loop, usually in %s, in %s or in %s' => "\xD1\xEA\xEE\xEF\xE8\xF0\xF3\xE9\xF2\xE5 \xFD\xF2\xEE\xF2 \xEA\xEE\xE4 \xE4\xEB\xFF %s \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xE2 \xF6\xE8\xEA\xEB \xE7\xE0\xEF\xE8\xF1\xE5\xE9 (posts loop), \xEE\xE1\xFB\xF7\xED\xEE \xE2 \xF4\xE0\xE9\xEB %s \xE8\xEB\xE8 %s \xE8\xEB\xE8 %s", + 'Put this %s avatars code in comments loop, usually in %s' => "\xD1\xEA\xEE\xEF\xE8\xF0\xF3\xE9\xF2\xE5 \xFD\xF2\xEE\xF2 \xEA\xEE\xE4 \xE4\xEB\xFF %s \xE0\xE2\xE0\xF2\xE0\xF0\xEE\xE2 \xE2 \xF6\xE8\xEA\xEB \xEA\xEE\xEC\xEC\xE5\xED\xF2\xE0\xF0\xE8\xE5\xE2 (comments loop), \xEE\xE1\xFB\xF7\xED\xEE \xE2 \xF4\xE0\xE9\xEB %s", + 'The image you tried to upload is not of an acceptable extension' => "\xD4\xE0\xE9\xEB, \xEA\xEE\xF2\xEE\xF0\xFB\xE9 \xE2\xFB \xE7\xE0\xE3\xF0\xF3\xE6\xE0\xE5\xF2\xE5, \xE4\xEE\xEB\xE6\xE5\xED \xE8\xEC\xE5\xF2\xFC \xEE\xE4\xED\xEE \xE8\xE7 \xF1\xEB\xE5\xE4\xF3\xFE\xF9\xE8\xF5 \xF0\xE0\xF1\xF8\xE8\xF0\xE5\xED\xE8\xE9", + 'The maximum allowed file size is %s KB.' => "\xCC\xE0\xEA\xF1\xE8\xEC\xE0\xEB\xFC\xED\xFB\xE9 \xF0\xE0\xE7\xEC\xE5\xF0 \xE7\xE0\xE3\xF0\xF3\xE6\xE0\xE5\xEC\xEE\xE3\xEE \xF4\xE0\xE9\xEB\xE0 \xED\xE5 \xE4\xEE\xEB\xE6\xE5\xED \xEF\xF0\xE5\xE2\xFB\xF8\xE0\xF2\xFC %s \xCA\xE1.", + 'Succesfully uploaded the image' => "\xD3\xF1\xEF\xE5\xF8\xED\xEE \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5", + 'Failed to upload the image' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xE7\xE0\xE3\xF0\xF3\xE7\xE8\xF2\xFC \xE8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5", + 'Successfully deleted the %s avatar image.' => "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF3\xE4\xE0\xEB\xE5\xED. ( %s )", + 'Failed to delete the %s avatar image.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )", + 'Successfully created the %s avatar.' => "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF1\xEE\xE7\xE4\xE0\xED. ( %s )", + 'Failed writing the %s avatar.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xE7\xE0\xEF\xE8\xF1\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )", + 'Failed to create the %s avatar.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF1\xEE\xE7\xE4\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )", + 'Failed to delete the temporary %s avatar image.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE2\xF0\xE5\xEC\xE5\xED\xED\xFB\xE9 \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )", + 'Successfully moved the %s avatar to it\'s correct location. [ %d ]' => "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xEF\xE5\xF0\xE5\xEC\xE5\xF9\xE5\xED. [ %d ]", + 'Failed to move the %s avatar image to it\'s correct location.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xEF\xE5\xF0\xE5\xEC\xE5\xF1\xF2\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0. ( %s )", + 'Successfully copied the large avatar image for use for the small avatar image.' => "\xC0\xE2\xE0\xF2\xE0\xF0 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xED.", + 'Unsuccessfully copied the large avatar image for use for the small avatar image.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF1\xEA\xEE\xEF\xE8\xF0\xEE\xE2\xE0\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0.", + 'No small avatar exists! And no large avatar exists to use for the small avatar either!' => "\xC0\xE2\xE0\xF2\xE0\xF0 \xED\xE5 \xED\xE0\xE9\xE4\xE5\xED!", + 'Successfully removed all avatars.' => "\xC2\xF1\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB \xE1\xFB\xEB\xE8 \xF3\xF1\xEF\xE5\xF8\xED\xEE \xF3\xE4\xE0\xEB\xE5\xED\xFB.", + 'Failed deleting all avatars for this plugin.' => "\xCD\xE5 \xF3\xE4\xE0\xEB\xEE\xF1\xFC \xF3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0\xFB.", + 'All avatars were kept.' => "\xC0\xE2\xE0\xF2\xE0\xF0\xFB \xE1\xFB\xEB\xE8 \xF1\xEE\xF5\xF0\xE0\xED\xE5\xED\xFB.", + 'Permanently delete any avatars?' => "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE2\xF1\xE5 \xE0\xE2\xE0\xF2\xE0\xF0\xFB.", + 'Image' => "\xC8\xE7\xEE\xE1\xF0\xE0\xE6\xE5\xED\xE8\xE5", + 'of' => "\xE8\xE7", + 'Remove Avatar' => "\xD3\xE4\xE0\xEB\xE8\xF2\xFC \xE0\xE2\xE0\xF2\xE0\xF0", +); +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/.image.funcs.test.php =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/.image.funcs.test.php (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/.image.funcs.test.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,166 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryTester + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +header('Content-Type: text/plain'); + +$tests = array( + array( + 'width_original' => 30, + 'height_original' => 10, + 'width_desired' => 10, + 'height_desired' => 5, + ), + array( + 'width_original' => 15, + 'height_original' => 30, + 'width_desired' => 5, + 'height_desired' => 10, + ), + array( + 'width_original' => 15, + 'height_original' => 30, + 'width_desired' => 10, + 'height_desired' => 5, + ), + array( + 'width_original' => 15, + 'height_original' => 30, + 'width_desired' => 50, + 'height_desired' => 55, + ), + array( + 'width_original' => 15, + 'height_original' => 30, + 'width_desired' => 55, + 'height_desired' => 50, + ), + array( + 'width_original' => 48, + 'height_original' => 48, + 'width_desired' => 400, + 'height_desired' => 400, + ), + +); + +foreach ( $tests as $test ) +{ + // + extract($test); + + // Proportions + $proportion_wh = $width_original / $height_original; + $proportion_hw = $height_original / $width_original; + + $proportion_wh_desired = $width_desired / $height_desired; + $proportion_hw_desired = $height_desired / $width_desired; + + // + $wh_greater = $proportion_wh > $proportion_wh_desired; + $hw_greater = $proportion_hw > $proportion_hw_desired; + $wh_smaller = !$wh_greater; + $hw_smaller = !$hw_greater; + $wh_difference = $proportion_wh - $proportion_wh_desired; + $hw_difference = $proportion_hw - $proportion_hw_desired; + + // Option 1: wh | so w is unknown + $width_new_1 = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new_1 = $height_desired; + + // Option 2: hw + $width_new_2 = $width_desired; + $height_new_2 = $width_desired * $proportion_hw; // h = w*(h/w) + + // Blah + $width_1_overflowed = $width_new_1 > $width_desired; + $width_2_overflowed = $width_new_2 > $width_desired; + $height_1_overflowed = $height_new_1 > $height_desired; + $height_2_overflowed = $height_new_2 > $height_desired; + + // Correct + switch ( true ) + { + case + !$width_1_overflowed && + !$width_2_overflowed && + !$height_1_overflowed && + !$height_2_overflowed + : + $correct = 'both'; + break; + + case + !$width_1_overflowed && + !$height_1_overflowed + : + $correct = 'one'; + break; + + case + !$width_2_overflowed && + !$height_2_overflowed + : + $correct = 'two'; + break; + + default: + $correct = 'none'; + break; + } + + // Guess + switch ( true ) + { + case + !$wh_greater && !$hw_greater: + $guess = 'both'; + break; + + case + !$wh_greater: // wh smaller + $guess = 'one'; + break; + + case + !$hw_greater: // hw smaller + $guess = 'two'; + break; + + default: + $guess = 'none'; + break; + } + + // + $result = compact( + 'proportion_wh', 'proportion_hw', + 'proportion_wh_desired', 'proportion_hw_desired', + 'wh_greater', 'hw_greater', + 'wh_smaller', 'hw_smaller', + 'wh_difference', 'hw_difference', + 'width_original', 'height_original', + 'width_desired', 'height_desired', + 'width_new_1', 'height_new_1', + 'width_new_2', 'height_new_2', + 'correct', + 'guess', + 'width_1_overflowed', + 'height_1_overflowed', + 'width_2_overflowed', + 'height_2_overflowed' + ); + + // + var_export($result); +} \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/_files.funcs.php =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/_files.funcs.php (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/_files.funcs.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,607 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryGroup + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +require_once(dirname(__FILE__).'/_general.funcs.php'); +require_once(dirname(__FILE__).'/_scan_dir.funcs.php'); + +if ( !function_exists('file_put_contents') ) +{ + define('FILE_APPEND', 0); + function file_put_contents($n, $d, $flag = false) { + $mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ? 'a' : 'w'; + $f = @fopen($n, $mode); + if ($f === false) { + return 0; + } else { + if (is_array($d)) $d = implode($d); + $bytes_written = fwrite($f, $d); + fclose($f); + return $bytes_written; + } + } +} + +if( function_comp( 'become_file_download', 1 ) ) { +function become_file_download ( $file_path, $content_type = NULL, $buffer_size = 20000 ) +{ /* + * Credits to pechkin at zeos dot net - {@link http://au3.php.net/manual/en/function.header.php#65667} + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + if ( empty($content_type) ) + $content_type = 'application/force-download'; + + // Define variables + $fpath = $file_path; + $fname = basename($file_path); + $fsize = filesize($fpath); + $bufsize = $buffer_size; + + if ( isset($_SERVER['HTTP_RANGE']) ) + { // Partial download + if( preg_match("/^bytes=(\\d+)-(\\d*)$/", $_SERVER['HTTP_RANGE'], $matches) ) + { // Parsing Range header + $from = $matches[1]; + $to = $matches[2]; + + if( empty($to) ) + { + $to = $fsize - 1; // -1 because end byte is included + //(From HTTP protocol: + // 'The last-byte-pos value gives the byte-offset of the last byte in the range; that is, the byte positions specified are inclusive') + } + + $content_size = $to - $from + 1; + + header("HTTP/1.1 206 Partial Content"); + header('Pragma: public'); + header('Cache-control: must-revalidate, post-check=0, pre-check=0'); + header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header("Content-Range: $from-$to/$fsize"); + header("Content-Length: $content_size"); + header("Content-Type: $content_type"); + if ( $content_type == 'application/force-download' ) + header("Content-Disposition: attachment; filename=$fname"); + header("Content-Transfer-Encoding: binary"); + + if(file_exists($fpath) && $fh = fopen($fpath, "rb")) + { + fseek($fh, $from); + $cur_pos = ftell($fh); + while($cur_pos !== FALSE && ftell($fh) + $bufsize < $to+1) + { + $buffer = fread($fh, $bufsize); + print $buffer; + $cur_pos = ftell($fh); + } + + $buffer = fread($fh, $to+1 - $cur_pos); + print $buffer; + + fclose($fh); + } + else + { + header("HTTP/1.1 404 Not Found"); + exit; + } + } + else + { + header("HTTP/1.1 500 Internal Server Error"); + exit; + } + } + else // Usual download + { + // die ( $fpath.':::'.$fsize); + header("HTTP/1.1 200 OK"); + header('Pragma: public'); + header('Cache-control: must-revalidate, post-check=0, pre-check=0'); + header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header("Content-Length: $fsize"); + header("Content-Type: $content_type"); + if ( $content_type == 'application/force-download' ) + header("Content-Disposition: attachment; filename=$fname"); + header("Content-Transfer-Encoding: binary"); + if( file_exists($fpath) ) + { + readfile($fpath); + } + else + { + header("HTTP/1.1 404 Not Found"); + } + } +} +} + +if( function_comp( 'filetype_human', 1 ) ) { +function filetype_human ( $file_path, $format = '%s (.%s)' ) +{ /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + $types = array( + 'exe' => 'Application', + 'jpg' => 'Image', + 'jpeg' => 'Image', + 'png' => 'Image', + 'tiff' => 'Image', + 'bmp' => 'Image', + 'zip' => 'ZIP Archive', + 'rar' => 'WinRAR Archive', + 'pdf' => 'Adobe Reader Document', + 'doc' => 'Word Document', + 'txt' => 'Document', + 'rtf' => 'Rich Text File' + ); + + $extension = get_extension($file_path); + if ( function_exists('mime_content_type') ) + { + $mime_type = mime_content_type($file_path); + $type = $mime_type; + } else + { + $mime_type = false; + $type = 'File'; + } + + if ( isset($this->types[$mime_type]) ) + { + $type = $this->types[$mime_type]; + + } elseif ( isset($this->types[$extension]) ) + { + $type = $this->types[$extension]; + } + + return sprintf($format, $type, $extension); +} +} + + +if( function_comp( 'get_estimated_download_time', 1 ) ) { + function get_estimated_download_time ( $size, $speed, $round_seconds = true, $formats = array() ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + if ( !isset($formats['format']) ) + $formats['format'] = '%1$s (Estimate based on %2$s)'; + if ( !isset($formats['hours']) ) + $formats['hours'] = '%s hour%s'; + if ( !isset($formats['minutes']) ) + $formats['minutes'] = '%s minute%s'; + if ( !isset($formats['seconds']) ) + $formats['seconds'] = '%s second%s'; + + // Convert size into kilobytes + $size /= 1000; + + // Convert speed into Kbps from Mbps + if ( $speed < 56 ) // 1.5 = 1500 + $speed *= 100; + + // Convert speed into KBps + $speed /= 8; + + // Set remaining size + $remaining_size = $size; + + // Figure out the hours + $max = $speed * 60 /* mins */ * 60 /* hours */; + $hours = floor($remaining_size / $max); + $remaining_size = $remaining_size % $max; + + // Figure out the minutes + $max = $speed * 60 /* mins */; + $minutes = floor($remaining_size / $max); + $remaining_size = $remaining_size % $max; + + // Figure out the seconds + $max = $speed /* seconds */; + $seconds = ceil($remaining_size / $max); + $remaining_size = 0; + + // Round it + if ( $round_seconds ) + { + if ( $seconds >= 30 ) + ++$minutes; + $seconds = 0; + } + + // Times + $times = array(); + if ( $hours ) $times['hours'] = sprintf($formats['hours'], $hours, ($hours > 1 ? 's' : '')); + if ( $minutes ) $times['minutes'] = sprintf($formats['minutes'], $minutes, ($minutes > 1 ? 's' : '')); + if ( $seconds ) $times['seconds'] = sprintf($formats['seconds'], $seconds, ($seconds > 1 ? 's' : '')); + $times = implode(', ', $times); + if ( empty($times) ) + $times = 'Unknown'; + + // Do display + $result = + sprintf($formats['format'], $times, ($speed*8).'Kbps'); + + // Return + return $result; + } +} + +global $FILESIZE_LEVELS; +if ( !isset($FILESIZE_LEVELS) ) + $FILESIZE_LEVELS = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + +if( function_comp( 'filesize_human_from', 1 ) ) { +function filesize_human_from( $filesize_human ){ + global $FILESIZE_LEVELS; + $levels = $FILESIZE_LEVELS; + + $filesize_human = strtoupper($filesize_human); + + $matches = array(); + $matches_length = preg_match('/([a-zA-Z]*)$/', $filesize_human, $matches); + if ( $matches_length === 1 && in_array(($match = $matches[0]), $levels)) + $level = $match; + else + $level = 'MB'; + + $filesize = floatval(trim(substr($filesize_human, 0, strlen($filesize_human)-strlen($level)))); + + $depth = array_search($level, $levels); + ++$depth; // B should be 1 + + for ( $i = 0, $n = $depth-1; $i < $n; ++$i ) + $filesize *= 1024; + + return $filesize; +} } + +if( function_comp( 'filesize_human', 1 ) ) { +function filesize_human( $size, $decimal_places = 3, $place_holder = 0.100 ) +{ /* + * Original goes to {@link http://au3.php.net/manual/en/function.filesize.php#64387} + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1.2 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * v1.2 + * - added place_holder, should be 1 by default but client required 0.100 + */ + + global $FILESIZE_LEVELS; + $levels = $FILESIZE_LEVELS; + + $level = 0; + while ( ($new_size = $size / 1024) > $place_holder ) + { + $size = $new_size; + ++$level; + } + $filesize_human = substr($size,0,strpos($size,'.')+$decimal_places).' '.$levels[$level]; + return $filesize_human; +} } + +if( function_comp( 'dirsize', 1 ) ) { +function dirsize ( $dir_path ) +{ // Get the total filesize of a directory + $dir_path = create_valid_path($dir_path); + $files = scan_dir($dir_path); + $dirsize = 0; + //if ( empty($files) ) + // return 0; + for ( $i = 0, $n = sizeof($files); $i < $n; ++$i ) + { + $file_path = $dir_path.$files[$i]; + $filesize = filesize($file_path); + $dirsize += $filesize; + } + return $dirsize; +} +} + +if( function_comp( 'get_filename', 2 ) ) { +function get_filename( $file, $with_extension = true ) { + $file = basename($file); + if ( !$with_extension ) + { + $end = strrpos($file,'.'); + if ( $end != false ) + $file = substr($file,0,$end); + } + return $file; +} } + +if( function_comp( 'get_extension', 1 ) ) { +function get_extension( $file ) { + $end = strrpos($file,'.'); + if ( $end != false ) + return substr($file,$end+1); + else + return ''; +} } + +if( function_comp( 'create_valid_filename', 1 ) ) { +function create_valid_filename( $name ) { + return preg_replace( "/[^\w\.-]+/", '_', $name ); +} } + +if( function_comp( 'create_valid_path', 2 ) ) { +function create_valid_path ( $path ) +{ // Changes \\ to /, and adds a / to the end if it's not already not present + $path = str_replace( '\\', '/', $path ); + + if( substr( $path, strlen($path)-1 ) != '/' ) + { + $filename = get_filename($path); + if( is_dir($path) || !strstr($filename,'.') ) + $path .= '/'; + } + + return $path; +} } + + +if( function_comp( 'unlink_dir', 3 ) ) { + function unlink_dir($dir) + { // Removes a directory and all subfiles, modded by balupton + $dir = create_valid_path($dir); + if ($handle = @opendir($dir)) { + while ( false !== ($item = @readdir($handle)) ) { + switch( $item ) + { + case '.': + case '..': + break; + default: + $c = $dir.$item; + if ( is_dir($c) ) + unlink_dir($c); + else + unlink($c); + } + } + closedir($handle); + rmdir($dir); + } + return true; // if it can't open the directory we assume it's deleted + } +} + + +if( function_comp( 'write_file', 1 ) ) { + function write_file($file,$contents) + { + return ($fp = @fopen($file,'w')) && @fwrite($fp, $contents) && fclose($fp); + } +} +if( function_comp( 'read_file', 1 ) ) { + function read_file($file,$contents = false) + { + if ( ($fp = @fopen($file,'r')) ) + { // read the file + $contents = @fread($fp, filesize($file)); + fclose($fp); + } + return $contents; + } +} + + +if( function_comp( 'get_relative_location', 1 ) ) { +function get_relative_path( $wanted_loc, $base_loc ) +{ /* + * Gets the relative location of $wanted_file based on the $base_file's location + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + $wanted_file = create_valid_path($wanted_loc); + $base_loc = create_valid_path($base_loc, true); + + // remove the file from $base_file if it exists + if( substr($base_loc,strlen($base_loc)-1,1) != '/' ) + $base_loc = substr($base_loc,0,strrpos($base_loc,'/')); + + $start_on = 0; + $change_on = 0; + + $a = explode('/',$wanted_loc); + $aa = explode('/',$base_loc); + $s = sizeof($a); + $ss = sizeof($aa); + + // Remove the empty parts + for( $i = 0; $i < $s; $i++ ) + { // remove empty parts + if( empty($a[$i]) ) { + array_splice($a,$i,1); + $i--; + $s--; + } + } + + for( $i = 0; $i < $ss; $i++ ) + { // remove empty parts + if( empty($aa[$i]) ) { + array_splice($aa,$i,1); + $i--; + $ss--; + } + } + + for( $i = 0; $i < $s && $i < $ss; $i++ ) + { // gets the first similarity between the two locations + $c = & $a[$i]; + $cc = & $aa[$i]; + if( $c === $cc ) { + $start_on = $i; + break; + } + } + + for( $i = $start_on; $i < $s && $i < $ss; $i++ ) + { // gets the first difference between the two locations + $c = & $a[$i]; + $cc = & $aa[$i]; + if( $c !== $cc ) { + $change_on = $i; + break; + } + } + + array_splice($a,0,$change_on); + array_splice($aa,0,$change_on); + $new_file = implode('/',$a); + $ss = sizeof($aa); + for ( $i = 0; $i < $ss; $i++ ) + $new_file = '../'.$new_file; + + return $new_file; +}} + + +if( function_comp( 'copy_dir', 1 ) ) { +function copy_dir($source, $dest, $overwrite = false){ + + $source = create_valid_path($source); + $dest = create_valid_path($dest); + + if( !(is_dir($dest) || @mkdir($dest)) ) + { // if the destination directory does not exist then create it + return false; + } + + if( $handle = @opendir($source) ) + { // open'd the directory for reading + while( false !== ($file = readdir($handle)) ) + { // cycle through the contents of the directory + if( substr($file,0,1) != '.' ) + { // if the file is not a dummy file + $source_file = $source.$file; + $dest_file = $dest.$file; + + if( is_file($dest_file) && is_file($source_file) ) + { // if both things are files then remove the destination file + if( $overwrite ) + if ( !@unlink($dest_file) ) + return false; + } + + if( is_file($source_file) ) + { // if the source file is a file then copy it over + if( !@copy($source_file, $dest_file) ) + return false; + } + elseif( is_dir($source_file) ) + { // if the source file is a directory then recurse + if( !copy_dir($source_file, $dest_file, $overwrite) ) + return false; + } + + } + } + closedir($handle); + } else + { + return false; + } + + return true; +} +} + +if( function_comp( 'rename_dir', 1 ) ) { +function rename_dir($source, $dest, $overwrite = false){ + + $source = create_valid_path($source); + $dest = create_valid_path($dest); + + if( !(is_dir($dest) || @mkdir($dest)) ) + { // if the destination directory does not exist then create it + return false; + } + + if( $handle = @opendir($source) ) + { // open'd the directory for reading + while( false !== ($file = readdir($handle)) ) + { // cycle through the contents of the directory + if( substr($file,0,1) != '.' ) + { // if the file is not a dummy file + $source_file = $source.$file; + $dest_file = $dest.$file; + + if( is_file($dest_file) && is_file($source_file) ) + { // if both things are files then remove the destination file + if( $overwrite ) + if ( !@unlink($dest_file) ) + return false; + } + + if( is_file($source_file) ) + { // if the source file is a file then copy it over + if( !@rename($source_file, $dest_file) ) + return false; + } + elseif( is_dir($source_file) ) + { // if the source file is a directory then recurse + if( !rename_dir($source_file, $dest_file, $overwrite) ) + return false; + } + + } + } + closedir($handle); + } else + { + return false; + } + + return unlink_dir($source); +} +} + +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/_general.funcs.php =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/_general.funcs.php (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/_general.funcs.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,99 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryGroup + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +if ( ! function_exists('function_comp') ) { + function function_comp( $f_name, $v_new, $set = true ) + { /* + * Compares the version of a function + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 2 + * @date December 12, 2006 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * v2 - 24/12/2006 - Made it so it floors version numbers, if the number is the same then we don't worry. + * - Eg. If 2.0 was compared with 2.1 then no problem would happen, if 3 was compared with 2 or vice versa we do have a problem + * v1 - 29/07/2006 + */ + + /* + * Usage + * + * Returns: + * true ; function has not been set yet + * false ; functions are the same version + * NULL ; functions are not the same version + */ + + $v_name = $f_name.'_version'; + global $$v_name; + + if ( isset($$v_name) ) { + $v_old = & $$v_name; + if( floor($v_old) == floor($v_new) ) { + return false; + } else { + + /*if ( $v_old > $v_new ) { + $start = '<!-- WARNING: Conflicting function versions:'; + $stop = '-->'; + $lb = "\r\n"; + } else {*/ + $start = '<h2>ERROR: Conflicting function versions:'; + $stop = '</h2>'; + $lb = '<br />'."\r\n"; + /*}*/ + + echo + $lb. + $start.$lb. + 'Function ['.$f_name.']'.$lb. + 'Original Version ['.$v_old.']'.$lb. + 'Attempted Version ['.$v_new.']'.$lb. + $stop.$lb; + + return NULL; + } + } else + { // If there is no original version number + if ( function_exists($f_name) ) + { // If the function already exists then we have a problem, as we do not know its version + $start = '<h2>ERROR: Conflicting function versions:'; + $stop = '</h2>'; + $lb = '<br />'."\r\n"; + $v_old = 'Unknown'; + echo + $lb. + $start.$lb. + 'Function ['.$f_name.']'.$lb. + 'Original Version ['.$v_old.']'.$lb. + 'Attempted Version ['.$v_new.']'.$lb. + $stop.$lb; + return NULL; + } else { + if ( $set ) $$v_name = $v_new; + return true; + } + } + } +} + +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.php =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.php (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,965 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryGroup + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +require_once(dirname(__FILE__).'/_general.funcs.php'); + +if( function_comp( 'resize', 8 ) ) { + function resize( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 8 + * @date December 02, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * v8, 02/12/2007 + * - Cleaned by using math instead of logic + * - Restructured the code + * - Re-organised variable names + * v7, 20/07/2007 + * - Cleaned + * v6, + * - Added cropping + * v5, 12/08/2006 + * - Changed to use args + */ + + /* + The 'exact' resize mode, will resize things to the exact limit. + If a width or height is 0, the appropriate value will be calculated by ratio + Results with a 800x600 limit: + *x* -> 800x600 + Results with a 0x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 + 96x48 -> 1200x600 + 1000x500 -> 1200x600 + Results with a 800x0 limit: + 1280x1024 -> 800x640 + 1900x1200 -> 800x505 + 96x48 -> 800x400 + 1000x500 -> 800x400 + */ + + /* + The 'area' resize mode, will resize things to fit within the area. + If a width or height is 0, the appropriate value will be calculated by ratio + Results with a 800x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 -> 800x505 + 96x48 -> 96x48 no change + 1000x500 -> 800x400 = '800x'.(800/100)*500 + Results with a 0x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 + 96x48 -> 96x48 no change + 1000x500 -> 1000x500 no change + Results with a 800x0 limit: + 1280x1024 -> 800x640 + 1900x1200 -> 950x600 -> 800x505 + 96x48 -> 96x48 no change + 1000x500 -> 800x400 = '800x'.(800/1000)*500 + */ + + // --------- + extract($args); + + // --------- + if ( !isset($width_original) && isset($width_old) ) + { $width_original = $width_old; unset($width_old); } + if ( !isset($height_original) && isset($height_old) ) + { $height_original = $height_old; unset($height_old); } + + // + if ( !isset($width_original) && !isset($height_original) && isset($image) ) + { // Get from image + $image = read_image($image); + $width_original = imagesx($image); + $height_original = imagesy($image); + } + + // + if ( empty($width_original) || empty($height_original) ) + { // + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no original dimensions specified -->'; + return false; + } + + // --------- + if ( !isset($width_desired) && isset($width_new) ) + { $width_desired = $width_new; unset($width_new); } + if ( !isset($height_desired) && isset($height_new) ) + { $height_desired = $height_new; unset($height_new); } + + // + if ( empty($width_desired) || empty($height_desired) ) + { // Don't do any resizing + echo '<!-- WARNING: '.__FUNCTION__.': '.__LINE__.': no desired dimensions specified -->'; + // return array( 'width' => $width_original, 'height' => $height_original ); + } + + // --------- + if ( !isset($resize_mode) ) + $resize_mode = 'area'; + elseif ( $resize_mode === 'none' ) + { // Don't do any resizing + //echo '<!-- WARNING: '.__FUNCTION__.': '.__LINE__.': $resize_mode === \'none\' -->'; + //return array( 'width' => $width_original, 'height' => $height_original ); + } + elseif ( !in_array($resize_mode, array('area', 'crop', 'exact', true) ) ) + { // + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Passed $resize_mode is not valid: '."[$resize_mode]".' -->'); + return false; + } + + // --------- + if ( !isset($x_original) && isset($x_old) ) + { $x_original = $x_old; unset($x_old); } + if ( !isset($y_original) && isset($y_old) ) + { $y_original = $y_old; unset($y_old); } + if ( !isset($x_original) ) $x_original = 0; + if ( !isset($y_original) ) $y_original = 0; + + // --------- + // Let's force integer values + $width_original = intval($width_original); + $height_original = intval($height_original); + $width_desired = intval($width_desired); + $height_desired = intval($height_desired); + + // --------- + // Set proportions + if ( $height_original !== 0 ) + $proportion_wh = $width_original / $height_original; + if ( $width_original !== 0 ) + $proportion_hw = $height_original / $width_original; + + if ( $height_desired !== 0 ) + $proportion_wh_desired = $width_desired / $height_desired; + if ( $width_desired !== 0 ) + $proportion_hw_desired = $height_desired / $width_desired; + + // --------- + // Set cutoms + $x_new = $x_original; + $y_new = $y_original; + $canvas_width = $canvas_height = NULL; + + // --------- + $width_new = $width_original; + $height_new = $height_original; + + // --------- + // Do resize + if ( $height_desired === 0 && $width_desired === 0 ) + { // Nothing to do + } + elseif ( $height_desired === 0 && $width_desired !== 0 ) + { // We don't care about the height + $width_new = $width_desired; + if ( $resize_mode !== 'exact' ) $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + } + elseif ( $height_desired !== 0 && $height_desired === 0 ) + { // We don't care about the width + if ( $resize_mode !== 'exact' ) $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + } + else + { // We care about both + + if ( $resize_mode === 'exact' || /* no upscaling */ ($width_original <= $width_desired && $height_original <= $height_desired) ) + { // Nothing to do + } + elseif ( $resize_mode === 'area' ) + { // Proportion to fit inside + + // Pick which option + if ( $proportion_wh <= $proportion_wh_desired ) + { // Option 1: wh + // Height would of overflowed + $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + } + else + // if ( $proportion_hw <= $proportion_hw_desired ) + { // Option 2: hw + // Width would of overflowed + $width_new = $width_desired; + $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + } + + } + elseif ( $resize_mode === 'crop' ) + { // Proportion to occupy + + // Pick which option + if ( $proportion_wh <= $proportion_wh_desired ) + { // Option 2: hw + // Height will overflow + $width_new = $width_desired; + $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + // Set custom + $y_new = -($height_new-$height_desired)/2; + } + else + // if ( $proportion_hw <= $proportion_hw_desired ) + { // Option 1: hw + // Width will overflow + $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + // Set custom + $x_new = -($width_new-$width_desired)/2; + } + + // Set canvas + $canvas_width = $width_desired; + $canvas_height = $height_desired; + + } + + } + + // --------- + // Set custom if they have not been set already + if ( $canvas_width === NULL ) + $canvas_width = $width_new; + if ( $canvas_height === NULL ) + $canvas_height = $height_new; + + // --------- + // Compat + $width_old = $width_original; + $height_old = $height_original; + $x_old = $x_original; + $y_old = $y_original; + + // --------- + // Return + $return = compact( + 'width_original', 'height_original', + 'width_old', 'height_old', + 'width_desired', 'height_desired', + 'width_new', 'height_new', + 'canvas_width', 'canvas_height', + 'x_original', 'y_original', + 'x_old', 'y_old', + 'x_new', 'y_new' + ); + // echo '<--'; var_dump($return); echo '-->'; + return $return; + } +} + +if ( !function_exists('exif_imagetype') ) +{ + function exif_imagetype ( $image_location ) + { + $image_size = getimagesize($image_location); + if ( !$image_size ) + return $image_size; + $image_type = $image_size[2]; + return $image_type; + } +} + +if( !function_exists('image_type_to_extension') ) { + function image_type_to_extension ( $image_type, $include_dot = true ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 1, 20/07/2007 + * - created + */ + + switch ( $image_type ) + { + /* case IMAGETYPE_GIF: $image_type = 'gif'; break; + case IMAGETYPE_JPEG: $image_type = 'jpeg'; break; + case IMAGETYPE_PNG: $image_type = 'png'; break; + case IMAGETYPE_SWF: $image_type = 'swf'; break; + case IMAGETYPE_PSD: $image_type = 'psd'; break; + case IMAGETYPE_BMP: $image_type = 'bmp'; break; + case IMAGETYPE_TIFF_II: $image_type = 'tiff'; break; + case IMAGETYPE_TIFF_MM: $image_type = 'tiff'; break; + case IMAGETYPE_JPC: $image_type = 'jpc'; break; + case IMAGETYPE_JP2: $image_type = 'jp2'; break; + case IMAGETYPE_JPX: $image_type = 'jpx'; break; + case IMAGETYPE_JB2: $image_type = 'jb2'; break; + case IMAGETYPE_SWC: $image_type = 'swc'; break; + case IMAGETYPE_IFF: $image_type = 'iff'; break; + case IMAGETYPE_WBMP: $image_type = 'wbmp'; break; + case IMAGETYPE_XBM: $image_type = 'xbm'; break; + */ default: $image_type = 'jpeg'; break; + } + + if ( $include_dot ) + $image_type = '.'.$image_type; + + return $image_type; + } +} + + +if( function_comp( 'define_image_vars', 1 ) ) { +function define_image_vars ( ) +{ /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + global + $IMAGE_TYPES, $IMAGE_EXTENSIONS, $IMAGE_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_READ_TYPES, $IMAGE_SUPPORTED_READ_EXTENSIONS, $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_WRITE_TYPES, $IMAGE_SUPPORTED_WRITE_EXTENSIONS, $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_TYPES, $IMAGE_SUPPORTED_EXTENSIONS, $IMAGE_SUPPORTED_TYPES_EXTENSIONS; + if ( isset($IMAGE_TYPES) ) + return true; + +/* $IMAGE_TYPES = array('GIF', 'JPEG', 'PNG', 'SWF', 'PSD', 'BMP', 'TIFF_II', 'TIFF_MM', 'JPC', 'JP2', 'JPX', 'JB2', 'SWC', 'IFF', 'WBMP', 'XBM'); + $IMAGE_EXTENSIONS = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpx', 'jb2', 'swc', 'iff', 'wbmp', 'xbm'); + $IMAGE_TYPES_EXTENSIONS = array( + 'GIF' => array('gif'), + 'JPEG' => array('jpeg','jpg'), + 'PNG' => array('png'), + 'SWF' => array('swf'), + 'PSD' => array('psd'), + 'BMP' => array('bmp'), + 'TIFF_II' => array('tiff'), + 'TIFF_MM' => array('tiff'), + 'JPC' => array('jpc'), + 'JP2' => array('jp2'), + 'JPX' => array('jpx'), + 'JB2' => array('jb2'), + 'SWC' => array('swc'), + 'IFF' => array('iff'), + 'WBMP' => array('wbmp'), + 'XBM' => array('xbm') + ); */ + + $IMAGE_TYPES = array('GIF', 'JPEG', 'PNG'); + $IMAGE_EXTENSIONS = array('gif', 'jpeg', 'jpg', 'png'); + $IMAGE_TYPES_EXTENSIONS = array( + 'GIF' => array('gif'), + 'JPEG' => array('jpeg','jpg'), + 'PNG' => array('png') + ); + + $IMAGE_SUPPORTED_READ_TYPES = array(); + $IMAGE_SUPPORTED_READ_EXTENSIONS = array(); + $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS = array(); + + $IMAGE_SUPPORTED_WRITE_TYPES = array(); + $IMAGE_SUPPORTED_WRITE_EXTENSIONS = array(); + $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS = array(); + + $IMAGE_SUPPORTED_TYPES = array(); + $IMAGE_SUPPORTED_EXTENSIONS = array(); + $IMAGE_SUPPORTED_TYPES_EXTENSIONS = array(); + + for ( $i = 0, $n = sizeof($IMAGE_TYPES); $i < $n; ++$i ) + { + $image_type = $IMAGE_TYPES[$i]; + $image_extensions = $IMAGE_TYPES_EXTENSIONS[$image_type]; + $image_extension = $image_extensions[0]; + + $image_read_function = 'imagecreatefrom'.$image_extension; + $image_supported_read = function_exists($image_read_function); + if ( $image_supported_read ) + { // Add + $IMAGE_SUPPORTED_READ_TYPES[] = $image_type; + $IMAGE_SUPPORTED_READ_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + + $image_write_function = 'image'.$image_extension; + $image_supported_write = function_exists($image_write_function); + if ( $image_supported_write ) + { // Add + $IMAGE_SUPPORTED_WRITE_TYPES[] = $image_type; + $IMAGE_SUPPORTED_WRITE_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + + if ( $image_supported_read && $image_supported_write ) + { // Add + $IMAGE_SUPPORTED_TYPES[] = $image_type; + $IMAGE_SUPPORTED_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + } + + return true; +} +define_image_vars(); +} + +if( function_comp( 'image_read_function', 1 ) ) { +function image_read_function ( $image_extension ) +{ + $image_read_function = 'imagecreatefrom'.$image_extension; + if ( !function_exists($image_read_function) ) + return false; + return $image_read_function; +} +} + +if( function_comp( 'image_write_function', 1 ) ) { +function image_write_function ( $image_extension ) +{ + $image_write_function = 'image'.$image_extension; + if ( !function_exists($image_write_function) ) + return false; + return $image_write_function; +} +} + +if( function_comp( 'read_image', 4 ) ) { + function read_image( $args, $return_info = false ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 4 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 4, 20/07/2007 + * - Cleaned + * Version 3, 12/08/2006 + * - Changed it to use $args + */ + + // Set defaults + $image = NULL; + + // Extract + if ( gettype($args) === 'array' ) + extract($args); + else + $image = $args; + + // Check image + if ( empty($image) ) + { + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image is empty: ['.var_export($image, true).']['.var_export($args, true).'] -->'); + return false; + } + + // Get the type of the image + $type = gettype($image); + + // Do stuff + switch ( $type ) + { + case 'string': + // Try and create it + $result = @imagecreatefromstring($image); + if ( $result ) + return $result; // The image was a binary string + + // Check if it is a file + if ( is_file($image) ) + { + // Get the image type + $image_type = exif_imagetype($image); + if ( !$image_type ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image did not point to a valid image: '."[$image]".' -->'); + return false; + } + + switch ( $image_type ) + { + case 1: { $image_extension = 'gif'; } + break; + case 2: { $image_extension = 'jpeg'; } + break; + case 3: { $image_extension = 'png'; } + break; + default: + return false; + } + + // There is no image_type_to_extension function on PHP < 5.2 + // $image_extension = image_type_to_extension($image_type, false); + + // Check if image is supported + $image_read_function = image_read_function($image_extension); + + if ( !$image_read_function ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Unsupported image type: '."[$image_type][$image_extension]".' -->'); + return false; + } + + // Read the image + $image = call_user_func($image_read_function, $image); + if ( !$image ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Failed to the read the image: '."[$image]".' -->'); + return false; + } + break; + } + + case 'resource': + // Check if it is already a image + if ( @imagesx($image) ) + { // We have a valid image + break; + } + + default: + // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Could not determine the image: '."[$image]:[$image_type]".' -->'); + $image = false; + break; + } + + // return + if ( $return_info ) + { + return compact('image', 'image_extension', 'image_type', 'image_read_function'); + } + + // return + return $image; + } +} + +if( function_comp( 'resize_image', 3 ) ) { + function resize_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 3 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 3, 20/07/2007 + * - Cleaned + * Version 2, 12/08/2006 + * - Changed it to use $args + */ + + // Set default variables + $image + = $width_old = $height_old + = $width_new = $height_new + = $canvas_width = $canvas_size + = NULL; + + $x_old = $y_old + = $x_new = $y_new + = 0; + + // Exract user + extract($args); + + // Read image + $image = read_image($image); + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check new dimensions + if ( empty($width_new) || empty($height_new) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Desired/new dimensions not found -->'; + return false; + } + + // Do old dimensions + if ( empty($width_old) && empty($height_old) ) + { // Get the old dimensions from the image + $width_old = imagesx($image); + $height_old = imagesy($image); + } + + // Do canvas dimensions + if ( empty($canvas_width) && empty($canvas_height) ) + { // Set default + $canvas_width = $width_new; + $canvas_height = $height_new; + } + + // Let's force integer values + $width_old = intval($width_old); + $height_old = intval($height_old); + $width_new = intval($width_new); + $height_new = intval($height_new); + $canvas_width = intval($canvas_width); + $canvas_height = intval($canvas_height); + + // Create the new image + $image_new = imagecreatetruecolor($canvas_width, $canvas_height); + + // Resample the image + $image_result = imagecopyresampled( + // the new image + $image_new, + // the old image to update + $image, + // the new positions + $x_new, $y_new, + // the old positions + $x_old, $y_old, + // the new dimensions + $width_new, $height_new, + // the old dimensions + $width_old, $height_old + ); + + // Check + if ( !$image_result ) + { // ERROR + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': the image failed to resample -->'; + return false; + } + + // return + return $image_new; + } +} + +if( function_comp( 'write_image', 1 ) ) { + function write_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 1, 20/07/2007 + * - Created + */ + + // Set default variables + $image + = $image_type + = $location + = NULL; + + $quality = 95; + + // Exract user + extract($args); + + // If the image is a file + if ( gettype($image) === 'string' && is_file($image) ) + { + // Get the image type + $image_type = exif_imagetype($image); + if ( !$image_type ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image did not point to a valid image: '."[$image]".' -->'); + return false; + } + $image_extension = image_type_to_extension($image_type, false); + + // Check Image + $image = read_image($image); + } + else + { + // Check image type + if ( empty($image_type) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image_type was specified -->'; + return false; + } + } + + // Check image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check if image is supported +// $image_write_function = image_write_function($image_extension); + $image_write_function = 'imagejpeg'; + + if ( !$image_write_function ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Unsupported image type: '."[$image_type][$image_extension]".' -->'); + return false; + } + + // Read the image + ob_start(); + $image = call_user_func($image_write_function, $image, $location, $quality); + $error = strstr(ob_get_contents(), '</b>:'); + ob_end_flush(); + if ( !$image || $error ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Failed to the write the image: '."[$image]".' -->'); + return false; + } + + echo('<!-- debug: '.__FUNCTION__.': '.__LINE__.': '."[$image]".' -->'); + + // Return + return $image; + } +} + +if( function_comp( 'compress_image', 4 ) ) { + function compress_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 4 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 4, 20/07/2007 + * - Cleaned + * Version 3, 12/08/2006 + * - Changed it to use $args + * - Changed it to a 95% compression with a 5% decrease + */ + + // Set default variables + $image + = $image_type + = NULL; + + $quality = 95; + $max_filesize = 0; + + // Exract user + extract($args); + + // Read image + info + $result = read_image($image, true); + if ( !$result ) + return $result; + + // Update info + extract($result); + + // Check Image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Max filesize + if ( !empty($max_size) ) + $max_filesize = $max_size; // backwards compat + + // Do compression + $location = NULL; + ob_start(); + if ( !write_image(compact('image', 'location', 'quality', 'image_type', 'image_extension')) ) + { // Writing the image failed + ob_end_flush(); + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': writing the image failed -->'; + return false; + } + $result = ob_get_contents(); + ob_end_clean(); + + if ( $max_filesize != 0 ) + { // Max filesize is now bytes! + while ( $quality >= 5 && strlen($result) /* current filesize */ > $max_filesize ) + { + ob_start(); + write_image(compact('image', 'location', 'quality', 'image_type', 'image_extension')); + $result = ob_get_contents(); + ob_end_clean(); + $quality -= 5; + } + } + + return $result; + } +} + +if( function_comp( 'remake_image', 9.1 ) ) { + function remake_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 9.1 + * @date December 02, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 9.1, 02/12/2007 + * - Added error checking on write + * Version 9, 20/07/2007 + * - Cleaned + * Version 8, 12/08/2006 + * - Changed it to use $args + * - Changed it to have a 95% compression + */ + + // Set default variables + $image + = $image_type + = NULL; + + $width_new = $height_new = 0; + $resize_mode = 'area'; + $quality = 95; + $max_filesize = 0; + + // Exract args + extract($args); + + // Read image + info + $result = read_image($image, true); + if ( !$result ) + return $result; + + // Update info + extract($result); + + // Check Image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check new dimensions + if ( !isset($args['width_new']) || !isset($args['height_new']) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Desired/new dimensions not found -->'; + return false; + } + + // Do old dimensions + if ( empty($width_old) && empty($height_old) ) + { // Get the old dimensions from the image + $width_old = imagesx($image); + $height_old = imagesy($image); + } + + // Let's force integer values + $width_old = intval($width_old); + $height_old = intval($height_old); + $width_new = intval($width_new); + $height_new = intval($height_new); + + // Max filesize + if ( !empty($size) ) + $max_filesize = $size; // backwards compat + if ( !empty($max_size) ) + $max_filesize = $max_size; // backwards compat + + + # REMAKE THE IMAGE + + // Get new resize stuff + $result = resize(compact('image', 'resize_mode', 'width_old', 'height_old', 'width_new', 'height_new')); + if ( !$result ) + return $result; + + // Update variables + extract($result); + + // Resize the image + $resize_image = compact( + 'image', + 'width_old', 'height_old', + 'width_new', 'height_new', + 'canvas_width', 'canvas_height', + 'x_old', 'y_old', + 'x_new', 'y_new' + ); + + /* + echo '<!-- resize_image'. + "\r\n".print_r($resize_image, true). + "\r\n".'-->'."\r\n"; + */ + + $image = resize_image($resize_image); + if ( !$image ) + return $image; + + // Compress the image + $compress_image = compact('image', 'max_filesize', 'quality', 'image_type', 'image_extension'); + + /* + echo '<!-- compress_image'. + "\r\n".print_r($compress_image, true). + "\r\n".'-->'."\r\n"; + */ + + $image = compress_image($compress_image); + if ( !$image ) + return $image; + + // Return the image + return $image; + } +} + +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.txt =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.txt (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/_image.funcs.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,956 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryGroup + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +require_once(dirname(__FILE__).'/_general.funcs.php'); + +if( function_comp( 'resize', 8 ) ) { + function resize( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 8 + * @date December 02, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * v8, 02/12/2007 + * - Cleaned by using math instead of logic + * - Restructured the code + * - Re-organised variable names + * v7, 20/07/2007 + * - Cleaned + * v6, + * - Added cropping + * v5, 12/08/2006 + * - Changed to use args + */ + + /* + The 'exact' resize mode, will resize things to the exact limit. + If a width or height is 0, the appropriate value will be calculated by ratio + Results with a 800x600 limit: + *x* -> 800x600 + Results with a 0x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 + 96x48 -> 1200x600 + 1000x500 -> 1200x600 + Results with a 800x0 limit: + 1280x1024 -> 800x640 + 1900x1200 -> 800x505 + 96x48 -> 800x400 + 1000x500 -> 800x400 + */ + + /* + The 'area' resize mode, will resize things to fit within the area. + If a width or height is 0, the appropriate value will be calculated by ratio + Results with a 800x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 -> 800x505 + 96x48 -> 96x48 no change + 1000x500 -> 800x400 = '800x'.(800/100)*500 + Results with a 0x600 limit: + 1280x1024 -> 750x600 + 1900x1200 -> 950x600 + 96x48 -> 96x48 no change + 1000x500 -> 1000x500 no change + Results with a 800x0 limit: + 1280x1024 -> 800x640 + 1900x1200 -> 950x600 -> 800x505 + 96x48 -> 96x48 no change + 1000x500 -> 800x400 = '800x'.(800/1000)*500 + */ + + // --------- + extract($args); + + // --------- + if ( !isset($width_original) && isset($width_old) ) + { $width_original = $width_old; unset($width_old); } + if ( !isset($height_original) && isset($height_old) ) + { $height_original = $height_old; unset($height_old); } + + // + if ( !isset($width_original) && !isset($height_original) && isset($image) ) + { // Get from image + $image = read_image($image); + $width_original = imagesx($image); + $height_original = imagesy($image); + } + + // + if ( empty($width_original) || empty($height_original) ) + { // + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no original dimensions specified -->'; + return false; + } + + // --------- + if ( !isset($width_desired) && isset($width_new) ) + { $width_desired = $width_new; unset($width_new); } + if ( !isset($height_desired) && isset($height_new) ) + { $height_desired = $height_new; unset($height_new); } + + // + if ( empty($width_desired) || empty($height_desired) ) + { // Don't do any resizing + echo '<!-- WARNING: '.__FUNCTION__.': '.__LINE__.': no desired dimensions specified -->'; + // return array( 'width' => $width_original, 'height' => $height_original ); + } + + // --------- + if ( !isset($resize_mode) ) + $resize_mode = 'area'; + elseif ( $resize_mode === 'none' ) + { // Don't do any resizing + echo '<!-- WARNING: '.__FUNCTION__.': '.__LINE__.': $resize_mode === \'none\' -->'; + // return array( 'width' => $width_original, 'height' => $height_original ); + } + elseif ( !in_array($resize_mode, array('area', 'crop', 'exact', true) ) ) + { // + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Passed $resize_mode is not valid: '."[$resize_mode]".' -->'); + return false; + } + + // --------- + if ( !isset($x_original) && isset($x_old) ) + { $x_original = $x_old; unset($x_old); } + if ( !isset($y_original) && isset($y_old) ) + { $y_original = $y_old; unset($y_old); } + if ( !isset($x_original) ) $x_original = 0; + if ( !isset($y_original) ) $y_original = 0; + + // --------- + // Let's force integer values + $width_original = intval($width_original); + $height_original = intval($height_original); + $width_desired = intval($width_desired); + $height_desired = intval($height_desired); + + // --------- + // Set proportions + if ( $height_original !== 0 ) + $proportion_wh = $width_original / $height_original; + if ( $width_original !== 0 ) + $proportion_hw = $height_original / $width_original; + + if ( $height_desired !== 0 ) + $proportion_wh_desired = $width_desired / $height_desired; + if ( $width_desired !== 0 ) + $proportion_hw_desired = $height_desired / $width_desired; + + // --------- + // Set cutoms + $x_new = $x_original; + $y_new = $y_original; + $canvas_width = $canvas_height = NULL; + + // --------- + $width_new = $width_original; + $height_new = $height_original; + + // --------- + // Do resize + if ( $height_desired === 0 && $width_desired === 0 ) + { // Nothing to do + } + elseif ( $height_desired === 0 && $width_desired !== 0 ) + { // We don't care about the height + $width_new = $width_desired; + if ( $resize_mode !== 'exact' ) $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + } + elseif ( $height_desired !== 0 && $height_desired === 0 ) + { // We don't care about the width + if ( $resize_mode !== 'exact' ) $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + } + else + { // We care about both + + if ( $resize_mode === 'exact' || /* no upscaling */ ($width_original <= $width_desired && $height_original <= $height_desired) ) + { // Nothing to do + } + elseif ( $resize_mode === 'area' ) + { // Proportion to fit inside + + // Pick which option + if ( $proportion_wh <= $proportion_wh_desired ) + { // Option 1: wh + // Height would of overflowed + $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + } + else + // if ( $proportion_hw <= $proportion_hw_desired ) + { // Option 2: hw + // Width would of overflowed + $width_new = $width_desired; + $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + } + + } + elseif ( $resize_mode === 'crop' ) + { // Proportion to occupy + + // Pick which option + if ( $proportion_wh <= $proportion_wh_desired ) + { // Option 2: hw + // Height will overflow + $width_new = $width_desired; + $height_new = $width_desired * $proportion_hw; // h = w*(h/w) + // Set custom + $y_new = -($height_new-$height_desired)/2; + } + else + // if ( $proportion_hw <= $proportion_hw_desired ) + { // Option 1: hw + // Width will overflow + $width_new = $height_desired * $proportion_wh; // w = h*(w/h) + $height_new = $height_desired; + // Set custom + $x_new = -($width_new-$width_desired)/2; + } + + // Set canvas + $canvas_width = $width_desired; + $canvas_height = $height_desired; + + } + + } + + // --------- + // Set custom if they have not been set already + if ( $canvas_width === NULL ) + $canvas_width = $width_new; + if ( $canvas_height === NULL ) + $canvas_height = $height_new; + + // --------- + // Compat + $width_old = $width_original; + $height_old = $height_original; + $x_old = $x_original; + $y_old = $y_original; + + // --------- + // Return + $return = compact( + 'width_original', 'height_original', + 'width_old', 'height_old', + 'width_desired', 'height_desired', + 'width_new', 'height_new', + 'canvas_width', 'canvas_height', + 'x_original', 'y_original', + 'x_old', 'y_old', + 'x_new', 'y_new' + ); + // echo '<--'; var_dump($return); echo '-->'; + return $return; + } +} + +if ( !function_exists('exif_imagetype') ) +{ + function exif_imagetype ( $image_location ) + { + $image_size = getimagesize($image_location); + if ( !$image_size ) + return $image_size; + $image_type = $image_size[2]; + return $image_type; + } +} + +if( !function_exists('image_type_to_extension') ) { + function image_type_to_extension ( $image_type, $include_dot = true ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 1, 20/07/2007 + * - created + */ + + switch ( $image_type ) + { + case IMAGETYPE_GIF: $image_type = 'gif'; break; + case IMAGETYPE_JPEG: $image_type = 'jpeg'; break; + case IMAGETYPE_PNG: $image_type = 'png'; break; + case IMAGETYPE_SWF: $image_type = 'swf'; break; + case IMAGETYPE_PSD: $image_type = 'psd'; break; + case IMAGETYPE_BMP: $image_type = 'bmp'; break; + case IMAGETYPE_TIFF_II: $image_type = 'tiff'; break; + case IMAGETYPE_TIFF_MM: $image_type = 'tiff'; break; + case IMAGETYPE_JPC: $image_type = 'jpc'; break; + case IMAGETYPE_JP2: $image_type = 'jp2'; break; + case IMAGETYPE_JPX: $image_type = 'jpx'; break; + case IMAGETYPE_JB2: $image_type = 'jb2'; break; + case IMAGETYPE_SWC: $image_type = 'swc'; break; + case IMAGETYPE_IFF: $image_type = 'iff'; break; + case IMAGETYPE_WBMP: $image_type = 'wbmp'; break; + case IMAGETYPE_XBM: $image_type = 'xbm'; break; + default: $image_type = false; break; + } + + if ( $include_dot ) + $image_type = '.'.$image_type; + + return $image_type; + } +} + + +if( function_comp( 'define_image_vars', 1 ) ) { +function define_image_vars ( ) +{ /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + global + $IMAGE_TYPES, $IMAGE_EXTENSIONS, $IMAGE_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_READ_TYPES, $IMAGE_SUPPORTED_READ_EXTENSIONS, $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_WRITE_TYPES, $IMAGE_SUPPORTED_WRITE_EXTENSIONS, $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS, + $IMAGE_SUPPORTED_TYPES, $IMAGE_SUPPORTED_EXTENSIONS, $IMAGE_SUPPORTED_TYPES_EXTENSIONS; + if ( isset($IMAGE_TYPES) ) + return true; + +/* $IMAGE_TYPES = array('GIF', 'JPEG', 'PNG', 'SWF', 'PSD', 'BMP', 'TIFF_II', 'TIFF_MM', 'JPC', 'JP2', 'JPX', 'JB2', 'SWC', 'IFF', 'WBMP', 'XBM'); + $IMAGE_EXTENSIONS = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpx', 'jb2', 'swc', 'iff', 'wbmp', 'xbm'); + $IMAGE_TYPES_EXTENSIONS = array( + 'GIF' => array('gif'), + 'JPEG' => array('jpeg','jpg'), + 'PNG' => array('png'), + 'SWF' => array('swf'), + 'PSD' => array('psd'), + 'BMP' => array('bmp'), + 'TIFF_II' => array('tiff'), + 'TIFF_MM' => array('tiff'), + 'JPC' => array('jpc'), + 'JP2' => array('jp2'), + 'JPX' => array('jpx'), + 'JB2' => array('jb2'), + 'SWC' => array('swc'), + 'IFF' => array('iff'), + 'WBMP' => array('wbmp'), + 'XBM' => array('xbm') + ); */ + + $IMAGE_TYPES = array('GIF', 'JPEG', 'PNG'); + $IMAGE_EXTENSIONS = array('gif', 'jpeg', 'jpg', 'png'); + $IMAGE_TYPES_EXTENSIONS = array( + 'GIF' => array('gif'), + 'JPEG' => array('jpeg','jpg'), + 'PNG' => array('png') + ); + + $IMAGE_SUPPORTED_READ_TYPES = array(); + $IMAGE_SUPPORTED_READ_EXTENSIONS = array(); + $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS = array(); + + $IMAGE_SUPPORTED_WRITE_TYPES = array(); + $IMAGE_SUPPORTED_WRITE_EXTENSIONS = array(); + $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS = array(); + + $IMAGE_SUPPORTED_TYPES = array(); + $IMAGE_SUPPORTED_EXTENSIONS = array(); + $IMAGE_SUPPORTED_TYPES_EXTENSIONS = array(); + + for ( $i = 0, $n = sizeof($IMAGE_TYPES); $i < $n; ++$i ) + { + $image_type = $IMAGE_TYPES[$i]; + $image_extensions = $IMAGE_TYPES_EXTENSIONS[$image_type]; + $image_extension = $image_extensions[0]; + + $image_read_function = 'imagecreatefrom'.$image_extension; + $image_supported_read = function_exists($image_read_function); + if ( $image_supported_read ) + { // Add + $IMAGE_SUPPORTED_READ_TYPES[] = $image_type; + $IMAGE_SUPPORTED_READ_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_READ_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + + $image_write_function = 'image'.$image_extension; + $image_supported_write = function_exists($image_write_function); + if ( $image_supported_write ) + { // Add + $IMAGE_SUPPORTED_WRITE_TYPES[] = $image_type; + $IMAGE_SUPPORTED_WRITE_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_WRITE_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + + if ( $image_supported_read && $image_supported_write ) + { // Add + $IMAGE_SUPPORTED_TYPES[] = $image_type; + $IMAGE_SUPPORTED_EXTENSIONS += $image_extensions; + $IMAGE_SUPPORTED_TYPES_EXTENSIONS[$image_type] = $image_extensions; + } + } + + return true; +} +define_image_vars(); +} + +if( function_comp( 'image_read_function', 1 ) ) { +function image_read_function ( $image_extension ) +{ + $image_read_function = 'imagecreatefrom'.$image_extension; + if ( !function_exists($image_read_function) ) + return false; + return $image_read_function; +} +} + +if( function_comp( 'image_write_function', 1 ) ) { +function image_write_function ( $image_extension ) +{ + $image_write_function = 'image'.$image_extension; + if ( !function_exists($image_write_function) ) + return false; + return $image_write_function; +} +} + +if( function_comp( 'read_image', 4 ) ) { + function read_image( $args, $return_info = false ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 4 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 4, 20/07/2007 + * - Cleaned + * Version 3, 12/08/2006 + * - Changed it to use $args + */ + + // Set defaults + $image = NULL; + + // Extract + if ( gettype($args) === 'array' ) + extract($args); + else + $image = $args; + + // Check image + if ( empty($image) ) + { + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image is empty: ['.var_export($image, true).']['.var_export($args, true).'] -->'); + return false; + } + + // Get the type of the image + $type = gettype($image); + + // Do stuff + switch ( $type ) + { + case 'string': + // Try and create it + $result = @imagecreatefromstring($image); + if ( $result ) + return $result; // The image was a binary string + + // Check if it is a file + if ( is_file($image) ) + { + // Get the image type + $image_type = exif_imagetype($image); + if ( !$image_type ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image did not point to a valid image: '."[$image]".' -->'); + return false; + } + $image_extension = image_type_to_extension($image_type, false); + + // Check if image is supported + $image_read_function = image_read_function($image_extension); + if ( !$image_read_function ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Unsupported image type: '."[$image_type][$image_extension]".' -->'); + return false; + } + + // Read the image + $image = call_user_func($image_read_function, $image); + if ( !$image ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Failed to the read the image: '."[$image]".' -->'); + return false; + } + break; + } + + case 'resource': + // Check if it is already a image + if ( @imagesx($image) ) + { // We have a valid image + break; + } + + default: + // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Could not determine the image: '."[$image]:[$image_type]".' -->'); + $image = false; + break; + } + + // return + if ( $return_info ) + { + return compact('image', 'image_extension', 'image_type', 'image_read_function'); + } + + // return + return $image; + } +} + +if( function_comp( 'resize_image', 3 ) ) { + function resize_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 3 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 3, 20/07/2007 + * - Cleaned + * Version 2, 12/08/2006 + * - Changed it to use $args + */ + + // Set default variables + $image + = $width_old = $height_old + = $width_new = $height_new + = $canvas_width = $canvas_size + = NULL; + + $x_old = $y_old + = $x_new = $y_new + = 0; + + // Exract user + extract($args); + + // Read image + $image = read_image($image); + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check new dimensions + if ( empty($width_new) || empty($height_new) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Desired/new dimensions not found -->'; + return false; + } + + // Do old dimensions + if ( empty($width_old) && empty($height_old) ) + { // Get the old dimensions from the image + $width_old = imagesx($image); + $height_old = imagesy($image); + } + + // Do canvas dimensions + if ( empty($canvas_width) && empty($canvas_height) ) + { // Set default + $canvas_width = $width_new; + $canvas_height = $height_new; + } + + // Let's force integer values + $width_old = intval($width_old); + $height_old = intval($height_old); + $width_new = intval($width_new); + $height_new = intval($height_new); + $canvas_width = intval($canvas_width); + $canvas_height = intval($canvas_height); + + // Create the new image + $image_new = imagecreatetruecolor($canvas_width, $canvas_height); + + // Resample the image + $image_result = imagecopyresampled( + // the new image + $image_new, + // the old image to update + $image, + // the new positions + $x_new, $y_new, + // the old positions + $x_old, $y_old, + // the new dimensions + $width_new, $height_new, + // the old dimensions + $width_old, $height_old + ); + + // Check + if ( !$image_result ) + { // ERROR + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': the image failed to resample -->'; + return false; + } + + // return + return $image_new; + } +} + +if( function_comp( 'write_image', 1 ) ) { + function write_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 1 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 1, 20/07/2007 + * - Created + */ + + // Set default variables + $image + = $image_type + = $location + = NULL; + + $quality = 95; + + // Exract user + extract($args); + + // If the image is a file + if ( gettype($image) === 'string' && is_file($image) ) + { + // Get the image type + $image_type = exif_imagetype($image); + if ( !$image_type ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': $image did not point to a valid image: '."[$image]".' -->'); + return false; + } + $image_extension = image_type_to_extension($image_type, false); + + // Check Image + $image = read_image($image); + } + else + { + // Check image type + if ( empty($image_type) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image_type was specified -->'; + return false; + } + } + + // Check image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check if image is supported + $image_write_function = image_write_function($image_extension); + if ( !$image_write_function ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Unsupported image type: '."[$image_type][$image_extension]".' -->'); + return false; + } + + /* // Check image type + if ( $image_type == '3' ) + { // PHP 5 hack + $quality = ( round(($quality / 10), 0)) -1 ; + echo 'Rounded to <b>'.$quality.'</b>'; + return; + } + */ + // Read the image + ob_start(); + $image = call_user_func($image_write_function, $image, $location, $quality); + $error = strstr(ob_get_contents(), '</b>:'); + ob_end_flush(); + if ( !$image || $error ) + { // Error + echo('<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Failed to the write the image: '."[$image]".' -->'); + return false; + } + + echo('<!-- debug: '.__FUNCTION__.': '.__LINE__.': '."[$image]".' -->'); + + // Return + return $image; + } +} + +if( function_comp( 'compress_image', 4 ) ) { + function compress_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 4 + * @date July 20, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 4, 20/07/2007 + * - Cleaned + * Version 3, 12/08/2006 + * - Changed it to use $args + * - Changed it to a 95% compression with a 5% decrease + */ + + // Set default variables + $image + = $image_type + = NULL; + + $quality = 95; + $max_filesize = 0; + + // Exract user + extract($args); + + // Read image + info + $result = read_image($image, true); + if ( !$result ) + return $result; + + // Update info + extract($result); + + // Check Image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Max filesize + if ( !empty($max_size) ) + $max_filesize = $max_size; // backwards compat + + // Do compression + $location = NULL; + ob_start(); + if ( !write_image(compact('image', 'location', 'quality', 'image_type', 'image_extension')) ) + { // Writing the image failed + ob_end_flush(); + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': writing the image failed -->'; + return false; + } + $result = ob_get_contents(); + ob_end_clean(); + + if ( $max_filesize != 0 ) + { // Max filesize is now bytes! + while ( $quality >= 5 && strlen($result) /* current filesize */ > $max_filesize ) + { + ob_start(); + write_image(compact('image', 'location', 'quality', 'image_type', 'image_extension')); + $result = ob_get_contents(); + ob_end_clean(); + $quality -= 5; + } + } + + return $result; + } +} + +if( function_comp( 'remake_image', 9.1 ) ) { + function remake_image( $args ) + { /* + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 9.1 + * @date December 02, 2007 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + /* + * Changelog + * + * Version 9.1, 02/12/2007 + * - Added error checking on write + * Version 9, 20/07/2007 + * - Cleaned + * Version 8, 12/08/2006 + * - Changed it to use $args + * - Changed it to have a 95% compression + */ + + // Set default variables + $image + = $image_type + = NULL; + + $width_new = $height_new = 0; + $resize_mode = 'area'; + $quality = 95; + $max_filesize = 0; + + // Exract args + extract($args); + + // Read image + info + $result = read_image($image, true); + if ( !$result ) + return $result; + + // Update info + extract($result); + + // Check Image + if ( empty($image) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': no image was specified -->'; + return false; + } + + // Check new dimensions + if ( !isset($args['width_new']) || !isset($args['height_new']) ) + { // error + echo '<!-- ERROR: '.__FUNCTION__.': '.__LINE__.': Desired/new dimensions not found -->'; + return false; + } + + // Do old dimensions + if ( empty($width_old) && empty($height_old) ) + { // Get the old dimensions from the image + $width_old = imagesx($image); + $height_old = imagesy($image); + } + + // Let's force integer values + $width_old = intval($width_old); + $height_old = intval($height_old); + $width_new = intval($width_new); + $height_new = intval($height_new); + + // Max filesize + if ( !empty($size) ) + $max_filesize = $size; // backwards compat + if ( !empty($max_size) ) + $max_filesize = $max_size; // backwards compat + + + # REMAKE THE IMAGE + + // Get new resize stuff + $result = resize(compact('image', 'resize_mode', 'width_old', 'height_old', 'width_new', 'height_new')); + if ( !$result ) + return $result; + + // Update variables + extract($result); + + // Resize the image + $resize_image = compact( + 'image', + 'width_old', 'height_old', + 'width_new', 'height_new', + 'canvas_width', 'canvas_height', + 'x_old', 'y_old', + 'x_new', 'y_new' + ); + + /* + echo '<!-- resize_image'. + "\r\n".print_r($resize_image, true). + "\r\n".'-->'."\r\n"; + */ + + $image = resize_image($resize_image); + if ( !$image ) + return $image; + + // Compress the image + $compress_image = compact('image', 'max_filesize', 'quality', 'image_type', 'image_extension'); + + /* + echo '<!-- compress_image'. + "\r\n".print_r($compress_image, true). + "\r\n".'-->'."\r\n"; + */ + + $image = compress_image($compress_image); + if ( !$image ) + return $image; + + // Return the image + return $image; + } +} + +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/functions/_scan_dir.funcs.php =================================================================== --- avatars_plugin/branches/2.2.7/resources/functions/_scan_dir.funcs.php (rev 0) +++ avatars_plugin/branches/2.2.7/resources/functions/_scan_dir.funcs.php 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,267 @@ +<?php +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryGroup + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + +require_once(dirname(__FILE__).'/_general.funcs.php'); + +if( function_comp( 'scan_dir', 6 ) ) { + + function scan_dir ($dir, $pattern = NULL, $action = NULL, $prepend = '', $return_format = NULL) + { /* + * This function scans the directory then for files that match the given details, perform a action on them + * EXPORT: An array containing the location of the files which the action was performed on. + * + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibraryFunction + * @package baluptonResourceLibrary + * @version 6 + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ + + // If we want to include the [ files || dirs ] in the output we make + // [ $file_pattern = true or $file_pattern = string || $dir_pattern = true or $dir_pattern = string ] + // If we do not want to include a [ dir || file ] we do + // [ $file_pattern = false || $dir_pattern = false ] + // If we do not want to recurse in the action set + // $continue = true + + // Create Valid Directory + $dir = realpath($dir); + if ( !$dir ) + return array(); + $dir = str_replace('\\', '/', $dir); + if ( is_dir($dir) ) + $dir .= '/'; + + // Get on with the script + $files = array(); // Define our array to return + if ( $return_format === 'seperate' ) + { // Add extra + $files['dirs'] = $files['files'] = array(); + } + + // Set defaults + $file_pattern = $dir_pattern = $both_pattern = true; + $both_action = $file_action = $dir_action = NULL; + + // Handle pattern + if ( !empty($pattern) ) + // We have a pattern + switch ( $pattern ) + { // Replace the pattern if it is predefined + case 'php': + $file_pattern = '/^(.+)\.php$/'; + $dir_pattern = NULL; + break; + case 'inc_php': + $file_pattern = '/^(_.+)\.php$/'; + $dir_pattern = NULL; + break; + case 'image': + $file_pattern = '/^(.+)\.(jpg|jpeg|gif|png|tiff|bmp|xbmp)$/i'; + $dir_pattern = NULL; + break; + case 'file': + case 'files': + $dir_pattern = NULL; + break; + case 'directory': + case 'directories': + $file_pattern = NULL; + break; + default: + if ( is_array($pattern) ) + { + $file_pattern_exists = array_key_exists('file', $pattern); + if ( $file_pattern_exists ) $dir_pattern = NULL; + + $dir_pattern_exists = array_key_exists('dir', $pattern); + if ( $dir_pattern_exists ) $file_pattern = NULL; + + $both_pattern_exists = array_key_exists('both', $pattern); + + if ( $file_pattern_exists ) $file_pattern = $pattern['file']; + if ( $dir_pattern_exists ) $dir_pattern = $pattern['dir']; + if ( $both_pattern_exists ) $both_pattern = $pattern['both']; + } + else + { + $file_pattern = $pattern; + $dir_pattern = NULL; + } + break; + } + $pattern = array('both'=>$both_pattern,'file'=>$file_pattern,'dir'=>$dir_pattern); + + // Handle action + if ( !empty($action) ) + // We have a pattern + switch ( $action ) + { // Replace the pattern if it is predefined + case 'no_recurse': + $dir_action = 'if ( $dir !== \''.$dir.'\' ) { $skip = true; }'; + break; + default: + if ( is_array($action) ) + { + if ( isset($action['file']) ) $file_action = $action['file']; + if ( isset($action['dir']) ) $dir_action = $action['dir']; + if ( isset($action['both']) ) $both_action = $action['both']; + } + else + { + $file_action = $action; + } + break; + } + $action = array('both'=>$both_action,'file'=>$file_action,'dir'=>$dir_action); + + // Get down to business + $both_matches = $file_matches = $dir_matches = array(); + if ( $dh = opendir($dir) ) + { // Open the directory + // Go through the directory and include the files that match the given regular expression + while (($file = readdir($dh)) !== false) + { // Cycle through files + $skip = false; + $path = $dir.$file; + if ( !empty($file) && substr($file,0,1) != '.' ) + { // We have a file or directory + + // Check + if ( $both_pattern === true || $both_pattern === NULL || ($both_pattern !== false && preg_match($both_pattern, $file, $both_matches)) ) + { // passed check + } else + { // failed check + continue; // continue to next file + } + + // Perform custom action + eval($both_action); // Custom action + if ( $skip ) continue; + + // Continue with specifics + if ( is_file($path) ) + { // We have a file + + // Check + if ( $file_pattern === true || $file_pattern === NULL || ($file_pattern !== false && preg_match($file_pattern, $file, $file_matches)) ) + { // passed check + } else + { // failed check + continue; // continue to next file + } + + // Perform custom action + eval( $file_action ); // Custom action + if ( $skip ) continue; + + // Return + if ( $file_pattern !== NULL ) + // We want to return, so it is either TRUE or STRING as if it was FALSE we would of continued + switch ( $return_format ) + { // Work with the return + + case 'seperate': + $files['files'][] = $prepend.$file; // Append the file location to the array to be returned + break; + + case 'tree2': + $filename = $file; + $end = strrpos($filename, '.'); + if ( $end !== -1 ) + $filename = substr($filename, 0, $end); + $files[$filename] = $prepend.$file; // Append the file location to the array to be returned + break; + + case 'tree': + $files[] = $file; // Append the file name to the array to be returned + /* + $filename = $file; + $end = strrpos($filename, '.'); + if ( $end !== -1 ) + $filename = substr($filename, 0, $end); + $files[$filename] = $prepend.$file; // Append the file location to the array to be returned + */ + break; + + default: + $files[] = $prepend.$file; // Append the file location to the array to be returned + break; + } + } + elseif ( is_dir($path) ) + { // We have a dir + + // Check + if ( $dir_pattern === true || $dir_pattern === NULL || ($dir_pattern !== false && preg_match($dir_pattern, $file, $dir_matches)) ) + { // passed check + } else + { // failed check + continue; // continue to next file + } + + // Perform custom action + eval( $dir_action ); // Custom action + if ( $skip ) continue; + + // Return + switch ( $return_format ) + { // Work with the return + + case 'seperate': + if ( $dir_pattern !== NULL ) + { // We want to return, so it is either TRUE or STRING as if it was FALSE we would of continued + $files['dirs'][] = $prepend.$file; // Append the file location to the array to be returned + } + $scan_dir = scan_dir($path, $pattern, $action, $prepend.$file.'/', $return_format); + $files['files'] = array_merge($files['files'], $scan_dir['files']); + $files['dirs'] = array_merge($files['dirs'], $scan_dir['dirs']); + unset($scan_dir); + break; + + case 'tree2': + case 'tree': + $files[$file] = + scan_dir($path, $pattern, $action, $prepend.$file.'/', $return_format); + break; + + default: + if ( $dir_pattern !== NULL ) + { // We want to return, so it is either TRUE or STRING as if it was FALSE we would of continued + $files[] = $prepend.$file; // Append the file location to the array to be returned + } + $files = array_merge( + $files, + scan_dir($path, $pattern, $action, $prepend.$file.'/', $return_format) + ); + break; + } + } // end file or dir compare + + } // end is file or dor + + } // end while + + closedir($dh); // Close the directory + + } // end open dir + + return $files; + + } // END: scan_dir + +} // END: function_exists + +?> \ No newline at end of file Added: avatars_plugin/branches/2.2.7/resources/readme.txt =================================================================== --- avatars_plugin/branches/2.2.7/resources/readme.txt (rev 0) +++ avatars_plugin/branches/2.2.7/resources/readme.txt 2012-03-05 01:37:36 UTC (rev 1238) @@ -0,0 +1,13 @@ +/** + * Balupton's Resource Library + * + * This resource library is a collection of resources that balupton has developer (or collected) over time. + * It allows him to develop high quality code fast and effeciently. + * + * @name Balupton's Resource Library + * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @category resourceLibrary + * @package baluptonResourceLibrary + * @copyright (c) 2007 Benjamin "balupton" Lupton {@link http://www.balupton.com} + * @license Attribution-Share Alike 2.5 Australia - {@link http://creativecommons.org/licenses/by-sa/2.5/au/} + */ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |