blogs/0000755000000000000000000000000011077645205010671 5ustar rootrootblogs/wp-feed.php0000644000000000000000000000122511077635520012730 0ustar rootroot blogs/wpmu-settings.php0000644000000000000000000002201211077635520014224 0ustar rootrootget_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) ); if( $current_site != null ) { $path = '/'; return $current_site; } $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) ); if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { if( count( $sites ) == 1 ) { $current_site = $sites[0]; die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" ); } else { die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." ); } } else { $path = '/'; } } else { $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) ); if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { if( count( $sites ) == 1 ) { $current_site = $sites[0]; die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" ); } else { die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." ); } } else { $path = '/'; } } return $current_site; } $wpdb->suppress_errors(); $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site if( count( $sites ) == 1 ) { $current_site = $sites[0]; $path = $current_site->path; } else { $current_site = wpmu_current_site(); } if( constant( 'VHOST' ) == 'yes' ) { $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'"); if( $current_blog != null ) { $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id) ); } else { $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); } } else { $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); if( strpos( $blogname, '/' ) ) $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) ); if( strpos( " ".$blogname, '?' ) ) $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) ); $blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' ); if( $blogname == '' || in_array( $blogname, $blognames ) || is_file( $blogname ) || is_blogname_page( $blogname ) ) { $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path) ); } else { $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path.$blogname.'/') ); } } if( defined( "WP_INSTALLING" ) == false ) { if( $current_site && $current_blog == null ) { $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path) ); } if( $current_blog == false || $current_site == false ) is_installed(); } function is_blogname_page( $blogname ) { global $wpdb, $table_prefix, $domain, $path; $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path) ); // is the request for a page of the main blog? We need to cache this information somewhere to save a request $pages = $wpdb->get_col( "SELECT LOWER(post_name) FROM {$table_prefix}{$blog_id}_posts WHERE post_type='page'" ); if( is_array( $pages ) == false ) return false; if( in_array( strtolower( $blogname ), $pages ) ) { return true; } else { return false; } } $blog_id = $current_blog->blog_id; $public = $current_blog->public; if( $current_blog->site_id == 0 || $current_blog->site_id == '' ) $current_blog->site_id = 1; $site_id = $current_blog->site_id; $current_site->site_name = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $site_id) ); if( $current_site->site_name == null ) $current_site->site_name = ucfirst( $current_site->domain ); if( $blog_id == false ) { // no blog found, are we installing? Check if the table exists. if ( defined('WP_INSTALLING') ) { $blog_id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs LIMIT 0,1" ); if( $blog_id == false ) { // table doesn't exist. This is the first blog $blog_id = 1; } else { // table exists // don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like. // default to using the "main" blog. $blog_id = 1; } $current_blog->blog_id = $blog_id; } else { $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); if( $check == false ) { $msg = ': DB Tables Missing'; } else { $msg = ''; } die( "No Blog by that name on this system." . $msg ); } } $wpdb->suppress_errors( false ); if( '0' == $current_blog->public ) { // This just means the blog shouldn't show up in google, etc. Only to registered members } function is_installed() { global $wpdb, $domain, $path; $base = stripslashes( $base ); if( defined( "WP_INSTALLING" ) == false ) { $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); $msg = "If your blog does not display, please contact the owner of this site.

If you are the owner of this site please check that MySQL is running properly and all tables are error free.

"; if( $check == false ) { $msg .= "Database Tables Missing.
Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really should look at your database now.
"; } else { $msg .= 'Could Not Find Blog!
'; $msg .= "Searched for " . $domain . $path . " in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right?
"; } $msg .= "
\n

What do I do now?

"; $msg .= "Read the bug report page. Some of the guidelines there may help you figure out what went wrong.
"; $msg .= "If you're still stuck with this message, then check that your database contains the following tables:"; $msg .= "If you suspect a problem please report it to the support forums but you must include the information asked for in the WPMU bug reporting guidelines!

"; if( is_file( 'release-info.txt' ) ) { $msg .= 'Your bug report must include the following text: "'; $info = file( 'release-info.txt' ); $msg .= $info[ 4 ] . '"'; } die( "

Fatal Error

" . $msg ); } } ?> blogs/license.txt0000644000000000000000000003542711077635520013066 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS blogs/wp-settings.php0000644000000000000000000004527411077635520013701 0ustar rootroot $v ) if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { $GLOBALS[$k] = NULL; unset($GLOBALS[$k]); } } wp_unregister_GLOBALS(); unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate ); /** * The $blog_id global, which you can change in the config allows you to create a simple * multiple blog installation using just one WordPress and changing $blog_id around. * * @global int $blog_id * @since 2.0.0 */ if ( ! isset($blog_id) ) $blog_id = 0; // Fix for IIS, which doesn't set REQUEST_URI if ( empty( $_SERVER['REQUEST_URI'] ) ) { // IIS Mod-Rewrite if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } // IIS Isapi_Rewrite else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } else { // Use ORIG_PATH_INFO if there is no PATH_INFO if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) if ( isset($_SERVER['PATH_INFO']) ) { if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; else $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; } // Append the query string if it exists and isn't null if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } } // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; // Fix for Dreamhost and other PHP as CGI hosts if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) unset($_SERVER['PATH_INFO']); if ( version_compare( '4.3', phpversion(), '>' ) ) { die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); } if ( !defined('WP_CONTENT_DIR') ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); /** * timer_start() - PHP 4 standard microtime start capture * * @access private * @since 0.71 * @global int $timestart Seconds and Microseconds added together from when function is called * @return bool Always returns true */ function timer_start() { global $timestart; $mtime = explode(' ', microtime() ); $mtime = $mtime[1] + $mtime[0]; $timestart = $mtime; return true; } /** * timer_stop() - Return and/or display the time from the page start to when function is called. * * You can get the results and print them by doing: * * $nTimePageTookToExecute = timer_stop(); * echo $nTimePageTookToExecute; * * * Or instead, you can do: * * timer_stop(1); * * which will do what the above does. If you need the result, you can assign it to a variable, but * most cases, you only need to echo it. * * @since 0.71 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called * @global int $timeend Seconds and Microseconds added together from when function is called * * @param int $display Use '0' or null to not echo anything and 1 to echo the total time * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. * @return float The "second.microsecond" finished time calculation */ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal global $timestart, $timeend; $mtime = microtime(); $mtime = explode(' ',$mtime); $mtime = $mtime[1] + $mtime[0]; $timeend = $mtime; $timetotal = $timeend-$timestart; $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); if ( $display ) echo $r; return $r; } timer_start(); // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development. if (defined('WP_DEBUG') and WP_DEBUG == true) { error_reporting(E_ALL); } else { error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE); } // For an advanced caching plugin to use, static because you would only want one if ( defined('WP_CACHE') ) @include WP_CONTENT_DIR . '/advanced-cache.php'; /** * Stores the location of the WordPress directory of functions, classes, and core content. * * @since 1.0.0 */ define('WPINC', 'wp-includes'); if ( !defined('WP_LANG_DIR') ) { /** * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR * and uses that folder if it exists. Or it uses the "languages" folder in WPINC. * * @since 2.1.0 */ if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) { define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH if (!defined('LANGDIR')) { // Old static relative path maintained for limited backwards compatibility - won't work in some cases define('LANGDIR', 'wp-content/languages'); } } else { define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH if (!defined('LANGDIR')) { // Old relative path maintained for backwards compatibility define('LANGDIR', WPINC . '/languages'); } } } require (ABSPATH . WPINC . '/compat.php'); require (ABSPATH . WPINC . '/functions.php'); require (ABSPATH . WPINC . '/classes.php'); require_wp_db(); if ( !empty($wpdb->error) ) dead_db(); $prefix = $wpdb->set_prefix($table_prefix); // set up global tables if ( is_wp_error($prefix) ) wp_die(/*WP_I18N_BAD_PREFIX*/'ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/); if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) require_once (WP_CONTENT_DIR . '/object-cache.php'); else require_once (ABSPATH . WPINC . '/cache.php'); wp_cache_init(); if ( function_exists('wp_cache_add_global_groups') ) { wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); } if( defined( 'SUNRISE' ) ) include_once( ABSPATH . 'wp-content/sunrise.php' ); require_once ( ABSPATH . 'wpmu-settings.php' ); $wpdb->blogid = $current_blog->blog_id; $wpdb->siteid = $current_blog->site_id; $wpdb->set_prefix($table_prefix); // set up blog tables $table_prefix = $table_prefix . $blog_id . '_'; // Fix empty PHP_SELF $PHP_SELF = $_SERVER['PHP_SELF']; if ( empty($PHP_SELF) || ( constant( 'VHOST' ) == 'no' && $current_blog->path != '/' ) ) $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); wp_cache_init(); // need to init cache again after blog_id is set if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); } if( !defined( "UPLOADS" ) ) define( "UPLOADS", "wp-content/blogs.dir/{$wpdb->blogid}/files/" ); require (ABSPATH . WPINC . '/plugin.php'); require (ABSPATH . WPINC . '/default-filters.php'); if( defined( "SHORTINIT" ) && constant( "SHORTINIT" ) == true ) // stop most of WP being loaded, we just want the basics return false; include_once(ABSPATH . WPINC . '/streams.php'); include_once(ABSPATH . WPINC . '/gettext.php'); require_once (ABSPATH . WPINC . '/l10n.php'); if ( !is_blog_installed() && !defined('WP_INSTALLING') ) { die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark } require (ABSPATH . WPINC . '/formatting.php'); require (ABSPATH . WPINC . '/capabilities.php'); require (ABSPATH . WPINC . '/query.php'); require (ABSPATH . WPINC . '/theme.php'); require (ABSPATH . WPINC . '/user.php'); require (ABSPATH . WPINC . '/general-template.php'); require (ABSPATH . WPINC . '/link-template.php'); require (ABSPATH . WPINC . '/author-template.php'); require (ABSPATH . WPINC . '/post.php'); require (ABSPATH . WPINC . '/post-template.php'); require (ABSPATH . WPINC . '/category.php'); require (ABSPATH . WPINC . '/category-template.php'); require (ABSPATH . WPINC . '/comment.php'); require (ABSPATH . WPINC . '/comment-template.php'); require (ABSPATH . WPINC . '/rewrite.php'); require (ABSPATH . WPINC . '/feed.php'); require (ABSPATH . WPINC . '/bookmark.php'); require (ABSPATH . WPINC . '/bookmark-template.php'); require (ABSPATH . WPINC . '/kses.php'); require (ABSPATH . WPINC . '/cron.php'); require (ABSPATH . WPINC . '/version.php'); require (ABSPATH . WPINC . '/deprecated.php'); require (ABSPATH . WPINC . '/script-loader.php'); require (ABSPATH . WPINC . '/taxonomy.php'); require (ABSPATH . WPINC . '/update.php'); require (ABSPATH . WPINC . '/canonical.php'); require (ABSPATH . WPINC . '/shortcodes.php'); require (ABSPATH . WPINC . '/media.php'); if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up require_once( ABSPATH . WPINC . '/wpmu-functions.php' ); require (ABSPATH . WPINC . '/wpmu-default-filters.php'); // WPmu Filters /** * Allows for the plugins directory to be moved from the default location. * * @since 2.6 */ if ( !defined('WP_PLUGIN_DIR') ) define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash if ( !defined('WP_PLUGIN_URL') ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash if ( !defined('PLUGINDIR') ) define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. if( !isset($current_site->site_name) ) $current_site->site_name = get_site_option('site_name'); if( $current_site->site_name == false ) $current_site->site_name = ucfirst( $current_site->domain ); // Used to guarantee unique hash cookies $cookiehash = ''; /** * Used to guarantee unique hash cookies * @since 1.5 */ define('COOKIEHASH', '' ); $wpdb->hide_errors(); if( defined( 'MUPLUGINDIR' ) == false ) define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); if( is_dir( ABSPATH . MUPLUGINDIR ) ) { if( $dh = opendir( ABSPATH . MUPLUGINDIR ) ) { while( ( $plugin = readdir( $dh ) ) !== false ) { if( substr( $plugin, -4 ) == '.php' ) { include_once( ABSPATH . MUPLUGINDIR . '/' . $plugin ); } } } } $wpdb->show_errors(); if ( '1' == $current_blog->deleted ) { header('HTTP/1.1 410 Gone'); graceful_fail(__('This user has elected to delete their account and the content is no longer available.')); } if ( '2' == $current_blog->deleted ) graceful_fail( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact %1$s.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) ); if( $current_blog->archived == '1' || $current_blog->spam == '1' ) { header('HTTP/1.1 410 Gone'); graceful_fail(__('This blog has been archived or suspended.')); } /** * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php * @since 2.5 */ $wp_default_secret_key = 'put your unique phrase here'; if( defined( 'SECRET_KEY' ) ) $wp_default_secret_key = SECRET_KEY; /** * It is possible to define this in wp-config.php * @since 2.0.0 */ if ( !defined('USER_COOKIE') ) define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); /** * It is possible to define this in wp-config.php * @since 2.0.0 */ if ( !defined('PASS_COOKIE') ) define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); /** * It is possible to define this in wp-config.php * @since 2.5 */ if ( !defined('AUTH_COOKIE') ) define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('SECURE_AUTH_COOKIE') ) define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('LOGGED_IN_COOKIE') ) define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); /** * It is possible to define this in wp-config.php * @since 2.3.0 */ if ( !defined('TEST_COOKIE') ) define('TEST_COOKIE', 'wordpress_test_cookie'); /** * It is possible to define this in wp-config.php * @since 1.2.0 */ if ( !defined('COOKIEPATH') ) define('COOKIEPATH', $current_site->path ); /** * It is possible to define this in wp-config.php * @since 1.5.0 */ if ( !defined('SITECOOKIEPATH') ) define('SITECOOKIEPATH', $current_site->path ); /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('ADMIN_COOKIE_PATH') ) { if( constant( 'VHOST' ) == 'no' ) { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); } else { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); } } /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('PLUGINS_COOKIE_PATH') ) define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); /** * It is possible to define this in wp-config.php * @since 2.0.0 */ if ( !defined('COOKIE_DOMAIN') ) define('COOKIE_DOMAIN', '.' . $current_site->domain); /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('FORCE_SSL_ADMIN') ) define('FORCE_SSL_ADMIN', false); force_ssl_admin(FORCE_SSL_ADMIN); /** * It is possible to define this in wp-config.php * @since 2.6 */ if ( !defined('FORCE_SSL_LOGIN') ) define('FORCE_SSL_LOGIN', false); force_ssl_login(FORCE_SSL_LOGIN); /** * It is possible to define this in wp-config.php * @since 2.5.0 */ if ( !defined( 'AUTOSAVE_INTERVAL' ) ) define( 'AUTOSAVE_INTERVAL', 60 ); require (ABSPATH . WPINC . '/vars.php'); if ( get_option('active_plugins') ) { $current_plugins = get_option('active_plugins'); if ( is_array($current_plugins) ) { foreach ($current_plugins as $plugin) { if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) ) include_once(WP_PLUGIN_DIR . '/' . $plugin); } } } require (ABSPATH . WPINC . '/pluggable.php'); /* * In most cases the default internal encoding is latin1, which is of no use, * since we want to use the mb_ functions for utf-8 strings */ if (function_exists('mb_internal_encoding')) { if (!@mb_internal_encoding(get_option('blog_charset'))) mb_internal_encoding('UTF-8'); } if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) wp_cache_postload(); do_action('plugins_loaded'); $default_constants = array( 'WP_POST_REVISIONS' => true ); foreach ( $default_constants as $c => $v ) @define( $c, $v ); // will fail if the constant is already defined unset($default_constants, $c, $v); // If already slashed, strip. if ( get_magic_quotes_gpc() ) { $_GET = stripslashes_deep($_GET ); $_POST = stripslashes_deep($_POST ); $_COOKIE = stripslashes_deep($_COOKIE); } // Escape with wpdb. $_GET = add_magic_quotes($_GET ); $_POST = add_magic_quotes($_POST ); $_COOKIE = add_magic_quotes($_COOKIE); $_SERVER = add_magic_quotes($_SERVER); do_action('sanitize_comment_cookies'); /** * WordPress Query object * @global object $wp_the_query * @since 2.0.0 */ $wp_the_query =& new WP_Query(); /** * Holds the reference to @see $wp_the_query * Use this global for WordPress queries * @global object $wp_query * @since 1.5.0 */ $wp_query =& $wp_the_query; /** * Holds the WordPress Rewrite object for creating pretty URLs * @global object $wp_rewrite * @since 1.5.0 */ $wp_rewrite =& new WP_Rewrite(); /** * WordPress Object * @global object $wp * @since 2.0.0 */ $wp =& new WP(); do_action('setup_theme'); /** * Web Path to the current active template directory * @since 1.5 */ define('TEMPLATEPATH', get_template_directory()); /** * Web Path to the current active template stylesheet directory * @since 2.1 */ define('STYLESHEETPATH', get_stylesheet_directory()); // Load the default text localization domain. load_default_textdomain(); /** * The locale of the blog * @since 1.5.0 */ $locale = get_locale(); $locale_file = WP_LANG_DIR . "/$locale.php"; if ( is_readable($locale_file) ) require_once($locale_file); // Pull in locale data after loading text domain. require_once(ABSPATH . WPINC . '/locale.php'); /** * WordPress Locale object for loading locale domain date and various strings. * @global object $wp_locale * @since 2.1.0 */ $wp_locale =& new WP_Locale(); // Load functions for active theme. if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) include(STYLESHEETPATH . '/functions.php'); if ( file_exists(TEMPLATEPATH . '/functions.php') ) include(TEMPLATEPATH . '/functions.php'); /** * shutdown_action_hook() - Runs just before PHP shuts down execution. * * @access private * @since 1.2 */ function shutdown_action_hook() { do_action('shutdown'); wp_cache_close(); } register_shutdown_function('shutdown_action_hook'); $wp->init(); // Sets up current user. // Everything is loaded and initialized. do_action('init'); ?> blogs/wp-atom.php0000644000000000000000000000105411077635520012765 0ustar rootroot blogs/README.txt0000644000000000000000000001672411077635520012400 0ustar rootrootWordPress Multi User -------------------- WordPress MU is a multi user version of WordPress. If you're not comfortable editing PHP code, taking care of a complex webserver and database system and being pro-active about following developments of this project then run, don't walk, to http://wordpress.com/ and sign yourself and your friends up to free blogs. It's easier in the long run and you'll save yourself a lot of pain and angst. Apache ====== Apache must be configured so that mod_rewrite works. Here are instructions for Apache 2. Apache 1.3 is very similar. 1. Make sure a line like the following appears in your httpd.conf LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 2. In the directive of your virtual host, look for this line "AllowOverride None" and change it to "AllowOverride FileInfo Options" 3. In the section of the config file for your host there will be a line defining the hostname. You need to add the following if you want virtual hosts to work properly: "ServerAlias *.domain.tld" Replace domain.tld with whatever your one is, and remove the quotes. DNS === If you want to host blogs of the form http://blog.domain.tld/ where domain.tld is the domain name of your machine then you must add a wildcard record to your DNS records. This usually means adding a "*" hostname record pointing at your webserver in your DNS configuration tool. Matt has a more detailed explanation: http://ma.tt/2003/10/10/wildcard-dns-and-sub-domains/ PHP === 1. Don't display error messages to the browser. This is almost always turned off but sometimes when you're testing you turn this on and forget to reset it. 2. If your PHP is compiled with memory limit checks, the default is 8MB which is much too small. You should increase this to at least 32MB or 64MB to avoid PHP out of memory errors. Look for "memory_limit" in your php.ini file. 3. GLOBAL variables must be turned off. This is one of the first things any security aware admin will do. These days the default is for it to be off! The easiest way of configuring it is via the .htaccess file that is created during the install. If you haven't installed WPMU yet then edit the file htaccess.dist in this directory and add these two lines at the top: php_flag register_globals 0 php_flag display_errors 0 This is NOT included in that file by default because it doesn't work on all machines. If it doesn't work on your machine, you'll get a cryptic "500 internal error" after you install WPMU. To remove the offending lines just edit the file ".htaccess" in your install directory and you'll see them at the top. Delete and save the file again. Read here for how to enable this: http://ie.php.net/configuration.changes If you don't want to edit your .htaccess file then you need to change your php.ini. It's beyond the scope of this README to know exactly where it is on your machine, but if you're on a shared hosted server you probably don't have access to it as it requires root or administrator privileges to change. If you do have root access, try "locate php.ini" or check in: /etc/php4/apache2/php.ini /usr/local/lib/php.ini Once you have opened your php.ini, look for the sections related to register_globals and display_errors. Make sure both are Off like so: display_errors = Off register_globals = Off You'll have to restart Apache after you modify your php.ini for the settings to be updated. 4. If you want to restrict blog signups, set the restrict domain email setting in the admin. Install ======= 1. Download and unzip the WordPress MU package, if you haven't already. The unzipped files will be created in a directory named "wordpressmu" followed by a version number. 2. Create a database for WordPress MU on your web server, as well as a MySQL user who has all privileges for accessing and modifying it. 3. Place the WordPress MU files in the desired location on your web server: * If you want to integrate WordPress MU into the root of your domain (e.g. http://example.com/), move or upload all the files and directories of the unzipped WordPress MU directory into the root directory of your web server. * If you want to have your WordPress MU installation in its own subdirectory on your web site (e.g. http://example.com/blogs/), rename the directory wordpressmu to the name you'd like the subdirectory to have and move or upload it to your web server. For example if you want the WordPress MU installation in a subdirectory called "blog", you should rename the directory called "wordpressmu" to "blogs" and upload it to the root directory of your web server. 4. Make sure your install directory and the wp-contents directory are writeable by the webserver. 5. Run the WordPress MU installation script by accessing index.php in your favorite web browser. * If you installed WordPress MU in the root directory, you should visit: http://example.com/index.php * If you installed WordPress MU in its own subdirectory called blogs, for example, you should visit: http://example.com/blogs/index.php (Adapted from http://codex.wordpress.org/Installing_WordPress) If you're upgrading, skip to the end of this document. ERROR LOGGING ============= If you are developing a site based on WPMU it is recommended that you turn on PHP error logging. Look in your php.ini for the section marked "Error handling and logging" where you can configure it. Mysql database errors are logged to the PHP error log if enabled or it can also send error reports to a file of your choice. After installing, edit wp-config.php and define a constant, "ERRORLOGFILE", pointing at your MySQL error log. This file must be writeable by your webserver. Please don't log to a file visible by your webserver or people may figure out they can download it. Example definition: define( "ERRORLOGFILE", "/tmp/mysql.log" ); UPGRADING ========= Please see this page for instructions on upgrading your install: http://codex.wordpress.org/Upgrading_WPMU PERFORMANCE =========== WordPress MU has a caching framework which allows third party developers to create cache engines that improve performance. There are two types of caching plugins available for WordPress. 1. Object Cache. These work by storing commonly accessed data in a rapid access storage container such as RAM or directly on the filesystem. To install these plugins copy them into your wp-content folder. Memcached: http://dev.wp-plugins.org/browser/memcached/trunk/ Filesystem: http://neosmart.net/dl.php?id=14 Xcache: http://neosmart.net/dl.php?id=12 eAccelerator: http://neosmart.net/dl.php?id=13 2. Full page cache. These work by storing complete web pages and are generally faster than object cache plugins at the expense of less flexibility. On a busy WordPress MU site these may in fact slow down your server due to limitations in how the cached files are stored. Clearing out the cached files on a regular basis will alleviate this problem. YMMV. WP Super Cache: http://ocaoimh.ie/wp-super-cache/ Support Forum and Bug Reports ============================= Please read http://codex.wordpress.org/Debugging_WPMU before asking any questions. Without all the information required there we'll just ask for it anyway or worse, your request will be ignored. http://mu.wordpress.org/forums/ Trac is our bug tracking system. Again, please read the above link before submitting a bug report. http://trac.mu.wordpress.org/report/1 You can login to both sites using your wordpress.org username and password. http://mu.wordpress.org/ blogs/wp-includes/0000755000000000000000000000000011077645606013130 5ustar rootrootblogs/wp-includes/kses.php0000644000000000000000000007555011077635520014614 0ustar rootroot * * @package External * @subpackage KSES * * @internal * *** CONTACT INFORMATION *** * E-mail: metaur at users dot sourceforge dot net * Web page: http://sourceforge.net/projects/kses * Paper mail: Ulf Harnhammar * Ymergatan 17 C * 753 25 Uppsala * SWEDEN * * [kses strips evil scripts!] */ /** * You can override this in your my-hacks.php file * You can also override this in a plugin file. The * my-hacks.php is deprecated in its usage. * * @since 1.2.0 */ if (!defined('CUSTOM_TAGS')) define('CUSTOM_TAGS', false); if (!CUSTOM_TAGS) { /** * Kses global for default allowable HTML tags * * Can be override by using CUSTOM_TAGS constant * @global array $allowedposttags * @since 2.0.0 */ $allowedposttags = array( 'address' => array(), 'a' => array( 'class' => array (), 'href' => array (), 'id' => array (), 'title' => array (), 'rel' => array (), 'rev' => array (), 'name' => array (), 'target' => array()), 'abbr' => array( 'class' => array (), 'title' => array ()), 'acronym' => array( 'title' => array ()), 'b' => array(), 'big' => array(), 'blockquote' => array( 'id' => array (), 'cite' => array (), 'class' => array(), 'lang' => array(), 'xml:lang' => array()), 'br' => array ( 'class' => array ()), 'button' => array( 'disabled' => array (), 'name' => array (), 'type' => array (), 'value' => array ()), 'caption' => array( 'align' => array (), 'class' => array ()), 'cite' => array ( 'class' => array(), 'dir' => array(), 'lang' => array(), 'title' => array ()), 'code' => array ( 'style' => array()), 'col' => array( 'align' => array (), 'char' => array (), 'charoff' => array (), 'span' => array (), 'dir' => array(), 'style' => array (), 'valign' => array (), 'width' => array ()), 'del' => array( 'datetime' => array ()), 'dd' => array(), 'div' => array( 'align' => array (), 'class' => array (), 'dir' => array (), 'id' => array (), 'lang' => array(), 'style' => array (), 'xml:lang' => array()), 'dl' => array(), 'dt' => array(), 'em' => array(), 'fieldset' => array(), 'font' => array( 'color' => array (), 'face' => array (), 'size' => array ()), 'form' => array( 'action' => array (), 'accept' => array (), 'accept-charset' => array (), 'enctype' => array (), 'method' => array (), 'name' => array (), 'target' => array ()), 'h1' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'h2' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'h3' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'h4' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'h5' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'h6' => array( 'align' => array (), 'style' => array (), 'class' => array ()), 'hr' => array( 'align' => array (), 'class' => array (), 'noshade' => array (), 'size' => array (), 'width' => array ()), 'i' => array(), 'img' => array( 'alt' => array (), 'align' => array (), 'border' => array (), 'class' => array (), 'height' => array (), 'hspace' => array (), 'longdesc' => array (), 'vspace' => array (), 'src' => array (), 'style' => array (), 'width' => array ()), 'ins' => array( 'datetime' => array (), 'cite' => array ()), 'kbd' => array(), 'label' => array( 'for' => array ()), 'legend' => array( 'align' => array ()), 'li' => array ( 'align' => array (), 'class' => array ()), 'p' => array( 'class' => array (), 'align' => array (), 'dir' => array(), 'lang' => array(), 'style' => array (), 'xml:lang' => array()), 'pre' => array( 'style' => array(), 'width' => array ()), 'q' => array( 'cite' => array ()), 's' => array(), 'span' => array ( 'class' => array (), 'dir' => array (), 'align' => array (), 'lang' => array (), 'style' => array (), 'title' => array (), 'xml:lang' => array()), 'strike' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'table' => array( 'align' => array (), 'bgcolor' => array (), 'border' => array (), 'cellpadding' => array (), 'cellspacing' => array (), 'class' => array (), 'dir' => array(), 'id' => array(), 'rules' => array (), 'style' => array (), 'summary' => array (), 'width' => array ()), 'tbody' => array( 'align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'td' => array( 'abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'class' => array (), 'colspan' => array (), 'dir' => array(), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'style' => array (), 'valign' => array (), 'width' => array ()), 'textarea' => array( 'cols' => array (), 'rows' => array (), 'disabled' => array (), 'name' => array (), 'readonly' => array ()), 'tfoot' => array( 'align' => array (), 'char' => array (), 'class' => array (), 'charoff' => array (), 'valign' => array ()), 'th' => array( 'abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'class' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'thead' => array( 'align' => array (), 'char' => array (), 'charoff' => array (), 'class' => array (), 'valign' => array ()), 'title' => array(), 'tr' => array( 'align' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'class' => array (), 'style' => array (), 'valign' => array ()), 'tt' => array(), 'u' => array(), 'ul' => array ( 'class' => array (), 'style' => array (), 'type' => array ()), 'ol' => array ( 'class' => array (), 'start' => array (), 'style' => array (), 'type' => array ()), 'var' => array ()); /** * Kses allowed HTML elements * * @global array $allowedtags * @since 1.0.0 */ $allowedtags = array( 'a' => array( 'href' => array (), 'title' => array ()), 'abbr' => array( 'title' => array ()), 'acronym' => array( 'title' => array ()), 'b' => array(), 'blockquote' => array( 'cite' => array ()), // 'br' => array(), 'cite' => array (), 'code' => array(), 'del' => array( 'datetime' => array ()), // 'dd' => array(), // 'dl' => array(), // 'dt' => array(), 'em' => array (), 'i' => array (), // 'ins' => array('datetime' => array(), 'cite' => array()), // 'li' => array(), // 'ol' => array(), // 'p' => array(), 'q' => array( 'cite' => array ()), 'strike' => array(), 'strong' => array(), // 'sub' => array(), // 'sup' => array(), // 'u' => array(), // 'ul' => array(), ); } /** * wp_kses() - Filters content and keeps only allowable HTML elements. * * This function makes sure that only the allowed HTML element names, * attribute names and attribute values plus only sane HTML entities * will occur in $string. You have to remove any slashes from PHP's * magic quotes before you call this function. * * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', * 'news', 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This * covers all common link protocols, except for 'javascript' which * should not be allowed for untrusted users. * * @since 1.0.0 * * @param string $string Content to filter through kses * @param array $allowed_html List of allowed HTML elements * @param array $allowed_protocols Optional. Allowed protocol in links. * @return string Filtered content with only allowed HTML elements */ function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) { $string = wp_kses_no_null($string); $string = wp_kses_js_entities($string); $string = wp_kses_normalize_entities($string); $allowed_html_fixed = wp_kses_array_lc($allowed_html); $string = wp_kses_hook($string, $allowed_html_fixed, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols); } /** * wp_kses_hook() - You add any kses hooks here. * * There is currently only one kses WordPress hook and it is * called here. All parameters are passed to the hooks and * expected to recieve a string. * * @since 1.0.0 * * @param string $string Content to filter through kses * @param array $allowed_html List of allowed HTML elements * @param array $allowed_protocols Allowed protocol in links * @return string Filtered content through 'pre_kses' hook */ function wp_kses_hook($string, $allowed_html, $allowed_protocols) { $string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols); return $string; } /** * wp_kses_version() - This function returns kses' version number. * * @since 1.0.0 * * @return string Version Number */ function wp_kses_version() { return '0.2.2'; } /** * wp_kses_split() - Searches for HTML tags, no matter how malformed * * It also matches stray ">" characters. * * @since 1.0.0 * * @param string $string Content to filter * @param array $allowed_html Allowed HTML elements * @param array $allowed_protocols Allowed protocols to keep * @return string Content with fixed HTML tags */ function wp_kses_split($string, $allowed_html, $allowed_protocols) { return preg_replace('%((|$))|(<[^>]*(>|$)|>))%e', "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string); } /** * wp_kses_split2() - Callback for wp_kses_split for fixing malformed HTML tags * * This function does a lot of work. It rejects some very malformed things * like <:::>. It returns an empty string, if the element isn't allowed (look * ma, no strip_tags()!). Otherwise it splits the tag into an element and an * attribute list. * * After the tag is split into an element and an attribute list, it is run * through another filter which will remove illegal attributes and once * that is completed, will be returned. * * @since 1.0.0 * @uses wp_kses_attr() * * @param string $string Content to filter * @param array $allowed_html Allowed HTML elements * @param array $allowed_protocols Allowed protocols to keep * @return string Fixed HTML element */ function wp_kses_split2($string, $allowed_html, $allowed_protocols) { $string = wp_kses_stripslashes($string); if (substr($string, 0, 1) != '<') return '>'; # It matched a ">" character if (preg_match('%^)?$%', $string, $matches)) { $string = str_replace(array(''), '', $matches[1]); while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) ) $string = $newstring; if ( $string == '' ) return ''; // prevent multiple dashes in comments $string = preg_replace('/--+/', '-', $string); // prevent three dashes closing a comment $string = preg_replace('/-$/', '', $string); return ""; } # Allow HTML comments if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) return ''; # It's seriously malformed $slash = trim($matches[1]); $elem = $matches[2]; $attrlist = $matches[3]; if (!@isset($allowed_html[strtolower($elem)])) return ''; # They are using a not allowed HTML element if ($slash != '') return "<$slash$elem>"; # No attributes are allowed for closing elements return wp_kses_attr("$slash$elem", $attrlist, $allowed_html, $allowed_protocols); } /** * wp_kses_attr() - Removes all attributes, if none are allowed for this element * * If some are allowed it calls wp_kses_hair() to split them further, and then * it builds up new HTML code from the data that kses_hair() returns. It also * removes "<" and ">" characters, if there are any left. One more thing it * does is to check if the tag has a closing XHTML slash, and if it does, it * puts one in the returned code as well. * * @since 1.0.0 * * @param string $element HTML element/tag * @param string $attr HTML attributes from HTML element to closing HTML element tag * @param array $allowed_html Allowed HTML elements * @param array $allowed_protocols Allowed protocols to keep * @return string Sanitized HTML element */ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { # Is there a closing XHTML slash at the end of the attributes? $xhtml_slash = ''; if (preg_match('%\s/\s*$%', $attr)) $xhtml_slash = ' /'; # Are any attributes allowed at all for this element? if (@ count($allowed_html[strtolower($element)]) == 0) return "<$element$xhtml_slash>"; # Split it $attrarr = wp_kses_hair($attr, $allowed_protocols); # Go through $attrarr, and save the allowed attributes for this element # in $attr2 $attr2 = ''; foreach ($attrarr as $arreach) { if (!@ isset ($allowed_html[strtolower($element)][strtolower($arreach['name'])])) continue; # the attribute is not allowed $current = $allowed_html[strtolower($element)][strtolower($arreach['name'])]; if ($current == '') continue; # the attribute is not allowed if (!is_array($current)) $attr2 .= ' '.$arreach['whole']; # there are no checks else { # there are some checks $ok = true; foreach ($current as $currkey => $currval) if (!wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval)) { $ok = false; break; } if ( $arreach['name'] == 'style' ) { $orig_value = $arreach['value']; $value = safecss_filter_attr($orig_value, $element); if ( empty($value) ) continue; $arreach['value'] = $value; $arreach['whole'] = str_replace($orig_value, $value, $arreach['whole']); } if ($ok) $attr2 .= ' '.$arreach['whole']; # it passed them } # if !is_array($current) } # foreach # Remove any "<" or ">" characters $attr2 = preg_replace('/[<>]/', '', $attr2); return "<$element$attr2$xhtml_slash>"; } /** * wp_kses_hair() - Builds an attribute list from string containing attributes. * * This function does a lot of work. It parses an attribute list into an array * with attribute data, and tries to do the right thing even if it gets weird * input. It will add quotes around attribute values that don't have any quotes * or apostrophes around them, to make it easier to produce HTML code that will * conform to W3C's HTML specification. It will also remove bad URL protocols * from attribute values. It also reduces duplicate attributes by using the * attribute defined first (foo='bar' foo='baz' will result in foo='bar'). * * @since 1.0.0 * * @param string $attr Attribute list from HTML element to closing HTML element tag * @param array $allowed_protocols Allowed protocols to keep * @return array List of attributes after parsing */ function wp_kses_hair($attr, $allowed_protocols) { $attrarr = array (); $mode = 0; $attrname = ''; # Loop through the whole attribute list while (strlen($attr) != 0) { $working = 0; # Was the last operation successful? switch ($mode) { case 0 : # attribute name, href for instance if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) { $attrname = $match[1]; $working = $mode = 1; $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr); } break; case 1 : # equals sign or valueless ("selected") if (preg_match('/^\s*=\s*/', $attr)) # equals sign { $working = 1; $mode = 2; $attr = preg_replace('/^\s*=\s*/', '', $attr); break; } if (preg_match('/^\s+/', $attr)) # valueless { $working = 1; $mode = 0; if(FALSE === array_key_exists($attrname, $attrarr)) { $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); } $attr = preg_replace('/^\s+/', '', $attr); } break; case 2 : # attribute value, a URL after href= for instance if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) # "value" { $thisval = ($attrname=='style') ? $match[1] : wp_kses_bad_protocol($match[1], $allowed_protocols); if(FALSE === array_key_exists($attrname, $attrarr)) { $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); } $working = 1; $mode = 0; $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); break; } if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) # 'value' { $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); if(FALSE === array_key_exists($attrname, $attrarr)) { $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); } $working = 1; $mode = 0; $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); break; } if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) # value { $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); if(FALSE === array_key_exists($attrname, $attrarr)) { $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); } # We add quotes to conform to W3C's HTML spec. $working = 1; $mode = 0; $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr); } break; } # switch if ($working == 0) # not well formed, remove and try again { $attr = wp_kses_html_error($attr); $mode = 0; } } # while if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) # special case, for when the attribute list ends with a valueless # attribute like "selected" $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); return $attrarr; } /** * wp_kses_check_attr_val() - Performs different checks for attribute values. * * The currently implemented checks are "maxlen", "minlen", "maxval", "minval" * and "valueless" with even more checks to come soon. * * @since 1.0.0 * * @param string $value Attribute value * @param string $vless Whether the value is valueless or not. Use 'y' or 'n' * @param string $checkname What $checkvalue is checking for. * @param mixed $checkvalue What constraint the value should pass * @return bool Whether check passes (true) or not (false) */ function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) { $ok = true; switch (strtolower($checkname)) { case 'maxlen' : # The maxlen check makes sure that the attribute value has a length not # greater than the given value. This can be used to avoid Buffer Overflows # in WWW clients and various Internet servers. if (strlen($value) > $checkvalue) $ok = false; break; case 'minlen' : # The minlen check makes sure that the attribute value has a length not # smaller than the given value. if (strlen($value) < $checkvalue) $ok = false; break; case 'maxval' : # The maxval check does two things: it checks that the attribute value is # an integer from 0 and up, without an excessive amount of zeroes or # whitespace (to avoid Buffer Overflows). It also checks that the attribute # value is not greater than the given value. # This check can be used to avoid Denial of Service attacks. if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) $ok = false; if ($value > $checkvalue) $ok = false; break; case 'minval' : # The minval check checks that the attribute value is a positive integer, # and that it is not smaller than the given value. if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) $ok = false; if ($value < $checkvalue) $ok = false; break; case 'valueless' : # The valueless check checks if the attribute has a value # (like ) or not (
  • " . $details['postcount'] . " $url
  • "; } } } return array_slice( $most_active, 0, $num ); } function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { global $wpdb; $blogs = get_site_option( "blog_list" ); $update = false; if( is_array( $blogs ) ) { if( ( $blogs['time'] + 60 ) < time() ) { // cache for 60 seconds. $update = true; } } else { $update = true; } if( $update == true ) { unset( $blogs ); $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A ); foreach ( (array) $blogs as $details ) { $blog_list[ $details['blog_id'] ] = $details; $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->base_prefix . $details['blog_id'] . "_posts WHERE post_status='publish' AND post_type='post'" ); } unset( $blogs ); $blogs = $blog_list; update_site_option( "blog_list", $blogs ); } if( $num == 'all' ) { return array_slice( $blogs, $start, count( $blogs ) ); } else { return array_slice( $blogs, $start, $num ); } } function get_blog_count( $id = 0 ) { global $wpdb; if( $id == 0 ) $id = $wpdb->siteid; $count_ts = get_site_option( "blog_count_ts" ); if( time() - $count_ts > 3600 ) { $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $id) ); update_site_option( "blog_count", $count ); update_site_option( "blog_count_ts", time() ); } $count = get_site_option( "blog_count" ); return $count; } function get_blog_post( $blog_id, $post_id ) { global $wpdb; $key = $blog_id."-".$post_id."-blog_post"; $post = wp_cache_get( $key, "site-options" ); if( $post == false ) { $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM {$wpdb->base_prefix}{$blog_id}_posts WHERE ID = %d", $post_id) ); wp_cache_add( $key, $post, "site-options", 120 ); } return $post; } function add_user_to_blog( $blog_id, $user_id, $role ) { switch_to_blog($blog_id); $user = new WP_User($user_id); if ( empty($user) ) return new WP_Error('user_does_not_exist', __('That user does not exist.')); if ( !get_usermeta($user_id, 'primary_blog') ) { update_usermeta($user_id, 'primary_blog', $blog_id); $details = get_blog_details($blog_id); update_usermeta($user_id, 'source_domain', $details->domain); } $user->set_role($role); do_action('add_user_to_blog', $user_id, $role, $blog_id); wp_cache_delete( $user_id, 'users' ); restore_current_blog(); return true; } function remove_user_from_blog($user_id, $blog_id = '') { switch_to_blog($blog_id); $user_id = (int) $user_id; do_action('remove_user_from_blog', $user_id, $blog_id); // If being removed from the primary blog, set a new primary if the user is assigned // to multiple blogs. $primary_blog = get_usermeta($user_id, 'primary_blog'); if ( $primary_blog == $blog_id ) { $new_id = ''; $new_domain = ''; $blogs = get_blogs_of_user($user_id); foreach ( (array) $blogs as $blog ) { if ( $blog->userblog_id == $blog_id ) continue; $new_id = $blog->userblog_id; $new_domain = $blog->domain; break; } update_usermeta($user_id, 'primary_blog', $new_id); update_usermeta($user_id, 'source_domain', $new_domain); } wp_revoke_user($user_id); $blogs = get_blogs_of_user($user_id); if ( count($blogs) == 0 ) { update_usermeta($user_id, 'primary_blog', ''); update_usermeta($user_id, 'source_domain', ''); } restore_current_blog(); } function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { $domain = addslashes( $domain ); $weblog_title = addslashes( $weblog_title ); if( empty($path) ) $path = '/'; // Check if the domain has been used already. We should return an error message. if ( domain_exists($domain, $path, $site_id) ) return __('error: Blog URL already taken.'); // Need to backup wpdb table names, and create a new wp_blogs entry for new blog. // Need to get blog_id from wp_blogs, and create new table names. // Must restore table names at the end of function. if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) return __('error: problem creating blog entry'); switch_to_blog($blog_id); install_blog($blog_id); restore_current_blog(); return $blog_id; } function get_blog_permalink( $blog_id, $post_id ) { $key = "{$blog_id}-{$post_id}-blog_permalink"; $link = wp_cache_get( $key, 'site-options' ); if( $link == false ) { switch_to_blog( $blog_id ); $link = get_permalink( $post_id ); restore_current_blog(); wp_cache_add( $key, $link, "site-options", 30 ); } return $link; } // wpmu admin functions function wpmu_admin_do_redirect( $url = '' ) { $ref = ''; if ( isset( $_GET['ref'] ) ) $ref = $_GET['ref']; if ( isset( $_POST['ref'] ) ) $ref = $_POST['ref']; if( $ref ) { $ref = wpmu_admin_redirect_add_updated_param( $ref ); wp_redirect( $ref ); exit(); } if( empty( $_SERVER['HTTP_REFERER'] ) == false ) { wp_redirect( $_SERVER['HTTP_REFERER'] ); exit(); } $url = wpmu_admin_redirect_add_updated_param( $url ); if( isset( $_GET['redirect'] ) ) { if( substr( $_GET['redirect'], 0, 2 ) == 's_' ) { $url .= "&action=blogs&s=". wp_specialchars( substr( $_GET['redirect'], 2 ) ); } } elseif( isset( $_POST['redirect'] ) ) { $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); } wp_redirect( $url ); exit(); } function wpmu_admin_redirect_add_updated_param( $url = '' ) { if( strpos( $url, 'updated=true' ) === false ) { if( strpos( $url, '?' ) === false ) { return $url . '?updated=true'; } else { return $url . '&updated=true'; } } return $url; } function wpmu_admin_redirect_url() { if( isset( $_GET['s'] ) ) { return "s_".$_GET['s']; } } function is_blog_user( $blog_id = 0 ) { global $current_user, $wpdb; if ( !$blog_id ) $blog_id = $wpdb->blogid; $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities'; if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) ) return true; return false; } function validate_email( $email, $check_domain = true) { if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) { if ($check_domain && function_exists('checkdnsrr')) { list (, $domain) = explode('@', $email); if (checkdnsrr($domain.'.', 'MX') || checkdnsrr($domain.'.', 'A')) { return true; } return false; } return true; } return false; } function is_email_address_unsafe( $user_email ) { $banned_names = get_site_option( "banned_email_domains" ); if ( is_array( $banned_names ) && empty( $banned_names ) == false ) { $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) ); foreach( (array) $banned_names as $banned_domain ) { if( $banned_domain == '' ) continue; if ( strstr( $email_domain, $banned_domain ) || ( strstr( $banned_domain, '/' ) && preg_match( $banned_domain, $email_domain ) ) ) return true; } } return false; } function wpmu_validate_user_signup($user_name, $user_email) { global $wpdb; $errors = new WP_Error(); $user_name = preg_replace( "/\s+/", '', sanitize_user( $user_name, true ) ); $user_email = sanitize_email( $user_email ); if ( empty( $user_name ) ) $errors->add('user_name', __("Please enter a username")); $maybe = array(); preg_match( "/[a-z0-9]+/", $user_name, $maybe ); if( $user_name != $maybe[0] ) { $errors->add('user_name', __("Only lowercase letters and numbers allowed")); } $illegal_names = get_site_option( "illegal_names" ); if( is_array( $illegal_names ) == false ) { $illegal_names = array( "www", "web", "root", "admin", "main", "invite", "administrator" ); add_site_option( "illegal_names", $illegal_names ); } if( in_array( $user_name, $illegal_names ) == true ) { $errors->add('user_name', __("That username is not allowed")); } if( is_email_address_unsafe( $user_email ) ) $errors->add('user_email', __("You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.")); if( strlen( $user_name ) < 4 ) { $errors->add('user_name', __("Username must be at least 4 characters")); } if ( strpos( " " . $user_name, "_" ) != false ) $errors->add('user_name', __("Sorry, usernames may not contain the character '_'!")); // all numeric? $match = array(); preg_match( '/[0-9]*/', $user_name, $match ); if ( $match[0] == $user_name ) $errors->add('user_name', __("Sorry, usernames must have letters too!")); if ( !is_email( $user_email ) ) $errors->add('user_email', __("Please enter a correct email address")); if ( !validate_email( $user_email ) ) $errors->add('user_email', __("Please check your email address.")); $limited_email_domains = get_site_option( 'limited_email_domains' ); if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); if( in_array( $emaildomain, $limited_email_domains ) == false ) { $errors->add('user_email', __("Sorry, that email address is not allowed!")); } } // Check if the username has been used already. if ( username_exists($user_name) ) $errors->add('user_name', __("Sorry, that username already exists!")); // Check if the email address has been used already. if ( email_exists($user_email) ) $errors->add('user_email', __("Sorry, that email address is already used!")); // Has someone already signed up for this username? $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) ); if ( $signup != null ) { $registered_at = mysql2date('U', $signup->registered); $now = current_time( 'timestamp', true ); $diff = $now - $registered_at; // If registered more than two days ago, cancel registration and let this signup go through. if ( $diff > 172800 ) { $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_login = %s", $user_name) ); } else { $errors->add('user_name', __("That username is currently reserved but may be available in a couple of days.")); } if( $signup->active == 0 && $signup->user_email == $user_email ) $errors->add('user_email_used', __("username and email used")); } $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) ); if ( $signup != null ) { $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered); // If registered more than two days ago, cancel registration and let this signup go through. if ( $diff > 172800 ) { $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_email = %s", $user_email) ); } else { $errors->add('user_email', __("That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.")); } } $result = array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors); return apply_filters('wpmu_validate_user_signup', $result); } function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { global $wpdb, $domain, $base; $blogname = preg_replace( "/\s+/", '', sanitize_user( $blogname, true ) ); $blog_title = strip_tags( $blog_title ); $blog_title = substr( $blog_title, 0, 50 ); $errors = new WP_Error(); $illegal_names = get_site_option( "illegal_names" ); if( $illegal_names == false ) { $illegal_names = array( "www", "web", "root", "admin", "main", "invite", "administrator" ); add_site_option( "illegal_names", $illegal_names ); } if ( empty( $blogname ) ) $errors->add('blogname', __("Please enter a blog name")); $maybe = array(); preg_match( "/[a-z0-9]+/", $blogname, $maybe ); if( $blogname != $maybe[0] ) { $errors->add('blogname', __("Only lowercase letters and numbers allowed")); } if( in_array( $blogname, $illegal_names ) == true ) { $errors->add('blogname', __("That name is not allowed")); } if( strlen( $blogname ) < 4 && !is_site_admin() ) { $errors->add('blogname', __("Blog name must be at least 4 characters")); } if ( strpos( " " . $blogname, "_" ) != false ) $errors->add('blogname', __("Sorry, blog names may not contain the character '_'!")); // all numeric? $match = array(); preg_match( '/[0-9]*/', $blogname, $match ); if ( $match[0] == $blogname ) $errors->add('blogname', __("Sorry, blog names must have letters too!")); $blogname = apply_filters( "newblogname", $blogname ); $blog_title = stripslashes( $blog_title ); if ( empty( $blog_title ) ) $errors->add('blog_title', __("Please enter a blog title")); // Check if the domain/path has been used already. if( constant( "VHOST" ) == 'yes' ) { $mydomain = "$blogname.$domain"; $path = $base; } else { $mydomain = "$domain"; $path = $base.$blogname.'/'; } if ( domain_exists($mydomain, $path) ) $errors->add('blogname', __("Sorry, that blog already exists!")); if ( username_exists($blogname) ) { if ( !is_object($user) && ( $user->user_login != $blogname ) ) $errors->add('blogname', __("Sorry, that blog is reserved!")); } // Has someone already signed up for this domain? $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); // TODO: Check email too? if ( ! empty($signup) ) { $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered); // If registered more than two days ago, cancel registration and let this signup go through. if ( $diff > 172800 ) { $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); } else { $errors->add('blogname', __("That blog is currently reserved but may be available in a couple days.")); } } $result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors); return apply_filters('wpmu_validate_blog_signup', $result); } // Record signup information for future activation. wpmu_validate_signup() should be run // on the inputs before calling wpmu_signup(). function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = '') { global $wpdb; // Format data $key = substr( md5( time() . rand() . $domain ), 0, 16 ); $meta = serialize($meta); $domain = $wpdb->escape($domain); $path = $wpdb->escape($path); $title = $wpdb->escape($title); $wpdb->insert( $wpdb->signups, array( 'domain' => $domain, 'path' => $path, 'title' => $title, 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta ) ); wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta); } function wpmu_signup_user($user, $user_email, $meta = '') { global $wpdb; // Format data $user = preg_replace( "/\s+/", '', sanitize_user( $user, true ) ); $user_email = sanitize_email( $user_email ); $key = substr( md5( time() . rand() . $user_email ), 0, 16 ); $meta = serialize($meta); $wpdb->insert( $wpdb->signups, array( 'domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta ) ); wpmu_signup_user_notification($user, $user_email, $key, $meta); } // Notify user of signup success. function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') { global $current_site; if( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) ) return false; // Send email with activation link. if( constant( "VHOST" ) == 'no' ) { $activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key"; } else { $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; } $activate_url = clean_url($activate_url); $admin_email = get_site_option( "admin_email" ); if( $admin_email == '' ) $admin_email = 'support@' . $_SERVER['SERVER_NAME']; $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = sprintf(__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s"), $activate_url, clean_url("http://{$domain}{$path}")); // TODO: Don't hard code activation link. $subject = '[' . $from_name . '] ' . sprintf(__('Activate %s'), clean_url('http://' . $domain . $path)); wp_mail($user_email, $subject, $message, $message_headers); return true; } function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') { global $current_site; if( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) ) return false; // Send email with activation link. $admin_email = get_site_option( "admin_email" ); if( $admin_email == '' ) $admin_email = 'support@' . $_SERVER['SERVER_NAME']; $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = sprintf(__("To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n"), clean_url("http://{$current_site->domain}{$current_site->path}wp-activate.php?key=$key") ); // TODO: Don't hard code activation link. $subject = sprintf(__('Activate %s'), $user); wp_mail($user_email, $subject, $message, $message_headers); return true; } function wpmu_activate_signup($key) { global $wpdb; $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) ); if ( empty($signup) ) return new WP_Error('invalid_key', __('Invalid activation key.')); if ( $signup->active ) return new WP_Error('already_active', __('The blog is already active.'), $signup); $meta = unserialize($signup->meta); $user_login = $wpdb->escape($signup->user_login); $user_email = $wpdb->escape($signup->user_email); wpmu_validate_user_signup($user_login, $user_email); $password = generate_random_password(); $user_id = username_exists($user_login); if ( ! $user_id ) $user_id = wpmu_create_user($user_login, $password, $user_email); else $user_already_exists = true; if ( ! $user_id ) return new WP_Error('create_user', __('Could not create user'), $signup); $now = current_time('mysql', true); if ( empty($signup->domain) ) { $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) ); if ( isset($user_already_exists) ) return new WP_Error('user_already_exists', __('That username is already activated.'), $signup); wpmu_welcome_user_notification($user_id, $password, $meta); add_user_to_blog('1', $user_id, 'subscriber'); do_action('wpmu_activate_user', $user_id, $password, $meta); return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta); } wpmu_validate_blog_signup($signup->domain, $signup->title); $blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid); // TODO: What to do if we create a user but cannot create a blog? if ( is_wp_error($blog_id) ) { // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and // setting the activation flag. Let's just set the active flag and instruct the user to reset their password. if ( 'blog_taken' == $blog_id->get_error_code() ) { $blog_id->add_data($signup); $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) ); } return $blog_id; } $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) ); wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta); do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta); return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta); } function generate_random_password( $len = 8 ) { $random_password = substr(md5(uniqid(microtime())), 0, intval( $len ) ); $random_password = apply_filters('random_password', $random_password); return $random_password; } function wpmu_create_user( $user_name, $password, $email) { $user_name = preg_replace( "/\s+/", '', sanitize_user( $user_name, true ) ); if ( username_exists($user_name) ) return false; // Check if the email address has been used already. if ( email_exists($email) ) return false; $user_id = wp_create_user( $user_name, $password, $email ); $user = new WP_User($user_id); // Newly created users have no roles or caps until they are added to a blog. update_usermeta($user_id, 'capabilities', ''); update_usermeta($user_id, 'user_level', ''); do_action( 'wpmu_new_user', $user_id ); return $user_id; } function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) { $domain = preg_replace( "/\s+/", '', sanitize_user( $domain, true ) ); if( constant( 'VHOST' ) == 'yes' ) $domain = str_replace( '@', '', $domain ); $title = strip_tags( $title ); $user_id = (int) $user_id; if( empty($path) ) $path = '/'; // Check if the domain has been used already. We should return an error message. if ( domain_exists($domain, $path, $site_id) ) return new WP_Error('blog_taken', __('Blog already exists.')); if ( !defined("WP_INSTALLING") ) define( "WP_INSTALLING", true ); if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) return new WP_Error('insert_blog', __('Could not create blog.')); switch_to_blog($blog_id); install_blog($blog_id, $title); install_blog_defaults($blog_id, $user_id); add_user_to_blog($blog_id, $user_id, 'administrator'); if ( is_array($meta) ) foreach ($meta as $key => $value) { if( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' ) { update_blog_status( $blog_id, $key, $value ); } else { update_option( $key, $value ); } } add_option( 'WPLANG', get_site_option( 'WPLANG' ) ); update_option( 'blog_public', $meta['public'] ); if(get_usermeta( $user_id, 'primary_blog' ) == 1 ) update_usermeta( $user_id, 'primary_blog', $blog_id ); restore_current_blog(); do_action( 'wpmu_new_blog', $blog_id, $user_id ); return $blog_id; } function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) { global $current_site; if( get_site_option( 'registrationnotification' ) != 'yes' ) return false; $email = get_site_option( 'admin_email' ); if( is_email($email) == false ) return false; $options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/wpmu-options.php"); $msg = sprintf(__("New Blog: %1s URL: %2s Remote IP: %3s Disable these notifications: %4s"), get_blog_option( $blog_id, "blogname" ), get_blog_option( $blog_id, "siteurl" ), $_SERVER['REMOTE_ADDR'], $options_site_url); $msg = apply_filters( 'newblog_notify_siteadmin', $msg ); wp_mail( $email, sprintf(__("New Blog Registration: %s"), get_blog_option( $blog_id, "siteurl" )), $msg ); return true; } function newuser_notify_siteadmin( $user_id ) { global $current_site; if( get_site_option( 'registrationnotification' ) != 'yes' ) return false; $email = get_site_option( 'admin_email' ); if( is_email($email) == false ) return false; $user = new WP_User($user_id); $options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/wpmu-options.php"); $msg = sprintf(__("New User: %1s Remote IP: %2s Disable these notifications: %3s"), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url); $msg = apply_filters( 'newuser_notify_siteadmin', $msg ); wp_mail( $email, sprintf(__("New User Registration: %s"), $user->user_login), $msg ); return true; } function domain_exists($domain, $path, $site_id = 1) { global $wpdb; return $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) ); } function insert_blog($domain, $path, $site_id) { global $wpdb; $path = trailingslashit($path); $site_id = (int) $site_id; $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) ); if ( !$wpdb->insert_id ) return false; refresh_blog_details($wpdb->insert_id); return $wpdb->insert_id; } // Install an empty blog. wpdb should already be switched. function install_blog($blog_id, $blog_title = '') { global $wpdb, $table_prefix, $wp_roles; // Cast for security $blog_id = (int) $blog_id; require_once( ABSPATH . 'wp-admin/includes/upgrade.php'); $wpdb->suppress_errors(); if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") ) die(__('

    Already Installed

    You appear to have already installed WordPress. To reinstall please clear your old database tables first.

    ') . ''); $wpdb->suppress_errors( false); $url = get_blogaddress_by_id($blog_id); // Set everything up make_db_current_silent(); populate_options(); populate_roles(); $wp_roles->_init(); // fix url. update_option('siteurl', $url); update_option('home', $url); update_option('fileupload_url', $url . "files" ); update_option('upload_path', "wp-content/blogs.dir/" . $blog_id . "/files"); update_option('blogname', $blog_title); update_option('admin_email', ''); $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); // Default category $wpdb->insert( $wpdb->terms, array('term_id' => 1, 'name' => __('Uncategorized'), 'slug' => sanitize_title(__('Uncategorized')), 'term_group' => 0) ); $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => 1, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1) ); // Default link category $cat_name = __('Blogroll'); $cat_slug = sanitize_title($cat_name); $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); if( $blogroll_id == null ) { $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql')) ); $blogroll_id = $wpdb->insert_id; } $wpdb->insert( $wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 2) ); update_option('default_link_category', $blogroll_id); // remove all perms $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'user_level') ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'capabilities') ); wp_cache_delete('notoptions', 'options'); wp_cache_delete('alloptions', 'options'); $wpdb->suppress_errors( false ); } function install_blog_defaults($blog_id, $user_id) { global $wpdb, $wp_rewrite, $current_site, $table_prefix; $wpdb->suppress_errors(); // Cast for security $user_id = (int) $user_id; $blog_id = (int) $blog_id; // Default links $wpdb->insert( $wpdb->links, array('link_url' => 'http://wordpress.com/', 'link_name' => 'WordPress.com', 'link_category' => '1356', 'link_owner' => $user_id, 'link_rss' => 'http://wordpress.com/feed/') ); $wpdb->insert( $wpdb->links, array('link_url' => 'http://wordpress.org/', 'link_name' => 'WordPress.org', 'link_category' => '1356', 'link_owner' => $user_id, 'link_rss' => 'http://wordpress.org/development/feed/') ); $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 2)); $wpdb->insert( $wpdb->term_relationships, array('object_id' => 2, 'term_taxonomy_id' => 2)); // First post $now = date('Y-m-d H:i:s'); $now_gmt = gmdate('Y-m-d H:i:s'); $first_post = get_site_option( 'first_post' ); if( $first_post == false ) { $first_post = stripslashes( __( 'Welcome to SITE_NAME. This is your first post. Edit or delete it, then start blogging!' ) ); } $first_post = str_replace( "SITE_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post ); $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => stripslashes( $first_post ), 'post_excerpt' => '', 'post_title' => __('Hello world!'), 'post_category' => 0, 'post_name' => __('hello-world'), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'comment_count' => 1 ) ); $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 1)); update_option( "post_count", 1 ); // First page $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'), 'post_excerpt' => '', 'post_title' => __('About'), 'post_category' => 0, 'post_name' => __('about'), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'post_status' => 'publish', 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '' ) ); // Flush rules to pick up the new page. $wp_rewrite->init(); $wp_rewrite->flush_rules(); // Default comment $wpdb->insert( $wpdb->comments, array( 'comment_post_ID' => '1', 'comment_author' => __('Mr WordPress'), 'comment_author_email' => '', 'comment_author_url' => 'http://' . $current_site->domain . $current_site->path, 'comment_author_IP' => '127.0.0.1', 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => __("Hi, this is a comment.
    To delete a comment, just log in, and view the posts' comments, there you will have the option to edit or delete them.") ) ); $user = new WP_User($user_id); $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') ); // Remove all perms except for the login user. $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') ); // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id. if ( !is_site_admin( $user->user_login ) && $user_id != 1 ) $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') ); $wpdb->suppress_errors( false ); } function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') { global $current_site; if( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) ) return false; $welcome_email = stripslashes( get_site_option( 'welcome_email' ) ); if( $welcome_email == false ) $welcome_email = stripslashes( __( "Dear User, Your new SITE_NAME blog has been successfully set up at: BLOG_URL You can log in to the administrator account with the following information: Username: USERNAME Password: PASSWORD Login Here: BLOG_URLwp-login.php We hope you enjoy your new weblog. Thanks! --The WordPress Team SITE_NAME" ) ); $url = get_blogaddress_by_id($blog_id); $user = new WP_User($user_id); $welcome_email = str_replace( "SITE_NAME", $current_site->site_name, $welcome_email ); $welcome_email = str_replace( "BLOG_URL", $url, $welcome_email ); $welcome_email = str_replace( "USERNAME", $user->user_login, $welcome_email ); $welcome_email = str_replace( "PASSWORD", $password, $welcome_email ); $welcome_email = apply_filters( "update_welcome_email", $welcome_email, $blog_id, $user_id, $password, $title, $meta); $admin_email = get_site_option( "admin_email" ); if( $admin_email == '' ) $admin_email = 'support@' . $_SERVER['SERVER_NAME']; $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = $welcome_email; if( empty( $current_site->site_name ) ) $current_site->site_name = "WordPress MU"; $subject = sprintf(__('New %1$s Blog: %2$s'), $current_site->site_name, $title); wp_mail($user->user_email, $subject, $message, $message_headers); return true; } function wpmu_welcome_user_notification($user_id, $password, $meta = '') { global $current_site; if( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) ) return false; $welcome_email = __( "Dear User, Your new account is setup. You can log in with the following information: Username: USERNAME Password: PASSWORD Thanks! --The WordPress Team SITE_NAME" ); $user = new WP_User($user_id); $welcome_email = apply_filters( "update_welcome_user_email", $welcome_email, $user_id, $password, $meta); $welcome_email = str_replace( "SITE_NAME", $current_site->site_name, $welcome_email ); $welcome_email = str_replace( "USERNAME", $user->user_login, $welcome_email ); $welcome_email = str_replace( "PASSWORD", $password, $welcome_email ); $admin_email = get_site_option( "admin_email" ); if( $admin_email == '' ) $admin_email = 'support@' . $_SERVER['SERVER_NAME']; $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = $welcome_email; if( empty( $current_site->site_name ) ) $current_site->site_name = "WordPress MU"; $subject = sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login); wp_mail($user->user_email, $subject, $message, $message_headers); return true; } function get_current_site() { global $current_site; return $current_site; } function get_user_id_from_string( $string ) { global $wpdb; if( is_email( $string ) ) { return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE user_email = %s", $string) ); } elseif ( is_numeric( $string ) ) { return $string; } return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE user_login = %s", $string) ); } function get_most_recent_post_of_user( $user_id ) { global $wpdb; $user_blogs = get_blogs_of_user( (int) $user_id ); $most_recent_post = array(); // Walk through each blog and get the most recent post // published by $user_id foreach ( (array) $user_blogs as $blog ) { $recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$wpdb->base_prefix}{$blog->userblog_id}_posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A); // Make sure we found a post if ( isset($recent_post['ID']) ) { $post_gmt_ts = strtotime($recent_post['post_date_gmt']); // If this is the first post checked or if this post is // newer than the current recent post, make it the new // most recent post. if ( !isset($most_recent_post['post_gmt_ts']) || ($post_gmt_ts > $most_recent_post['post_gmt_ts']) ) { $most_recent_post = array( 'blog_id' => $blog->userblog_id, 'post_id' => $recent_post['ID'], 'post_date_gmt' => $recent_post['post_date_gmt'], 'post_gmt_ts' => $post_gmt_ts ); } } } return $most_recent_post; } /* Misc functions */ function fix_upload_details( $uploads ) { $uploads['url'] = str_replace( UPLOADS, "files", $uploads['url'] ); return $uploads; } function get_dirsize($directory) { $size = 0; if(substr($directory,-1) == '/') $directory = substr($directory,0,-1); if(!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) return false; if($handle = opendir($directory)) { while(($file = readdir($handle)) !== false) { $path = $directory.'/'.$file; if($file != '.' && $file != '..') { if(is_file($path)) { $size += filesize($path); } elseif(is_dir($path)) { $handlesize = get_dirsize($path); if($handlesize >= 0) { $size += $handlesize; } else { return false; } } } } closedir($handle); } return $size; } function upload_is_user_over_quota( $echo = true ) { $spaceAllowed = get_space_allowed(); if(empty($spaceAllowed) || !is_numeric($spaceAllowed)) $spaceAllowed = 10; // Default space allowed is 10 MB $dirName = constant( "ABSPATH" ) . constant( "UPLOADS" ); $size = get_dirsize($dirName) / 1024 / 1024; if( ($spaceAllowed-$size) < 0 ) { if( $echo ) _e( "Sorry, you have used your space allocation. Please delete some files to upload more files." ); //No space left return true; } else { return false; } } function check_upload_mimes($mimes) { $site_exts = explode( " ", get_site_option( "upload_filetypes" ) ); foreach ( $site_exts as $ext ) { foreach ( $mimes as $ext_pattern => $mime ) { if( strpos( $ext_pattern, $ext ) !== false ) { $site_mimes[$ext_pattern] = $mime; } } } return $site_mimes; } function update_posts_count( $deprecated = '' ) { global $wpdb; update_option( "post_count", (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) ); } function wpmu_log_new_registrations( $blog_id, $user_id ) { global $wpdb; $user = new WP_User( (int) $user_id ); $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) ); } function fix_import_form_size( $size ) { if( upload_is_user_over_quota( false ) == true ) { return 0; } $spaceAllowed = 1024 * 1024 * get_space_allowed(); $dirName = constant( "ABSPATH" ) . constant( "UPLOADS" ); $dirsize = get_dirsize($dirName) ; if( $size > $spaceAllowed - $dirsize ) { return $spaceAllowed - $dirsize; // remaining space } else { return $size; // default } } if ( !function_exists('graceful_fail') ) : function graceful_fail( $message ) { $message = apply_filters('graceful_fail', $message); die(' Error!

    ' . $message . '

    '); } endif; /* Delete blog */ class delete_blog { function delete_blog() { $this->reallydeleteblog = false; add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_footer', array(&$this, 'admin_footer')); } function admin_footer() { global $wpdb, $current_blog, $current_site; if( $current_blog->domain . $current_blog->path == $current_site->domain . $current_site->path ) return false; if( $this->reallydeleteblog == true ) { wpmu_delete_blog( $wpdb->blogid ); } } function admin_menu() { global $current_blog, $current_site; if( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path ) add_submenu_page('options-general.php', __('Delete Blog'), __('Delete Blog'), 'manage_options', 'delete-blog', array(&$this, 'plugin_content')); } function plugin_content() { global $current_blog, $current_site; $this->delete_blog_hash = get_settings('delete_blog_hash'); echo '

    ' . __('Delete Blog') . '

    '; if( $_POST['action'] == "deleteblog" && $_POST['confirmdelete'] == '1' ) { $hash = substr( md5( $_SERVER['REQUEST_URI'] . time() ), 0, 6 ); update_option( "delete_blog_hash", $hash ); $url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash; $msg = __("Dear User, You recently clicked the 'Delete Blog' link on your blog and filled in a form on that page. If you really want to delete your blog, click the link below. You will not be asked to confirm again so only click this link if you are 100% certain: URL_DELETE If you delete your blog, please consider opening a new blog here some time in the future! (But remember your current blog and username are gone forever.) Thanks for using the site, Webmaster SITE_NAME "); $msg = str_replace( "URL_DELETE", $url_delete, $msg ); $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg ); wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg ); ?>

    reallydeleteblog = true; echo "

    " . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site->site_name) . "

    "; } else { $this->reallydeleteblog = false; echo "

    " . __("I'm sorry, the link you clicked is stale. Please select another option.") . "

    "; } } else { ?>

    Delete My Blog you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site->site_name); ?>

    ' />

    "; } } $delete_blog_obj = new delete_blog(); /* Global Categories */ function global_terms( $term_id, $deprecated = '' ) { global $wpdb; $term_id = intval( $term_id ); $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) ); $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) ); if ( $global_id == null ) { $wpdb->insert( $wpdb->sitecategories, array('cat_name' => $c->name, 'category_nicename' => $c->slug) ); $global_id = $wpdb->insert_id; } if ( $global_id == $term_id ) return $global_id; if( get_option( 'default_category' ) == $term_id ) update_option( 'default_category', $global_id ); $wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) ); $wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) ); $wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) ); clean_term_cache($term_id); return $global_id; } function choose_primary_blog() { global $current_user; ?>
    ID ); if( count( $all_blogs ) > 1 ) { $primary_blog = get_usermeta($current_user->ID, 'primary_blog'); ?>
    domain ); } function upload_is_file_too_big( $upload ) { if( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) ) return $upload; if( strlen( $upload[ 'bits' ] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) { return sprintf(__( "This file is too big. Files must be less than %dKb in size.
    " ), get_site_option( 'fileupload_maxk', 1500 )); } return $upload; } function safecss_filter_attr( $css, $deprecated = '' ) { $css = wp_kses_no_null($css); $css = str_replace(array("\n","\r","\t"), '', $css); $css_array = split( ';', trim( $css ) ); $allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float', 'text-direction', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'height', 'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'width', 'border', 'vertical-align', 'text-decoration' ) ); $css = ''; foreach( $css_array as $css_item ) { if( $css_item == '' ) continue; $css_item = trim( $css_item ); $found = false; if( strpos( $css_item, ':' ) === false ) { $found = true; } elseif( in_array( substr( $css_item, 0, strpos( $css_item, ':' ) ), $allowed_attr ) ) { $found = true; } if( $found ) { if( $css != '' ) $css .= ';'; $css .= $css_item; } } return $css; } function wordpressmu_authenticate_siteadmin( $user, $password = '' ) { if( is_site_admin( $user->user_login ) == false && ( $primary_blog = get_usermeta( $user->user_id, "primary_blog" ) ) ) { $details = get_blog_details( $primary_blog ); if( is_object( $details ) && $details->spam == 1 ) { return new WP_Error('blog_suspended', __('Blog Suspended.')); } } return $user; } function wordpressmu_wp_mail_from( $email ) { if( strpos( $email, 'wordpress@' ) !== false ) $email = get_option( 'admin_email' ); return $email; } /* XMLRPC getUsersBlogs() for a multiblog environment http://trac.mu.wordpress.org/attachment/ticket/551/xmlrpc-mu.php */ function wpmu_blogger_getUsersBlogs($args) { global $current_blog; $domain = $current_blog->domain; $path = $current_blog->path . 'xmlrpc.php'; $rpc = new IXR_Client("http://{$domain}{$path}"); $rpc->query('wp.getUsersBlogs', $args[1], $args[2]); $blogs = $rpc->getResponse(); if ( isset($blogs['faultCode']) ) { return new IXR_Error($blogs['faultCode'], $blogs['faultString']); } if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) { return $blogs; } else { foreach ( (array) $blogs as $blog ) { if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) ) return array($blog); } return array(); } } function attach_wpmu_xmlrpc($methods) { $methods['blogger.getUsersBlogs'] = 'wpmu_blogger_getUsersBlogs'; return $methods; } /* Users */ function promote_if_site_admin(&$user) { if ( !is_site_admin( $user->user_login ) ) return false; global $wpdb; $level = $wpdb->prefix . 'user_level'; $user->{$level} = 10; $user->user_level = 10; $cap_key = $wpdb->prefix . 'capabilities'; $user->{$cap_key} = array( 'administrator' => '1' ); return true; } if( is_object( $wp_object_cache ) ) { $wp_object_cache->global_groups = array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'); $wp_object_cache->non_persistent_groups = array('comment', 'counts'); } function mu_locale( $locale ) { if( defined('WP_INSTALLING') == false ) { $mu_locale = get_option('WPLANG'); if( $mu_locale === false ) $mu_locale = get_site_option('WPLANG'); if( $mu_locale !== false ) return $mu_locale; } return $locale; } function signup_nonce_fields() { $id = mt_rand(); echo ""; wp_nonce_field('signup_form_' . $id, '_signup_form', false); } function signup_nonce_check( $result ) { if( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) ) return $result; if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] ) wp_die( __('Please try again!') ); return $result; } function maybe_redirect_404() { if( is_main_blog() && is_404() && defined( 'NOBLOGREDIRECT' ) && constant( 'NOBLOGREDIRECT' ) != '' ) { wp_redirect( constant( 'NOBLOGREDIRECT' ) ); exit(); } } function remove_tinymce_media_button( $buttons ) { unset( $buttons[ array_search( 'media', $buttons ) ] ); return $buttons; } function add_existing_user_to_blog() { if( false !== strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) { $parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] ); $key = array_pop( $parts ); if( $key == '' ) $key = array_pop( $parts ); $details = get_option( "new_user_" . $key ); if( is_array( $details ) ) { add_user_to_blog( '', $details[ 'user_id' ], $details[ 'role' ] ); delete_option( 'new_user_' . $key ); do_action( "added_existing_user", $details[ 'user_id' ] ); wp_die( sprintf(__('You have been added to this blog. Please visit the homepage or login using your username and password.'), site_url(), site_url( '/wp-admin/' ) ) ); } } } ?> blogs/wp-includes/feed-rdf.php0000644000000000000000000000404411077635520015311 0ustar rootroot '; ?> > "> <?php bloginfo_rss('name'); wp_title_rss(); ?> hourly 1 2000-01-01T12:00+00:00 <?php the_title_rss() ?> post_date_gmt, false); ?> ]]> blogs/wp-includes/category.php0000644000000000000000000002611511077635520015455 0ustar rootroot 'category'); $args = wp_parse_args($args, $defaults); $taxonomy = 'category'; if ( 'link' == $args['type'] ) $taxonomy = 'link_category'; $categories = get_terms($taxonomy, $args); foreach ( array_keys($categories) as $k ) _make_cat_compat($categories[$k]); return $categories; } /** * Retrieves category data given a category ID or category object. * * If you pass the $category parameter an object, which is assumed to be the * category row object retrieved the database. It will cache the category data. * * If you pass $category an integer of the category ID, then that category will * be retrieved from the database, if it isn't already cached, and pass it back. * * If you look at get_term(), then both types will be passed through several * filters and finally sanitized based on the $filter parameter value. * * The category will converted to maintain backwards compatibility. * * @since 2.1.0 * @uses get_term() Used to get the category data from the taxonomy. * * @param int|object $category Category ID or Category row object * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N * @param string $filter Optional. Default is raw or no WordPress defined filter will applied. * @return mixed Category data in type defined by $output parameter. */ function &get_category($category, $output = OBJECT, $filter = 'raw') { $category = get_term($category, 'category', $output, $filter); if ( is_wp_error( $category ) ) return $category; _make_cat_compat($category); return $category; } /** * Retrieve category based on URL containing the category slug. * * Breaks the $category_path parameter up to get the category slug. * * Tries to find the child path and will return it. If it doesn't find a * match, then it will return the first category matching slug, if $full_match, * is set to false. If it does not, then it will return null. * * It is also possible that it will return a WP_Error object on failure. Check * for it when using this function. * * @since 2.1.0 * * @param string $category_path URL containing category slugs. * @param bool $full_match Optional. Whether should match full path or not. * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N * @return null|object|array Null on failure. Type is based on $output value. */ function get_category_by_path($category_path, $full_match = true, $output = OBJECT) { $category_path = rawurlencode(urldecode($category_path)); $category_path = str_replace('%2F', '/', $category_path); $category_path = str_replace('%20', ' ', $category_path); $category_paths = '/' . trim($category_path, '/'); $leaf_path = sanitize_title(basename($category_paths)); $category_paths = explode('/', $category_paths); $full_path = ''; foreach ( (array) $category_paths as $pathdir ) $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); $categories = get_terms('category', "get=all&slug=$leaf_path"); if ( empty($categories) ) return null; foreach ($categories as $category) { $path = '/' . $leaf_path; $curcategory = $category; while ( ($curcategory->parent != 0) && ($curcategory->parent != $curcategory->term_id) ) { $curcategory = get_term($curcategory->parent, 'category'); if ( is_wp_error( $curcategory ) ) return $curcategory; $path = '/' . $curcategory->slug . $path; } if ( $path == $full_path ) return get_category($category->term_id, $output); } // If full matching is not required, return the first cat that matches the leaf. if ( ! $full_match ) return get_category($categories[0]->term_id, $output); return null; } /** * Retrieve category object by category slug. * * @since 2.3.0 * * @param string $slug The category slug. * @return object Category data object */ function get_category_by_slug( $slug ) { $category = get_term_by('slug', $slug, 'category'); if ( $category ) _make_cat_compat($category); return $category; } /** * Retrieve the ID of a category from its name. * * @since 1.0.0 * * @param string $cat_name Optional. Default is 'General' and can be any category name. * @return int 0, if failure and ID of category on success. */ function get_cat_ID($cat_name='General') { $cat = get_term_by('name', $cat_name, 'category'); if ($cat) return $cat->term_id; return 0; } /** * Retrieve the category name by the category ID. * * @since 0.71 * @deprecated Use get_cat_name() * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name(). * * @param int $cat_ID Category ID * @return string category name */ function get_catname($cat_ID) { return get_cat_name($cat_ID); } /** * Retrieve the name of a category from its ID. * * @since 1.0.0 * * @param int $cat_id Category ID * @return string Category name */ function get_cat_name($cat_id) { $cat_id = (int) $cat_id; $category = &get_category($cat_id); return $category->name; } /** * Check if a category is an ancestor of another category. * * You can use either an id or the category object for both parameters. If you * use an integer the category will be retrieved. * * @since 2.1.0 * * @param int|object $cat1 ID or object to check if this is the parent category. * @param int|object $cat2 The child category. * @return bool Whether $cat2 is child of $cat1 */ function cat_is_ancestor_of($cat1, $cat2) { if ( is_int($cat1) ) $cat1 = & get_category($cat1); if ( is_int($cat2) ) $cat2 = & get_category($cat2); if ( !$cat1->term_id || !$cat2->parent ) return false; if ( $cat2->parent == $cat1->term_id ) return true; return cat_is_ancestor_of($cat1, get_category($cat2->parent)); } /** * Sanitizes category data based on context. * * @since 2.3.0 * @uses sanitize_term() See this function for what context are supported. * * @param object|array $category Category data * @param string $context Optional. Default is 'display'. * @return object|array Same type as $category with sanitized data for safe use. */ function sanitize_category($category, $context = 'display') { return sanitize_term($category, 'category', $context); } /** * Sanitizes data in single category key field. * * @since 2.3.0 * @uses sanitize_term_field() See function for more details. * * @param string $field Category key to sanitize * @param mixed $value Category value to sanitize * @param int $cat_id Category ID * @param string $context What filter to use, 'raw', 'display', etc. * @return mixed Same type as $value after $value has been sanitized. */ function sanitize_category_field($field, $value, $cat_id, $context) { return sanitize_term_field($field, $value, $cat_id, 'category', $context); } /* Tags */ /** * Retrieves all post tags. * * @since 2.3.0 * @see get_terms() For list of arguments to pass. * @uses apply_filters() Calls 'get_tags' hook on array of tags and with $args. * * @param string|array $args Tag arguments to use when retrieving tags. * @return array List of tags. */ function &get_tags($args = '') { $tags = get_terms('post_tag', $args); if ( empty($tags) ) return array(); $tags = apply_filters('get_tags', $tags, $args); return $tags; } /** * Retrieve post tag by tag ID or tag object. * * If you pass the $tag parameter an object, which is assumed to be the tag row * object retrieved the database. It will cache the tag data. * * If you pass $tag an integer of the tag ID, then that tag will * be retrieved from the database, if it isn't already cached, and pass it back. * * If you look at get_term(), then both types will be passed through several * filters and finally sanitized based on the $filter parameter value. * * @since 2.3.0 * * @param int|object $tag * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N * @param string $filter Optional. Default is raw or no WordPress defined filter will applied. * @return object|array Return type based on $output value. */ function &get_tag($tag, $output = OBJECT, $filter = 'raw') { return get_term($tag, 'post_tag', $output, $filter); } /* Cache */ /** * Update the categories cache. * * This function does not appear to be used anymore or does not appear to be * needed. It might be a legacy function left over from when there was a need * for updating the category cache. * * @since 1.5.0 * * @return bool Always return True */ function update_category_cache() { return true; } /** * Remove the category cache data based on ID. * * @since 2.1.0 * @uses clean_term_cache() Clears the cache for the category based on ID * * @param int $id Category ID */ function clean_category_cache($id) { clean_term_cache($id, 'category'); } /** * Update category structure to old pre 2.3 from new taxonomy structure. * * This function was added for the taxonomy support to update the new category * structure with the old category one. This will maintain compatibility with * plugins and themes which depend on the old key or property names. * * The parameter should only be passed a variable and not create the array or * object inline to the parameter. The reason for this is that parameter is * passed by reference and PHP will fail unless it has the variable. * * There is no return value, because everything is updated on the variable you * pass to it. This is one of the features with using pass by reference in PHP. * * @since 2.3.0 * @access private * * @param array|object $category Category Row object or array */ function _make_cat_compat( &$category) { if ( is_object($category) ) { $category->cat_ID = &$category->term_id; $category->category_count = &$category->count; $category->category_description = &$category->description; $category->cat_name = &$category->name; $category->category_nicename = &$category->slug; $category->category_parent = &$category->parent; } else if ( is_array($category) && isset($category['term_id']) ) { $category['cat_ID'] = &$category['term_id']; $category['category_count'] = &$category['count']; $category['category_description'] = &$category['description']; $category['cat_name'] = &$category['name']; $category['category_nicename'] = &$category['slug']; $category['category_parent'] = &$category['parent']; } } ?> blogs/wp-includes/class-phpmailer.php0000644000000000000000000012770611077635520016734 0ustar rootrootContentType = "text/html"; else $this->ContentType = "text/plain"; } /** * Sets Mailer to send message using SMTP. * @return void */ function IsSMTP() { $this->Mailer = "smtp"; } /** * Sets Mailer to send message using PHP mail() function. * @return void */ function IsMail() { $this->Mailer = "mail"; } /** * Sets Mailer to send message using the $Sendmail program. * @return void */ function IsSendmail() { $this->Mailer = "sendmail"; } /** * Sets Mailer to send message using the qmail MTA. * @return void */ function IsQmail() { $this->Sendmail = "/var/qmail/bin/sendmail"; $this->Mailer = "sendmail"; } ///////////////////////////////////////////////// // RECIPIENT METHODS ///////////////////////////////////////////////// /** * Adds a "To" address. * @param string $address * @param string $name * @return void */ function AddAddress($address, $name = "") { $cur = count($this->to); $this->to[$cur][0] = trim($address); $this->to[$cur][1] = $name; } /** * Adds a "Cc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" * mailer. * @param string $address * @param string $name * @return void */ function AddCC($address, $name = "") { $cur = count($this->cc); $this->cc[$cur][0] = trim($address); $this->cc[$cur][1] = $name; } /** * Adds a "Bcc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" * mailer. * @param string $address * @param string $name * @return void */ function AddBCC($address, $name = "") { $cur = count($this->bcc); $this->bcc[$cur][0] = trim($address); $this->bcc[$cur][1] = $name; } /** * Adds a "Reply-to" address. * @param string $address * @param string $name * @return void */ function AddReplyTo($address, $name = "") { $cur = count($this->ReplyTo); $this->ReplyTo[$cur][0] = trim($address); $this->ReplyTo[$cur][1] = $name; } ///////////////////////////////////////////////// // MAIL SENDING METHODS ///////////////////////////////////////////////// /** * Creates message and assigns Mailer. If the message is * not sent successfully then it returns false. Use the ErrorInfo * variable to view description of the error. * @return bool */ function Send() { $header = ""; $body = ""; $result = true; if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { $this->SetError($this->Lang("provide_address")); return false; } // Set whether the message is multipart/alternative if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative"; $this->error_count = 0; // reset errors $this->SetMessageType(); $header .= $this->CreateHeader(); $body = $this->CreateBody(); if($body == "") { return false; } // Choose the mailer switch($this->Mailer) { case "sendmail": $result = $this->SendmailSend($header, $body); break; case "mail": $result = $this->MailSend($header, $body); break; case "smtp": $result = $this->SmtpSend($header, $body); break; default: $this->SetError($this->Mailer . $this->Lang("mailer_not_supported")); $result = false; break; } return $result; } /** * Sends mail using the $Sendmail program. * @access private * @return bool */ function SendmailSend($header, $body) { if ($this->Sender != "") $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, escapeshellarg($this->Sender)); else $sendmail = sprintf("%s -oi -t", $this->Sendmail); if(!@$mail = popen($sendmail, "w")) { $this->SetError($this->Lang("execute") . $this->Sendmail); return false; } fputs($mail, $header); fputs($mail, $body); $result = pclose($mail) >> 8 & 0xFF; if($result != 0) { $this->SetError($this->Lang("execute") . $this->Sendmail); return false; } return true; } /** * Sends mail using the PHP mail() function. * @access private * @return bool */ function MailSend($header, $body) { $to = ""; for($i = 0; $i < count($this->to); $i++) { if($i != 0) { $to .= ", "; } $to .= $this->to[$i][0]; } if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1) { $old_from = ini_get("sendmail_from"); ini_set("sendmail_from", $this->Sender); $params = sprintf("-oi -f %s", $this->Sender); $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header, $params); } else $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); if (isset($old_from)) ini_set("sendmail_from", $old_from); if(!$rt) { $this->SetError($this->Lang("instantiate")); return false; } return true; } /** * Sends mail via SMTP using PhpSMTP (Author: * Chris Ryan). Returns bool. Returns false if there is a * bad MAIL FROM, RCPT, or DATA input. * @access private * @return bool */ function SmtpSend($header, $body) { include_once($this->PluginDir . "class-smtp.php"); $error = ""; $bad_rcpt = array(); if(!$this->SmtpConnect()) return false; $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; if(!$this->smtp->Mail($smtp_from)) { $error = $this->Lang("from_failed") . $smtp_from; $this->SetError($error); $this->smtp->Reset(); return false; } // Attempt to send attach all recipients for($i = 0; $i < count($this->to); $i++) { if(!$this->smtp->Recipient($this->to[$i][0])) $bad_rcpt[] = $this->to[$i][0]; } for($i = 0; $i < count($this->cc); $i++) { if(!$this->smtp->Recipient($this->cc[$i][0])) $bad_rcpt[] = $this->cc[$i][0]; } for($i = 0; $i < count($this->bcc); $i++) { if(!$this->smtp->Recipient($this->bcc[$i][0])) $bad_rcpt[] = $this->bcc[$i][0]; } if(count($bad_rcpt) > 0) // Create error message { for($i = 0; $i < count($bad_rcpt); $i++) { if($i != 0) { $error .= ", "; } $error .= $bad_rcpt[$i]; } $error = $this->Lang("recipients_failed") . $error; $this->SetError($error); $this->smtp->Reset(); return false; } if(!$this->smtp->Data($header . $body)) { $this->SetError($this->Lang("data_not_accepted")); $this->smtp->Reset(); return false; } if($this->SMTPKeepAlive == true) $this->smtp->Reset(); else $this->SmtpClose(); return true; } /** * Initiates a connection to an SMTP server. Returns false if the * operation failed. * @access private * @return bool */ function SmtpConnect() { if($this->smtp == NULL) { $this->smtp = new SMTP(); } $this->smtp->do_debug = $this->SMTPDebug; $hosts = explode(";", $this->Host); $index = 0; $connection = ($this->smtp->Connected()); // Retry while there is no connection while($index < count($hosts) && $connection == false) { if(strstr($hosts[$index], ":")) list($host, $port) = explode(":", $hosts[$index]); else { $host = $hosts[$index]; $port = $this->Port; } if($this->smtp->Connect($host, $port, $this->Timeout)) { if ($this->Helo != '') $this->smtp->Hello($this->Helo); else $this->smtp->Hello($this->ServerHostname()); if($this->SMTPAuth) { if(!$this->smtp->Authenticate($this->Username, $this->Password)) { $this->SetError($this->Lang("authenticate")); $this->smtp->Reset(); $connection = false; } } $connection = true; } $index++; } if(!$connection) $this->SetError($this->Lang("connect_host")); return $connection; } /** * Closes the active SMTP session if one exists. * @return void */ function SmtpClose() { if($this->smtp != NULL) { if($this->smtp->Connected()) { $this->smtp->Quit(); $this->smtp->Close(); } } } /** * Sets the language for all class error messages. Returns false * if it cannot load the language file. The default language type * is English. * @param string $lang_type Type of language (e.g. Portuguese: "br") * @param string $lang_path Path to the language file directory * @access public * @return bool */ function SetLanguage($lang_type, $lang_path = "language/") { if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); else if(file_exists($lang_path.'phpmailer.lang-en.php')) include($lang_path.'phpmailer.lang-en.php'); else { $this->SetError("Could not load language file"); return false; } $this->language = $PHPMAILER_LANG; return true; } ///////////////////////////////////////////////// // MESSAGE CREATION METHODS ///////////////////////////////////////////////// /** * Creates recipient headers. * @access private * @return string */ function AddrAppend($type, $addr) { $addr_str = $type . ": "; $addr_str .= $this->AddrFormat($addr[0]); if(count($addr) > 1) { for($i = 1; $i < count($addr); $i++) $addr_str .= ", " . $this->AddrFormat($addr[$i]); } $addr_str .= $this->LE; return $addr_str; } /** * Formats an address correctly. * @access private * @return string */ function AddrFormat($addr) { if(empty($addr[1])) $formatted = $addr[0]; else { $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . $addr[0] . ">"; } return $formatted; } /** * Wraps message for use with mailers that do not * automatically perform wrapping and for quoted-printable. * Original written by philippe. * @access private * @return string */ function WrapText($message, $length, $qp_mode = false) { $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; $message = $this->FixEOL($message); if (substr($message, -1) == $this->LE) $message = substr($message, 0, -1); $line = explode($this->LE, $message); $message = ""; for ($i=0 ;$i < count($line); $i++) { $line_part = explode(" ", $line[$i]); $buf = ""; for ($e = 0; $e $length)) { $space_left = $length - strlen($buf) - 1; if ($e != 0) { if ($space_left > 20) { $len = $space_left; if (substr($word, $len - 1, 1) == "=") $len--; elseif (substr($word, $len - 2, 1) == "=") $len -= 2; $part = substr($word, 0, $len); $word = substr($word, $len); $buf .= " " . $part; $message .= $buf . sprintf("=%s", $this->LE); } else { $message .= $buf . $soft_break; } $buf = ""; } while (strlen($word) > 0) { $len = $length; if (substr($word, $len - 1, 1) == "=") $len--; elseif (substr($word, $len - 2, 1) == "=") $len -= 2; $part = substr($word, 0, $len); $word = substr($word, $len); if (strlen($word) > 0) $message .= $part . sprintf("=%s", $this->LE); else $buf = $part; } } else { $buf_o = $buf; $buf .= ($e == 0) ? $word : (" " . $word); if (strlen($buf) > $length and $buf_o != "") { $message .= $buf_o . $soft_break; $buf = $word; } } } $message .= $buf . $this->LE; } return $message; } /** * Set the body wrapping. * @access private * @return void */ function SetWordWrap() { if($this->WordWrap < 1) return; switch($this->message_type) { case "alt": // fall through case "alt_attachments": $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); break; default: $this->Body = $this->WrapText($this->Body, $this->WordWrap); break; } } /** * Assembles message header. * @access private * @return string */ function CreateHeader() { $result = ""; // Set the boundaries $uniq_id = md5(uniqid(time())); $this->boundary[1] = "b1_" . $uniq_id; $this->boundary[2] = "b2_" . $uniq_id; $result .= $this->HeaderLine("Date", $this->RFCDate()); if($this->Sender == "") $result .= $this->HeaderLine("Return-Path", trim($this->From)); else $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); // To be created automatically by mail() if($this->Mailer != "mail") { if(count($this->to) > 0) $result .= $this->AddrAppend("To", $this->to); else if (count($this->cc) == 0) $result .= $this->HeaderLine("To", "undisclosed-recipients:;"); if(count($this->cc) > 0) $result .= $this->AddrAppend("Cc", $this->cc); } $from = array(); $from[0][0] = trim($this->From); $from[0][1] = $this->FromName; $result .= $this->AddrAppend("From", $from); // sendmail and mail() extract Bcc from the header before sending if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) $result .= $this->AddrAppend("Bcc", $this->bcc); if(count($this->ReplyTo) > 0) $result .= $this->AddrAppend("Reply-to", $this->ReplyTo); // mail() sets the subject itself if($this->Mailer != "mail") $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); $result .= $this->HeaderLine("X-Priority", $this->Priority); if($this->ConfirmReadingTo != "") { $result .= $this->HeaderLine("Disposition-Notification-To", "<" . trim($this->ConfirmReadingTo) . ">"); } // Add custom headers for($index = 0; $index < count($this->CustomHeader); $index++) { $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); } $result .= $this->HeaderLine("MIME-Version", "1.0"); switch($this->message_type) { case "plain": $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding); $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet); break; case "attachments": // fall through case "alt_attachments": if($this->InlineImageExists()) { $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", "multipart/related", $this->LE, $this->LE, $this->boundary[1], $this->LE); } else { $result .= $this->HeaderLine("Content-Type", "multipart/mixed;"); $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); } break; case "alt": $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); break; } if($this->Mailer != "mail") $result .= $this->LE.$this->LE; return $result; } /** * Assembles the message body. Returns an empty string on failure. * @access private * @return string */ function CreateBody() { $result = ""; $this->SetWordWrap(); switch($this->message_type) { case "alt": $result .= $this->GetBoundary($this->boundary[1], "", "text/plain", ""); $result .= $this->EncodeString($this->AltBody, $this->Encoding); $result .= $this->LE.$this->LE; $result .= $this->GetBoundary($this->boundary[1], "", "text/html", ""); $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE.$this->LE; $result .= $this->EndBoundary($this->boundary[1]); break; case "plain": $result .= $this->EncodeString($this->Body, $this->Encoding); break; case "attachments": $result .= $this->GetBoundary($this->boundary[1], "", "", ""); $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE; $result .= $this->AttachAll(); break; case "alt_attachments": $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", "multipart/alternative", $this->LE, $this->boundary[2], $this->LE.$this->LE); // Create text body $result .= $this->GetBoundary($this->boundary[2], "", "text/plain", "") . $this->LE; $result .= $this->EncodeString($this->AltBody, $this->Encoding); $result .= $this->LE.$this->LE; // Create the HTML body $result .= $this->GetBoundary($this->boundary[2], "", "text/html", "") . $this->LE; $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE.$this->LE; $result .= $this->EndBoundary($this->boundary[2]); $result .= $this->AttachAll(); break; } if($this->IsError()) $result = ""; return $result; } /** * Returns the start of a message boundary. * @access private */ function GetBoundary($boundary, $charSet, $contentType, $encoding) { $result = ""; if($charSet == "") { $charSet = $this->CharSet; } if($contentType == "") { $contentType = $this->ContentType; } if($encoding == "") { $encoding = $this->Encoding; } $result .= $this->TextLine("--" . $boundary); $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet); $result .= $this->LE; $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); $result .= $this->LE; return $result; } /** * Returns the end of a message boundary. * @access private */ function EndBoundary($boundary) { return $this->LE . "--" . $boundary . "--" . $this->LE; } /** * Sets the message type. * @access private * @return void */ function SetMessageType() { if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) $this->message_type = "plain"; else { if(count($this->attachment) > 0) $this->message_type = "attachments"; if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) $this->message_type = "alt"; if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) $this->message_type = "alt_attachments"; } } /** * Returns a formatted header line. * @access private * @return string */ function HeaderLine($name, $value) { return $name . ": " . $value . $this->LE; } /** * Returns a formatted mail line. * @access private * @return string */ function TextLine($value) { return $value . $this->LE; } ///////////////////////////////////////////////// // ATTACHMENT METHODS ///////////////////////////////////////////////// /** * Adds an attachment from a path on the filesystem. * Returns false if the file could not be found * or accessed. * @param string $path Path to the attachment. * @param string $name Overrides the attachment name. * @param string $encoding File encoding (see $Encoding). * @param string $type File extension (MIME) type. * @return bool */ function AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream") { if(!@is_file($path)) { $this->SetError($this->Lang("file_access") . $path); return false; } $filename = basename($path); if($name == "") $name = $filename; $cur = count($this->attachment); $this->attachment[$cur][0] = $path; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $name; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = false; // isStringAttachment $this->attachment[$cur][6] = "attachment"; $this->attachment[$cur][7] = 0; return true; } /** * Attaches all fs, string, and binary attachments to the message. * Returns an empty string on failure. * @access private * @return string */ function AttachAll() { // Return text of body $mime = array(); // Add all attachments for($i = 0; $i < count($this->attachment); $i++) { // Check for string attachment $bString = $this->attachment[$i][5]; if ($bString) $string = $this->attachment[$i][0]; else $path = $this->attachment[$i][0]; $filename = $this->attachment[$i][1]; $name = $this->attachment[$i][2]; $encoding = $this->attachment[$i][3]; $type = $this->attachment[$i][4]; $disposition = $this->attachment[$i][6]; $cid = $this->attachment[$i][7]; $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); if($disposition == "inline") $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); // Encode as string attachment if($bString) { $mime[] = $this->EncodeString($string, $encoding); if($this->IsError()) { return ""; } $mime[] = $this->LE.$this->LE; } else { $mime[] = $this->EncodeFile($path, $encoding); if($this->IsError()) { return ""; } $mime[] = $this->LE.$this->LE; } } $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); return join("", $mime); } /** * Encodes attachment in requested format. Returns an * empty string on failure. * @access private * @return string */ function EncodeFile ($path, $encoding = "base64") { if(!@$fd = fopen($path, "rb")) { $this->SetError($this->Lang("file_open") . $path); return ""; } $magic_quotes = get_magic_quotes_runtime(); set_magic_quotes_runtime(0); $file_buffer = fread($fd, filesize($path)); $file_buffer = $this->EncodeString($file_buffer, $encoding); fclose($fd); set_magic_quotes_runtime($magic_quotes); return $file_buffer; } /** * Encodes string to requested format. Returns an * empty string on failure. * @access private * @return string */ function EncodeString ($str, $encoding = "base64") { $encoded = ""; switch(strtolower($encoding)) { case "base64": // chunk_split is found in PHP >= 3.0.6 $encoded = chunk_split(base64_encode($str), 76, $this->LE); break; case "7bit": case "8bit": $encoded = $this->FixEOL($str); if (substr($encoded, -(strlen($this->LE))) != $this->LE) $encoded .= $this->LE; break; case "binary": $encoded = $str; break; case "quoted-printable": $encoded = $this->EncodeQP($str); break; default: $this->SetError($this->Lang("encoding") . $encoding); break; } return $encoded; } /** * Encode a header string to best of Q, B, quoted or none. * @access private * @return string */ function EncodeHeader ($str, $position = 'text') { $x = 0; switch (strtolower($position)) { case 'phrase': if (!preg_match('/[\200-\377]/', $str)) { // Can't use addslashes as we don't know what value has magic_quotes_sybase. $encoded = addcslashes($str, "\0..\37\177\\\""); if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) return ($encoded); else return ("\"$encoded\""); } $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); break; case 'comment': $x = preg_match_all('/[()"]/', $str, $matches); // Fall-through case 'text': default: $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); break; } if ($x == 0) return ($str); $maxlen = 75 - 7 - strlen($this->CharSet); // Try to select the encoding which should produce the shortest output if (strlen($str)/3 < $x) { $encoding = 'B'; $encoded = base64_encode($str); $maxlen -= $maxlen % 4; $encoded = trim(chunk_split($encoded, $maxlen, "\n")); } else { $encoding = 'Q'; $encoded = $this->EncodeQ($str, $position); $encoded = $this->WrapText($encoded, $maxlen, true); $encoded = str_replace("=".$this->LE, "\n", trim($encoded)); } $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); $encoded = trim(str_replace("\n", $this->LE, $encoded)); return $encoded; } /** * Encode string to quoted-printable. * @access private * @return string */ function EncodeQP ($str) { $encoded = $this->FixEOL($str); if (substr($encoded, -(strlen($this->LE))) != $this->LE) $encoded .= $this->LE; // Replace every high ascii, control and = characters $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded); // Replace every spaces and tabs when it's the last character on a line $encoded = preg_replace("/([\011\040])".$this->LE."/e", "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); // Maximum line length of 76 characters before CRLF (74 + space + '=') $encoded = $this->WrapText($encoded, 74, true); return $encoded; } /** * Encode string to q encoding. * @access private * @return string */ function EncodeQ ($str, $position = "text") { // There should not be any EOL in the string $encoded = preg_replace("[\r\n]", "", $str); switch (strtolower($position)) { case "phrase": $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); break; case "comment": $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); case "text": default: // Replace every high ascii, control =, ? and _ characters $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded); break; } // Replace every spaces to _ (more readable than =20) $encoded = str_replace(" ", "_", $encoded); return $encoded; } /** * Adds a string or binary attachment (non-filesystem) to the list. * This method can be used to attach ascii or binary data, * such as a BLOB record from a database. * @param string $string String attachment data. * @param string $filename Name of the attachment. * @param string $encoding File encoding (see $Encoding). * @param string $type File extension (MIME) type. * @return void */ function AddStringAttachment($string, $filename, $encoding = "base64", $type = "application/octet-stream") { // Append to $attachment array $cur = count($this->attachment); $this->attachment[$cur][0] = $string; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $filename; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = true; // isString $this->attachment[$cur][6] = "attachment"; $this->attachment[$cur][7] = 0; } /** * Adds an embedded attachment. This can include images, sounds, and * just about any other document. Make sure to set the $type to an * image type. For JPEG images use "image/jpeg" and for GIF images * use "image/gif". * @param string $path Path to the attachment. * @param string $cid Content ID of the attachment. Use this to identify * the Id for accessing the image in an HTML form. * @param string $name Overrides the attachment name. * @param string $encoding File encoding (see $Encoding). * @param string $type File extension (MIME) type. * @return bool */ function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", $type = "application/octet-stream") { if(!@is_file($path)) { $this->SetError($this->Lang("file_access") . $path); return false; } $filename = basename($path); if($name == "") $name = $filename; // Append to $attachment array $cur = count($this->attachment); $this->attachment[$cur][0] = $path; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $name; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = false; // isStringAttachment $this->attachment[$cur][6] = "inline"; $this->attachment[$cur][7] = $cid; return true; } /** * Returns true if an inline attachment is present. * @access private * @return bool */ function InlineImageExists() { $result = false; for($i = 0; $i < count($this->attachment); $i++) { if($this->attachment[$i][6] == "inline") { $result = true; break; } } return $result; } ///////////////////////////////////////////////// // MESSAGE RESET METHODS ///////////////////////////////////////////////// /** * Clears all recipients assigned in the TO array. Returns void. * @return void */ function ClearAddresses() { $this->to = array(); } /** * Clears all recipients assigned in the CC array. Returns void. * @return void */ function ClearCCs() { $this->cc = array(); } /** * Clears all recipients assigned in the BCC array. Returns void. * @return void */ function ClearBCCs() { $this->bcc = array(); } /** * Clears all recipients assigned in the ReplyTo array. Returns void. * @return void */ function ClearReplyTos() { $this->ReplyTo = array(); } /** * Clears all recipients assigned in the TO, CC and BCC * array. Returns void. * @return void */ function ClearAllRecipients() { $this->to = array(); $this->cc = array(); $this->bcc = array(); } /** * Clears all previously set filesystem, string, and binary * attachments. Returns void. * @return void */ function ClearAttachments() { $this->attachment = array(); } /** * Clears all custom headers. Returns void. * @return void */ function ClearCustomHeaders() { $this->CustomHeader = array(); } ///////////////////////////////////////////////// // MISCELLANEOUS METHODS ///////////////////////////////////////////////// /** * Adds the error message to the error container. * Returns void. * @access private * @return void */ function SetError($msg) { $this->error_count++; $this->ErrorInfo = $msg; } /** * Returns the proper RFC 822 formatted date. * @access private * @return string */ function RFCDate() { $tz = date("Z"); $tzs = ($tz < 0) ? "-" : "+"; $tz = abs($tz); $tz = ($tz/3600)*100 + ($tz%3600)/60; $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); return $result; } /** * Returns the appropriate server variable. Should work with both * PHP 4.1.0+ as well as older versions. Returns an empty string * if nothing is found. * @access private * @return mixed */ function ServerVar($varName) { global $HTTP_SERVER_VARS; global $HTTP_ENV_VARS; if(!isset($_SERVER)) { $_SERVER = $HTTP_SERVER_VARS; if(!isset($_SERVER["REMOTE_ADDR"])) $_SERVER = $HTTP_ENV_VARS; // must be Apache } if(isset($_SERVER[$varName])) return $_SERVER[$varName]; else return ""; } /** * Returns the server hostname or 'localhost.localdomain' if unknown. * @access private * @return string */ function ServerHostname() { if ($this->Hostname != "") $result = $this->Hostname; elseif ($this->ServerVar('SERVER_NAME') != "") $result = $this->ServerVar('SERVER_NAME'); else $result = "localhost.localdomain"; return $result; } /** * Returns a message in the appropriate language. * @access private * @return string */ function Lang($key) { if(count($this->language) < 1) $this->SetLanguage("en"); // set the default language if(isset($this->language[$key])) return $this->language[$key]; else return "Language string failed to load: " . $key; } /** * Returns true if an error occurred. * @return bool */ function IsError() { return ($this->error_count > 0); } /** * Changes every end of line from CR or LF to CRLF. * @access private * @return string */ function FixEOL($str) { $str = str_replace("\r\n", "\n", $str); $str = str_replace("\r", "\n", $str); $str = str_replace("\n", $this->LE, $str); return $str; } /** * Adds a custom header. * @return void */ function AddCustomHeader($custom_header) { $this->CustomHeader[] = explode(":", $custom_header, 2); } } ?> blogs/wp-includes/l10n.php0000644000000000000000000002346311077635520014415 0ustar rootroottranslate($text), $text); else return $text; } /** * translate_with_context() - Retrieve the translated text and strip context * * If the domain is set in the $l10n global, then the text is run * through the domain's translate method. After it is passed to * the 'gettext' filter hook, along with the untranslated text as * the second parameter. * * If the domain is not set, the $text is just returned. * * @since 2.5 * @uses translate() * * @param string $text Text to translate * @param string $domain Domain to retrieve the translated text * @return string Translated text */ function translate_with_context($text, $domain = 'default') { $whole = translate($text, $domain); $last_bar = strrpos($whole, '|'); if ( false == $last_bar ) { return $whole; } else { return substr($whole, 0, $last_bar); } } /** * __() - Retrieve a translated string * * __() is a convenience function which retrieves the translated * string from the translate(). * * @see translate() An alias of translate() * @since 2.1.0 * * @param string $text Text to translate * @param string $domain Optional. Domain to retrieve the translated text * @return string Translated text */ function __($text, $domain = 'default') { return translate($text, $domain); } // . /** * _e() - Display a translated string * * _e() is a convenience function which displays the returned * translated text from translate(). * * @see translate() Echos returned translate() string * @since 1.2.0 * * @param string $text Text to translate * @param string $domain Optional. Domain to retrieve the translated text */ function _e($text, $domain = 'default') { echo translate($text, $domain); } /** * _c() - Retrieve context translated string * * Quite a few times, there will be collisions with similar * translatable text found in more than two places but with * different translated context. * * In order to use the separate contexts, the _c() function * is used and the translatable string uses a pipe ('|') * which has the context the string is in. * * When the translated string is returned, it is everything * before the pipe, not including the pipe character. If * there is no pipe in the translated text then everything * is returned. * * @since 2.2.0 * * @param string $text Text to translate * @param string $domain Optional. Domain to retrieve the translated text * @return string Translated context string without pipe */ function _c($text, $domain = 'default') { return translate_with_context($text, $domain); } /** * __ngettext() - Retrieve the plural or single form based on the amount * * If the domain is not set in the $l10n list, then a comparsion * will be made and either $plural or $single parameters returned. * * If the domain does exist, then the parameters $single, $plural, * and $number will first be passed to the domain's ngettext method. * Then it will be passed to the 'ngettext' filter hook along with * the same parameters. The expected type will be a string. * * @since 1.2.0 * @uses $l10n Gets list of domain translated string (gettext_reader) objects * @uses apply_filters() Calls 'ngettext' hook on domains text returned, * along with $single, $plural, and $number parameters. Expected to return string. * * @param string $single The text that will be used if $number is 1 * @param string $plural The text that will be used if $number is not 1 * @param int $number The number to compare against to use either $single or $plural * @param string $domain Optional. The domain identifier the text should be retrieved in * @return string Either $single or $plural translated text */ function __ngettext($single, $plural, $number, $domain = 'default') { global $l10n; if (isset($l10n[$domain])) { return apply_filters('ngettext', $l10n[$domain]->ngettext($single, $plural, $number), $single, $plural, $number); } else { if ($number != 1) return $plural; else return $single; } } /** * __ngettext_noop() - register plural strings in POT file, but don't translate them * * Used when you want do keep structures with translatable plural strings and * use them later. * * Example: * $messages = array( * 'post' => ngettext_noop('%s post', '%s posts'), * 'page' => ngettext_noop('%s pages', '%s pages') * ); * ... * $message = $messages[$type]; * $usable_text = sprintf(__ngettext($message[0], $message[1], $count), $count); * * @since 2.5 * @param $single Single form to be i18ned * @param $plural Plural form to be i18ned * @param $number Not used, here for compatibility with __ngettext, optional * @param $domain Not used, here for compatibility with __ngettext, optional * @return array array($single, $plural) */ function __ngettext_noop($single, $plural, $number=1, $domain = 'default') { return array($single, $plural); } /** * load_textdomain() - Loads MO file into the list of domains * * If the domain already exists, the inclusion will fail. If the * MO file is not readable, the inclusion will fail. * * On success, the mofile will be placed in the $l10n global by * $domain and will be an gettext_reader object. * * @since 1.5.0 * @uses $l10n Gets list of domain translated string (gettext_reader) objects * @uses CacheFileReader Reads the MO file * @uses gettext_reader Allows for retrieving translated strings * * @param string $domain Unique identifier for retrieving translated strings * @param string $mofile Path to the .mo file * @return null On failure returns null and also on success returns nothing. */ function load_textdomain($domain, $mofile) { global $l10n; if ( is_readable($mofile)) $input = new CachedFileReader($mofile); else return; $gettext = new gettext_reader($input); if (isset($l10n[$domain])) { $l10n[$domain]->load_tables(); $gettext->load_tables(); $l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations); } else $l10n[$domain] = $gettext; unset($input, $gettext); } /** * load_default_textdomain() - Loads default translated strings based on locale * * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. * The translated (.mo) file is named based off of the locale. * * @since 1.5.0 */ function load_default_textdomain() { $locale = get_locale(); $mofile = WP_LANG_DIR . "/$locale.mo"; load_textdomain('default', $mofile); } /** * load_plugin_textdomain() - Loads the plugin's translated strings * * If the path is not given then it will be the root of the plugin * directory. The .mo file should be named based on the domain with a * dash followed by a dash, and then the locale exactly. * * @since 1.5.0 * * @param string $domain Unique identifier for retrieving translated strings * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder, * where the .mo file resides. Deprecated, but still functional until 2.7 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path */ function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) { $locale = get_locale(); if ( false !== $plugin_rel_path ) $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/'); else if ( false !== $abs_rel_path) $path = ABSPATH . trim( $abs_rel_path, '/'); else $path = WP_PLUGIN_DIR; $mofile = $path . '/'. $domain . '-' . $locale . '.mo'; load_textdomain($domain, $mofile); } /** * load_theme_textdomain() - Includes theme's translated strings for the theme * * If the current locale exists as a .mo file in the theme's root directory, it * will be included in the translated strings by the $domain. * * The .mo files must be named based on the locale exactly. * * @since 1.5.0 * * @param string $domain Unique identifier for retrieving translated strings */ function load_theme_textdomain($domain) { $locale = get_locale(); $mofile = get_template_directory() . "/$locale.mo"; load_textdomain($domain, $mofile); } ?> blogs/wp-includes/wpmu-default-filters.php0000644000000000000000000000343011077635520017713 0ustar rootrootblogs/wp-includes/cron.php0000644000000000000000000001237511077635520014604 0ustar rootroot false, 'args' => $args ); uksort( $crons, "strnatcasecmp" ); _set_cron_array( $crons ); } function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { $crons = _get_cron_array(); $schedules = wp_get_schedules(); $key = md5(serialize($args)); if ( !isset( $schedules[$recurrence] ) ) return false; $crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); uksort( $crons, "strnatcasecmp" ); _set_cron_array( $crons ); } function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) { $crons = _get_cron_array(); $schedules = wp_get_schedules(); $key = md5(serialize($args)); $interval = 0; // First we try to get it from the schedule if ( 0 == $interval ) $interval = $schedules[$recurrence]['interval']; // Now we try to get it from the saved interval in case the schedule disappears if ( 0 == $interval ) $interval = $crons[$timestamp][$hook][$key]['interval']; // Now we assume something is wrong and fail to schedule if ( 0 == $interval ) return false; while ( $timestamp < time() + 1 ) $timestamp += $interval; wp_schedule_event( $timestamp, $recurrence, $hook, $args ); } function wp_unschedule_event( $timestamp, $hook, $args = array() ) { $crons = _get_cron_array(); $key = md5(serialize($args)); unset( $crons[$timestamp][$hook][$key] ); if ( empty($crons[$timestamp][$hook]) ) unset( $crons[$timestamp][$hook] ); if ( empty($crons[$timestamp]) ) unset( $crons[$timestamp] ); _set_cron_array( $crons ); } function wp_clear_scheduled_hook( $hook ) { $args = array_slice( func_get_args(), 1 ); while ( $timestamp = wp_next_scheduled( $hook, $args ) ) wp_unschedule_event( $timestamp, $hook, $args ); } function wp_next_scheduled( $hook, $args = array() ) { $crons = _get_cron_array(); $key = md5(serialize($args)); if ( empty($crons) ) return false; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[$hook][$key] ) ) return $timestamp; } return false; } function spawn_cron() { $crons = _get_cron_array(); if ( !is_array($crons) ) return; $keys = array_keys( $crons ); if ( array_shift( $keys ) > time() ) return; $cron_url = get_option( 'siteurl' ) . '/wp-cron.php'; $parts = parse_url( $cron_url ); if ($parts['scheme'] == 'https') { // support for SSL was added in 4.3.0 if (version_compare(phpversion(), '4.3.0', '>=') && function_exists('openssl_open')) { $port = isset($parts['port']) ? $parts['port'] : 443; $argyle = @fsockopen('ssl://' . $parts['host'], $port, $errno, $errstr, 0.01); } else { return false; } } else { $port = isset($parts['port']) ? $parts['port'] : 80; $argyle = @ fsockopen( $parts['host'], $port, $errno, $errstr, 0.01 ); } if ( $argyle ) fputs( $argyle, "GET {$parts['path']}?check=" . wp_hash('187425') . " HTTP/1.0\r\n" . "Host: {$_SERVER['HTTP_HOST']}\r\n\r\n" ); } function wp_cron() { // Prevent infinite loops caused by lack of wp-cron.php if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false ) return; $crons = _get_cron_array(); if ( !is_array($crons) ) return; $keys = array_keys( $crons ); if ( isset($keys[0]) && $keys[0] > time() ) return; $schedules = wp_get_schedules(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > time() ) break; foreach ( $cronhooks as $hook => $args ) { if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) ) continue; spawn_cron(); break 2; } } } function wp_get_schedules() { $schedules = array( 'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ), 'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ), 'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ), ); return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); } function wp_get_schedule($hook, $args = array()) { $crons = _get_cron_array(); $key = md5(serialize($args)); if ( empty($crons) ) return false; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[$hook][$key] ) ) return $cron[$hook][$key]['schedule']; } return false; } // // Private functions // function _get_cron_array() { $cron = get_option('cron'); if ( ! is_array($cron) ) return false; if ( !isset($cron['version']) ) $cron = _upgrade_cron_array($cron); unset($cron['version']); return $cron; } function _set_cron_array($cron) { $cron['version'] = 2; update_option( 'cron', $cron ); } function _upgrade_cron_array($cron) { if ( isset($cron['version']) && 2 == $cron['version']) return $cron; $new_cron = array(); foreach ($cron as $timestamp => $hooks) { foreach ( $hooks as $hook => $args ) { $key = md5(serialize($args['args'])); $new_cron[$timestamp][$hook][$key] = $args; } } $new_cron['version'] = 2; update_option( 'cron', $new_cron ); return $new_cron; } ?> blogs/wp-includes/rewrite.php0000644000000000000000000010234211077635520015316 0ustar rootrootadd_rule($regex, $redirect, $after); } //Add a new tag (like %postname%) //warning: you must call this on init or earlier, otherwise the query var addition stuff won't work function add_rewrite_tag($tagname, $regex) { //validation if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') { return; } $qv = trim($tagname, '%'); global $wp_rewrite, $wp; $wp->add_query_var($qv); $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '='); } //Add a new feed type like /atom1/ function add_feed($feedname, $function) { global $wp_rewrite; if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is $wp_rewrite->feeds[] = $feedname; } $hook = 'do_feed_' . $feedname; // Remove default function hook remove_action($hook, $hook, 10, 1); add_action($hook, $function, 10, 1); return $hook; } define('EP_PERMALINK', 1 ); define('EP_ATTACHMENT', 2 ); define('EP_DATE', 4 ); define('EP_YEAR', 8 ); define('EP_MONTH', 16 ); define('EP_DAY', 32 ); define('EP_ROOT', 64 ); define('EP_COMMENTS', 128 ); define('EP_SEARCH', 256 ); define('EP_CATEGORIES', 512 ); define('EP_TAGS', 1024 ); define('EP_AUTHORS', 2048); define('EP_PAGES', 4096); //pseudo-places define('EP_NONE', 0 ); define('EP_ALL', 8191); //and an endpoint, like /trackback/ function add_rewrite_endpoint($name, $places) { global $wp_rewrite; $wp_rewrite->add_endpoint($name, $places); } /** * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/ * @param string $base the taxonomy base that we're going to filter * @return string * @author Mark Jaquith */ function _wp_filter_taxonomy_base( $base ) { if ( !empty( $base ) ) { $base = preg_replace( '|^/index\.php/|', '', $base ); $base = trim( $base, '/' ); } return $base; } // examine a url (supposedly from this blog) and try to // determine the post ID it represents. function url_to_postid($url) { global $wp_rewrite; $url = apply_filters('url_to_postid', $url); // First, check to see if there is a 'p=N' or 'page_id=N' to match against if ( preg_match('#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values) ) { $id = absint($values[2]); if ($id) return $id; } // Check to see if we are using rewrite rules $rewrite = $wp_rewrite->wp_rewrite_rules(); // Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options if ( empty($rewrite) ) return 0; // $url cleanup by Mark Jaquith // This fixes things like #anchors, ?query=strings, missing 'www.', // added 'www.', or added 'index.php/' that will mess up our WP_Query // and return a false negative // Get rid of the #anchor $url_split = explode('#', $url); $url = $url_split[0]; // Get rid of URL ?query=string $url_split = explode('?', $url); $url = $url_split[0]; // Add 'www.' if it is absent and should be there if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') ) $url = str_replace('://', '://www.', $url); // Strip 'www.' if it is present and shouldn't be if ( false === strpos(get_option('home'), '://www.') ) $url = str_replace('://www.', '://', $url); // Strip 'index.php/' if we're not using path info permalinks if ( !$wp_rewrite->using_index_permalinks() ) $url = str_replace('index.php/', '', $url); if ( false !== strpos($url, get_option('home')) ) { // Chop off http://domain.com $url = str_replace(get_option('home'), '', $url); } else { // Chop off /path/to/blog $home_path = parse_url(get_option('home')); $home_path = $home_path['path']; $url = str_replace($home_path, '', $url); } // Trim leading and lagging slashes $url = trim($url, '/'); $request = $url; // Done with cleanup // Look for matches. $request_match = $request; foreach ($rewrite as $match => $query) { // If the requesting file is the anchor of the match, prepend it // to the path info. if ( (! empty($url)) && (strpos($match, $url) === 0) && ($url != $request)) { $request_match = $url . '/' . $request; } if ( preg_match("!^$match!", $request_match, $matches) ) { // Got a match. // Trim the query of everything up to the '?'. $query = preg_replace("!^.+\?!", '', $query); // Substitute the substring matches into the query. eval("\$query = \"" . addslashes($query) . "\";"); // Filter out non-public query vars global $wp; parse_str($query, $query_vars); $query = array(); foreach ( $query_vars as $key => $value ) { if ( in_array($key, $wp->public_query_vars) ) $query[$key] = $value; } // Do the query $query = new WP_Query($query); if ( $query->is_single || $query->is_page ) return $query->post->ID; else return 0; } } return 0; } /* WP_Rewrite class *******************************************************************************/ class WP_Rewrite { var $permalink_structure; var $use_trailing_slashes; var $category_base; var $tag_base; var $category_structure; var $tag_structure; var $author_base = 'author'; var $author_structure; var $date_structure; var $page_structure; var $search_base = 'search'; var $search_structure; var $comments_base = 'comments'; var $feed_base = 'feed'; var $comments_feed_structure; var $feed_structure; var $front; var $root = ''; var $index = 'index.php'; var $matches = ''; var $rules; var $extra_rules = array(); //those not generated by the class, see add_rewrite_rule() var $extra_rules_top = array(); //those not generated by the class, see add_rewrite_rule() var $non_wp_rules = array(); //rules that don't redirect to WP's index.php var $extra_permastructs = array(); var $endpoints; var $use_verbose_rules = false; var $use_verbose_page_rules = true; var $rewritecode = array( '%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', '%postname%', '%post_id%', '%category%', '%tag%', '%author%', '%pagename%', '%search%' ); var $rewritereplace = array( '([0-9]{4})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([^/]+)', '([0-9]+)', '(.+?)', '(.+?)', '([^/]+)', '([^/]+?)', '(.+)' ); var $queryreplace = array ( 'year=', 'monthnum=', 'day=', 'hour=', 'minute=', 'second=', 'name=', 'p=', 'category_name=', 'tag=', 'author_name=', 'pagename=', 's=' ); var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); function using_permalinks() { if (empty($this->permalink_structure)) return false; else return true; } function using_index_permalinks() { if (empty($this->permalink_structure)) { return false; } // If the index is not in the permalink, we're using mod_rewrite. if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) { return true; } return false; } function using_mod_rewrite_permalinks() { if ( $this->using_permalinks() && ! $this->using_index_permalinks()) return true; else return false; } function preg_index($number) { $match_prefix = '$'; $match_suffix = ''; if (! empty($this->matches)) { $match_prefix = '$' . $this->matches . '['; $match_suffix = ']'; } return "$match_prefix$number$match_suffix"; } function page_uri_index() { global $wpdb; //get pages in order of hierarchy, i.e. children after parents $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'")); //now reverse it, because we need parents after children for rewrite rules to work properly $posts = array_reverse($posts, true); $page_uris = array(); $page_attachment_uris = array(); if ( !$posts ) return array( array(), array() ); foreach ($posts as $id => $post) { // URL => page name $uri = get_page_uri($id); $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id )); if ( $attachments ) { foreach ( $attachments as $attachment ) { $attach_uri = get_page_uri($attachment->ID); $page_attachment_uris[$attach_uri] = $attachment->ID; } } $page_uris[$uri] = $id; } return array( $page_uris, $page_attachment_uris ); } function page_rewrite_rules() { $rewrite_rules = array(); $page_structure = $this->get_page_permastruct(); if ( ! $this->use_verbose_page_rules ) { $this->add_rewrite_tag('%pagename%', "(.+?)", 'pagename='); $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); return $rewrite_rules; } $page_uris = $this->page_uri_index(); $uris = $page_uris[0]; $attachment_uris = $page_uris[1]; if( is_array( $attachment_uris ) ) { foreach ($attachment_uris as $uri => $pagename) { $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment='); $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); } } if( is_array( $uris ) ) { foreach ($uris as $uri => $pagename) { $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); } } return $rewrite_rules; } function get_date_permastruct() { if (isset($this->date_structure)) { return $this->date_structure; } if (empty($this->permalink_structure)) { $this->date_structure = ''; return false; } // The date permalink must have year, month, and day separated by slashes. $endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%'); $this->date_structure = ''; $date_endian = ''; foreach ($endians as $endian) { if (false !== strpos($this->permalink_structure, $endian)) { $date_endian= $endian; break; } } if ( empty($date_endian) ) $date_endian = '%year%/%monthnum%/%day%'; // Do not allow the date tags and %post_id% to overlap in the permalink // structure. If they do, move the date tags to $front/date/. $front = $this->front; preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); $tok_index = 1; foreach ($tokens[0] as $token) { if ( ($token == '%post_id%') && ($tok_index <= 3) ) { $front = $front . 'date/'; break; } $tok_index++; } $this->date_structure = $front . $date_endian; return $this->date_structure; } function get_year_permastruct() { $structure = $this->get_date_permastruct($this->permalink_structure); if (empty($structure)) { return false; } $structure = str_replace('%monthnum%', '', $structure); $structure = str_replace('%day%', '', $structure); $structure = preg_replace('#/+#', '/', $structure); return $structure; } function get_month_permastruct() { $structure = $this->get_date_permastruct($this->permalink_structure); if (empty($structure)) { return false; } $structure = str_replace('%day%', '', $structure); $structure = preg_replace('#/+#', '/', $structure); return $structure; } function get_day_permastruct() { return $this->get_date_permastruct($this->permalink_structure); } function get_category_permastruct() { if (isset($this->category_structure)) { return $this->category_structure; } if (empty($this->permalink_structure)) { $this->category_structure = ''; return false; } if (empty($this->category_base)) $this->category_structure = trailingslashit( $this->front . 'category' ); else $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base ); $this->category_structure .= '%category%'; return $this->category_structure; } function get_tag_permastruct() { if (isset($this->tag_structure)) { return $this->tag_structure; } if (empty($this->permalink_structure)) { $this->tag_structure = ''; return false; } if (empty($this->tag_base)) $this->tag_structure = trailingslashit( $this->front . 'tag' ); else $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base ); $this->tag_structure .= '%tag%'; return $this->tag_structure; } function get_extra_permastruct($name) { if ( isset($this->extra_permastructs[$name]) ) return $this->extra_permastructs[$name]; return false; } function get_author_permastruct() { if (isset($this->author_structure)) { return $this->author_structure; } if (empty($this->permalink_structure)) { $this->author_structure = ''; return false; } $this->author_structure = $this->front . $this->author_base . '/%author%'; return $this->author_structure; } function get_search_permastruct() { if (isset($this->search_structure)) { return $this->search_structure; } if (empty($this->permalink_structure)) { $this->search_structure = ''; return false; } $this->search_structure = $this->root . $this->search_base . '/%search%'; return $this->search_structure; } function get_page_permastruct() { if (isset($this->page_structure)) { return $this->page_structure; } if (empty($this->permalink_structure)) { $this->page_structure = ''; return false; } $this->page_structure = $this->root . '%pagename%'; return $this->page_structure; } function get_feed_permastruct() { if (isset($this->feed_structure)) { return $this->feed_structure; } if (empty($this->permalink_structure)) { $this->feed_structure = ''; return false; } $this->feed_structure = $this->root . $this->feed_base . '/%feed%'; return $this->feed_structure; } function get_comment_feed_permastruct() { if (isset($this->comment_feed_structure)) { return $this->comment_feed_structure; } if (empty($this->permalink_structure)) { $this->comment_feed_structure = ''; return false; } $this->comment_feed_structure = $this->root . $this->comments_base . '/' . $this->feed_base . '/%feed%'; return $this->comment_feed_structure; } function add_rewrite_tag($tag, $pattern, $query) { // If the tag already exists, replace the existing pattern and query for // that tag, otherwise add the new tag, pattern, and query to the end of // the arrays. $position = array_search($tag, $this->rewritecode); if (FALSE !== $position && NULL !== $position) { $this->rewritereplace[$position] = $pattern; $this->queryreplace[$position] = $query; } else { $this->rewritecode[] = $tag; $this->rewritereplace[] = $pattern; $this->queryreplace[] = $query; } } //the main WP_Rewrite function. generate the rules from permalink structure function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) { //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/? $feedregex2 = ''; foreach ($this->feeds as $feed_name) { $feedregex2 .= $feed_name . '|'; } $feedregex2 = '(' . trim($feedregex2, '|') . ')/?$'; //$feedregex is identical but with /feed/ added on as well, so URLs like /feed/atom //and /atom are both possible $feedregex = $this->feed_base . '/' . $feedregex2; //build a regex to match the trackback and page/xx parts of URLs $trackbackregex = 'trackback/?$'; $pageregex = 'page/?([0-9]{1,})/?$'; //build up an array of endpoint regexes to append => queries to append if ($endpoints) { $ep_query_append = array (); foreach ($this->endpoints as $endpoint) { //match everything after the endpoint name, but allow for nothing to appear there $epmatch = $endpoint[1] . '(/(.*))?/?$'; //this will be appended on to the rest of the query for each dir $epquery = '&' . $endpoint[1] . '='; $ep_query_append[$epmatch] = array ( $endpoint[0], $epquery ); } } //get everything up to the first rewrite tag $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); //build an array of the tags (note that said array ends up being in $tokens[0]) preg_match_all('/%.+?%/', $permalink_structure, $tokens); $num_tokens = count($tokens[0]); $index = $this->index; //probably 'index.php' $feedindex = $index; $trackbackindex = $index; //build a list from the rewritecode and queryreplace arrays, that will look something like //tagname=$matches[i] where i is the current $i for ($i = 0; $i < $num_tokens; ++$i) { if (0 < $i) { $queries[$i] = $queries[$i - 1] . '&'; } else { $queries[$i] = ''; } $query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1); $queries[$i] .= $query_token; } //get the structure, minus any cruft (stuff that isn't tags) at the front $structure = $permalink_structure; if ($front != '/') { $structure = str_replace($front, '', $structure); } //create a list of dirs to walk over, making rewrite rules for each level //so for example, a $structure of /%year%/%month%/%postname% would create //rewrite rules for /%year%/, /%year%/%month%/ and /%year%/%month%/%postname% $structure = trim($structure, '/'); if ($walk_dirs) { $dirs = explode('/', $structure); } else { $dirs[] = $structure; } $num_dirs = count($dirs); //strip slashes from the front of $front $front = preg_replace('|^/+|', '', $front); //the main workhorse loop $post_rewrite = array(); $struct = $front; for ($j = 0; $j < $num_dirs; ++$j) { //get the struct for this dir, and trim slashes off the front $struct .= $dirs[$j] . '/'; //accumulate. see comment near explode('/', $structure) above $struct = ltrim($struct, '/'); //replace tags with regexes $match = str_replace($this->rewritecode, $this->rewritereplace, $struct); //make a list of tags, and store how many there are in $num_toks $num_toks = preg_match_all('/%.+?%/', $struct, $toks); //get the 'tagname=$matches[i]' $query = ( isset($queries) && is_array($queries) ) ? $queries[$num_toks - 1] : ''; //set up $ep_mask_specific which is used to match more specific URL types switch ($dirs[$j]) { case '%year%': $ep_mask_specific = EP_YEAR; break; case '%monthnum%': $ep_mask_specific = EP_MONTH; break; case '%day%': $ep_mask_specific = EP_DAY; break; } //create query for /page/xx $pagematch = $match . $pageregex; $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index($num_toks + 1); //create query for /feed/(feed|atom|rss|rss2|rdf) $feedmatch = $match . $feedregex; $feedquery = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1); //create query for /(feed|atom|rss|rss2|rdf) (see comment near creation of $feedregex) $feedmatch2 = $match . $feedregex2; $feedquery2 = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1); //if asked to, turn the feed queries into comment feed ones if ($forcomments) { $feedquery .= '&withcomments=1'; $feedquery2 .= '&withcomments=1'; } //start creating the array of rewrites for this dir $rewrite = array(); if ($feed) //...adding on /feed/ regexes => queries $rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2); if ($paged) //...and /page/xx ones $rewrite = array_merge($rewrite, array($pagematch => $pagequery)); //do endpoints if ($endpoints) { foreach ($ep_query_append as $regex => $ep) { //add the endpoints on if the mask fits if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) { $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2); } } } //if we've got some tags in this dir if ($num_toks) { $post = false; $page = false; //check to see if this dir is permalink-level: i.e. the structure specifies an //individual post. Do this by checking it contains at least one of 1) post name, //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and //minute all present). Set these flags now as we need them for the endpoints. if (strpos($struct, '%postname%') !== false || strpos($struct, '%post_id%') !== false || strpos($struct, '%pagename%') !== false || (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)) { $post = true; if (strpos($struct, '%pagename%') !== false) $page = true; } //if we're creating rules for a permalink, do all the endpoints like attachments etc if ($post) { $post = true; //create query and regex for trackback $trackbackmatch = $match . $trackbackregex; $trackbackquery = $trackbackindex . '?' . $query . '&tb=1'; //trim slashes from the end of the regex for this dir $match = rtrim($match, '/'); //get rid of brackets $submatchbase = str_replace(array('(',')'),'',$match); //add a rule for at attachments, which take the form of /some-text $sub1 = $submatchbase . '/([^/]+)/'; $sub1tb = $sub1 . $trackbackregex; //add trackback regex /trackback/... $sub1feed = $sub1 . $feedregex; //and /feed/(atom|...) $sub1feed2 = $sub1 . $feedregex2; //and /(feed|atom...) //add an ? as we don't have to match that last slash, and finally a $ so we //match to the end of the URL //add another rule to match attachments in the explicit form: ///attachment/some-text $sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2tb = $sub2 . $trackbackregex; //and add trackbacks /attachment/trackback $sub2feed = $sub2 . $feedregex; //feeds, /attachment/feed/(atom|...) $sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this /attachment/(feed|atom...) //create queries for these extra tag-ons we've just dealt with $subquery = $index . '?attachment=' . $this->preg_index(1); $subtbquery = $subquery . '&tb=1'; $subfeedquery = $subquery . '&feed=' . $this->preg_index(2); //do endpoints for attachments if (! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) { if ($ep[0] & EP_ATTACHMENT) { $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); } } } //now we've finished with endpoints, finish off the $sub1 and $sub2 matches $sub1 .= '?$'; $sub2 .= '?$'; //allow URLs like /2 for /page/2 $match = $match . '(/[0-9]+)?/?$'; $query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1); } else { //not matching a permalink so this is a lot simpler //close the match and finalise the query $match .= '?$'; $query = $index . '?' . $query; } //create the final array for this dir by joining the $rewrite array (which currently //only contains rules/queries for trackback, pages etc) to the main regex/query for //this dir $rewrite = array_merge($rewrite, array($match => $query)); //if we're matching a permalink, add those extras (attachments etc) on if ($post) { //add trackback $rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite); //add regexes/queries for attachments, attachment trackbacks and so on if ( ! $page ) //require /attachment/stuff form for pages because of confusion with subpages $rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery)); $rewrite = array_merge(array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery), $rewrite); } } //if($num_toks) //add the rules for this dir to the accumulating $post_rewrite $post_rewrite = array_merge($rewrite, $post_rewrite); } //foreach ($dir) return $post_rewrite; //the finished rules. phew! } function generate_rewrite_rule($permalink_structure, $walk_dirs = false) { return $this->generate_rewrite_rules($permalink_structure, EP_NONE, false, false, false, $walk_dirs); } /* rewrite_rules * Construct rewrite matches and queries from permalink structure. * Returns an associate array of matches and queries. */ function rewrite_rules() { $rewrite = array(); if (empty($this->permalink_structure)) { return $rewrite; } // robots.txt $robots_rewrite = array('robots.txt$' => $this->index . '?robots=1'); //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category% $default_feeds = array( '.*wp-atom.php$' => $this->index .'?feed=atom', '.*wp-rdf.php$' => $this->index .'?feed=rdf', '.*wp-rss.php$' => $this->index .'?feed=rss', '.*wp-rss2.php$' => $this->index .'?feed=rss2', '.*wp-feed.php$' => $this->index .'?feed=feed', '.*wp-commentsrss2.php$' => $this->index . '?feed=rss2&withcomments=1'); // Post $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK); $post_rewrite = apply_filters('post_rewrite_rules', $post_rewrite); // Date $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct(), EP_DATE); $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite); // Root $root_rewrite = $this->generate_rewrite_rules($this->root . '/', EP_ROOT); $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite); // Comments $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, EP_COMMENTS, true, true, true, false); $comments_rewrite = apply_filters('comments_rewrite_rules', $comments_rewrite); // Search $search_structure = $this->get_search_permastruct(); $search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH); $search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite); // Categories $category_rewrite = $this->generate_rewrite_rules($this->get_category_permastruct(), EP_CATEGORIES); $category_rewrite = apply_filters('category_rewrite_rules', $category_rewrite); // Tags $tag_rewrite = $this->generate_rewrite_rules($this->get_tag_permastruct(), EP_TAGS); $tag_rewrite = apply_filters('tag_rewrite_rules', $tag_rewrite); // Authors $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS); $author_rewrite = apply_filters('author_rewrite_rules', $author_rewrite); // Pages $page_rewrite = $this->page_rewrite_rules(); $page_rewrite = apply_filters('page_rewrite_rules', $page_rewrite); // Extra permastructs foreach ( $this->extra_permastructs as $permastruct ) $this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct, EP_NONE)); // Put them together. if ( $this->use_verbose_page_rules ) $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules); else $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules); do_action_ref_array('generate_rewrite_rules', array(&$this)); $this->rules = apply_filters('rewrite_rules_array', $this->rules); return $this->rules; } function wp_rewrite_rules() { $this->rules = get_option('rewrite_rules'); if ( empty($this->rules) ) { $this->matches = 'matches'; $this->rewrite_rules(); update_option('rewrite_rules', $this->rules); } return $this->rules; } function mod_rewrite_rules() { if ( ! $this->using_permalinks()) { return ''; } $site_root = parse_url(get_option('siteurl')); $site_root = trailingslashit($site_root['path']); $home_root = parse_url(get_option('home')); $home_root = trailingslashit($home_root['path']); $rules = "\n"; $rules .= "RewriteEngine On\n"; $rules .= "RewriteBase $home_root\n"; //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) foreach ($this->non_wp_rules as $match => $query) { // Apache 1.3 does not support the reluctant (non-greedy) modifier. $match = str_replace('.+?', '.+', $match); // If the match is unanchored and greedy, prepend rewrite conditions // to avoid infinite redirects and eclipsing of real files. if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { //nada. } $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } if ($this->use_verbose_rules) { $this->matches = ''; $rewrite = $this->rewrite_rules(); $num_rules = count($rewrite); $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . "RewriteCond %{REQUEST_FILENAME} -d\n" . "RewriteRule ^.*$ - [S=$num_rules]\n"; foreach ($rewrite as $match => $query) { // Apache 1.3 does not support the reluctant (non-greedy) modifier. $match = str_replace('.+?', '.+', $match); // If the match is unanchored and greedy, prepend rewrite conditions // to avoid infinite redirects and eclipsing of real files. if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { //nada. } if (strpos($query, $this->index) !== false) { $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } else { $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n"; } } } else { $rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" . "RewriteCond %{REQUEST_FILENAME} !-d\n" . "RewriteRule . {$home_root}{$this->index} [L]\n"; } $rules .= "\n"; $rules = apply_filters('mod_rewrite_rules', $rules); $rules = apply_filters('rewrite_rules', $rules); // Deprecated return $rules; } //Add a straight rewrite rule function add_rule($regex, $redirect, $after = 'bottom') { //get everything up to the first ? $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?')); $front = substr($redirect, 0, $index); if ($front != $this->index) { //it doesn't redirect to WP's index.php $this->add_external_rule($regex, $redirect); } else { if ( 'bottom' == $after) $this->extra_rules = array_merge($this->extra_rules, array($regex => $redirect)); else $this->extra_rules_top = array_merge($this->extra_rules_top, array($regex => $redirect)); //$this->extra_rules[$regex] = $redirect; } } //add a rule that doesn't redirect to index.php function add_external_rule($regex, $redirect) { $this->non_wp_rules[$regex] = $redirect; } //add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places) function add_endpoint($name, $places) { global $wp; $this->endpoints[] = array ( $places, $name ); $wp->add_query_var($name); } function add_permastruct($name, $struct, $with_front = true) { if ( $with_front ) $struct = $this->front . $struct; $this->extra_permastructs[$name] = $struct; } function flush_rules() { delete_option('rewrite_rules'); $this->wp_rewrite_rules(); if ( function_exists('save_mod_rewrite_rules') ) save_mod_rewrite_rules(); } function init() { $this->extra_rules = $this->non_wp_rules = $this->endpoints = array(); $this->permalink_structure = get_option('permalink_structure'); $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%')); $this->root = ''; if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; } $this->category_base = get_option( 'category_base' ); $this->tag_base = get_option( 'tag_base' ); unset($this->category_structure); unset($this->author_structure); unset($this->date_structure); unset($this->page_structure); unset($this->search_structure); unset($this->feed_structure); unset($this->comment_feed_structure); $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false; // Enable generic rules for pages if permalink structure doesn't begin with a wildcard. $structure = ltrim($this->permalink_structure, '/'); if ( $this->using_index_permalinks() ) $structure = ltrim($this->permalink_structure, $this->index . '/'); if ( 0 === strpos($structure, '%postname%') || 0 === strpos($structure, '%category%') || 0 === strpos($structure, '%tag%') || 0 === strpos($structure, '%author%') ) $this->use_verbose_page_rules = true; else $this->use_verbose_page_rules = false; } function set_permalink_structure($permalink_structure) { if ($permalink_structure != $this->permalink_structure) { update_option('permalink_structure', $permalink_structure); $this->init(); } } function set_category_base($category_base) { if ($category_base != $this->category_base) { update_option('category_base', $category_base); $this->init(); } } function set_tag_base( $tag_base ) { if ( $tag_base != $this->tag_base ) { update_option( 'tag_base', $tag_base ); $this->init(); } } function WP_Rewrite() { $this->init(); } } ?> blogs/wp-includes/widgets.php0000644000000000000000000015563311077635520015316 0ustar rootroot 1 ) { $_args['name'] = isset($args['name']) ? sprintf($args['name'], $i) : sprintf(__('Sidebar %d'), $i); } else { $_args['name'] = isset($args['name']) ? $args['name'] : __('Sidebar'); } if (isset($args['id'])) { $_args['id'] = $args['id']; } else { $n = count($wp_registered_sidebars); do { $n++; $_args['id'] = "sidebar-$n"; } while (isset($wp_registered_sidebars[$_args['id']])); } register_sidebar($_args); } } function register_sidebar($args = array()) { global $wp_registered_sidebars; if ( is_string($args) ) parse_str($args, $args); $i = count($wp_registered_sidebars) + 1; $defaults = array( 'name' => sprintf(__('Sidebar %d'), $i ), 'id' => "sidebar-$i", 'before_widget' => '
  • ', 'after_widget' => "
  • \n", 'before_title' => '

    ', 'after_title' => "

    \n", ); $sidebar = array_merge($defaults, (array) $args); $wp_registered_sidebars[$sidebar['id']] = $sidebar; return $sidebar['id']; } function unregister_sidebar( $name ) { global $wp_registered_sidebars; if ( isset( $wp_registered_sidebars[$name] ) ) unset( $wp_registered_sidebars[$name] ); } function register_sidebar_widget($name, $output_callback, $classname = '') { // Compat if ( is_array($name) ) { if ( count($name) == 3 ) $name = sprintf($name[0], $name[2]); else $name = $name[0]; } $id = sanitize_title($name); $options = array(); if ( !empty($classname) && is_string($classname) ) $options['classname'] = $classname; $params = array_slice(func_get_args(), 2); $args = array($id, $name, $output_callback, $options); if ( !empty($params) ) $args = array_merge($args, $params); call_user_func_array('wp_register_sidebar_widget', $args); } function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) { global $wp_registered_widgets; $id = strtolower($id); if ( empty($output_callback) ) { unset($wp_registered_widgets[$id]); return; } $defaults = array('classname' => $output_callback); $options = wp_parse_args($options, $defaults); $widget = array( 'name' => $name, 'id' => $id, 'callback' => $output_callback, 'params' => array_slice(func_get_args(), 4) ); $widget = array_merge($widget, $options); if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) ) $wp_registered_widgets[$id] = $widget; } function wp_widget_description( $id ) { if ( !is_scalar($id) ) return; global $wp_registered_widgets; if ( isset($wp_registered_widgets[$id]['description']) ) return wp_specialchars( $wp_registered_widgets[$id]['description'] ); } function unregister_sidebar_widget($id) { return wp_unregister_sidebar_widget($id); } function wp_unregister_sidebar_widget($id) { wp_register_sidebar_widget($id, '', ''); wp_unregister_widget_control($id); } function register_widget_control($name, $control_callback, $width = '', $height = '') { // Compat if ( is_array($name) ) { if ( count($name) == 3 ) $name = sprintf($name[0], $name[2]); else $name = $name[0]; } $id = sanitize_title($name); $options = array(); if ( !empty($width) ) $options['width'] = $width; if ( !empty($height) ) $options['height'] = $height; $params = array_slice(func_get_args(), 4); $args = array($id, $name, $control_callback, $options); if ( !empty($params) ) $args = array_merge($args, $params); call_user_func_array('wp_register_widget_control', $args); } /* $options: height, width, id_base * height: never used * width: width of fully expanded control form. Try hard to use the default width. * id_base: for multi-widgets (widgets which allow multiple instances such as the text widget), an id_base must be provided. * the widget id will ennd up looking like {$id_base}-{$unique_number} */ function wp_register_widget_control($id, $name, $control_callback, $options = array()) { global $wp_registered_widget_controls; $id = strtolower($id); if ( empty($control_callback) ) { unset($wp_registered_widget_controls[$id]); return; } if ( isset($wp_registered_widget_controls[$id]) && !did_action( 'widgets_init' ) ) return; $defaults = array('width' => 250, 'height' => 200 ); // height is never used $options = wp_parse_args($options, $defaults); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $control_callback, 'params' => array_slice(func_get_args(), 4) ); $widget = array_merge($widget, $options); $wp_registered_widget_controls[$id] = $widget; } function unregister_widget_control($id) { return wp_unregister_widget_control($id); } function wp_unregister_widget_control($id) { return wp_register_widget_control($id, '', ''); } function dynamic_sidebar($index = 1) { global $wp_registered_sidebars, $wp_registered_widgets; if ( is_int($index) ) { $index = "sidebar-$index"; } else { $index = sanitize_title($index); foreach ( $wp_registered_sidebars as $key => $value ) { if ( sanitize_title($value['name']) == $index ) { $index = $key; break; } } } $sidebars_widgets = wp_get_sidebars_widgets(); if ( empty($wp_registered_sidebars[$index]) || !array_key_exists($index, $sidebars_widgets) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index]) ) return false; $sidebar = $wp_registered_sidebars[$index]; $did_one = false; foreach ( $sidebars_widgets[$index] as $id ) { $params = array_merge( array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ), (array) $wp_registered_widgets[$id]['params'] ); // Substitute HTML id and class attributes into before_widget $classname_ = ''; foreach ( (array) $wp_registered_widgets[$id]['classname'] as $cn ) { if ( is_string($cn) ) $classname_ .= '_' . $cn; elseif ( is_object($cn) ) $classname_ .= '_' . get_class($cn); } $classname_ = ltrim($classname_, '_'); $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_); $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[$id]['callback']; if ( is_callable($callback) ) { call_user_func_array($callback, $params); $did_one = true; } } return $did_one; } /* @return mixed false if widget is not active or id of sidebar in which the widget is active */ function is_active_widget($callback, $widget_id = false) { global $wp_registered_widgets; $sidebars_widgets = wp_get_sidebars_widgets(false); if ( is_array($sidebars_widgets) ) foreach ( $sidebars_widgets as $sidebar => $widgets ) if ( is_array($widgets) ) foreach ( $widgets as $widget ) if ( isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] ) return $sidebar; return false; } function is_dynamic_sidebar() { global $wp_registered_widgets, $wp_registered_sidebars; $sidebars_widgets = get_option('sidebars_widgets'); foreach ( $wp_registered_sidebars as $index => $sidebar ) { if ( count($sidebars_widgets[$index]) ) { foreach ( $sidebars_widgets[$index] as $widget ) if ( array_key_exists($widget, $wp_registered_widgets) ) return true; } } return false; } /* Internal Functions */ function wp_get_sidebars_widgets($update = true) { global $wp_registered_widgets, $wp_registered_sidebars; $sidebars_widgets = get_option('sidebars_widgets'); $_sidebars_widgets = array(); if ( !isset($sidebars_widgets['array_version']) ) $sidebars_widgets['array_version'] = 1; switch ( $sidebars_widgets['array_version'] ) { case 1 : foreach ( $sidebars_widgets as $index => $sidebar ) if ( is_array($sidebar) ) foreach ( $sidebar as $i => $name ) { $id = strtolower($name); if ( isset($wp_registered_widgets[$id]) ) { $_sidebars_widgets[$index][$i] = $id; continue; } $id = sanitize_title($name); if ( isset($wp_registered_widgets[$id]) ) { $_sidebars_widgets[$index][$i] = $id; continue; } $found = false; foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( strtolower($widget['name']) == strtolower($name) ) { $_sidebars_widgets[$index][$i] = $widget['id']; $found = true; break; } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) { $_sidebars_widgets[$index][$i] = $widget['id']; $found = true; break; } } if ( $found ) continue; unset($_sidebars_widgets[$index][$i]); } $_sidebars_widgets['array_version'] = 2; $sidebars_widgets = $_sidebars_widgets; unset($_sidebars_widgets); case 2 : $sidebars = array_keys( $wp_registered_sidebars ); if ( !empty( $sidebars ) ) { // Move the known-good ones first foreach ( $sidebars as $id ) { if ( array_key_exists( $id, $sidebars_widgets ) ) { $_sidebars_widgets[$id] = $sidebars_widgets[$id]; unset($sidebars_widgets[$id], $sidebars[$id]); } } // Assign to each unmatched registered sidebar the first available orphan unset( $sidebars_widgets[ 'array_version' ] ); while ( ( $sidebar = array_shift( $sidebars ) ) && $widgets = array_shift( $sidebars_widgets ) ) $_sidebars_widgets[ $sidebar ] = $widgets; $_sidebars_widgets['array_version'] = 3; $sidebars_widgets = $_sidebars_widgets; unset($_sidebars_widgets); } if ( $update ) update_option('sidebars_widgets', $sidebars_widgets); } unset($sidebars_widgets['array_version']); return $sidebars_widgets; } function wp_set_sidebars_widgets( $sidebars_widgets ) { update_option( 'sidebars_widgets', $sidebars_widgets ); } function wp_get_widget_defaults() { global $wp_registered_sidebars; $defaults = array(); foreach ( $wp_registered_sidebars as $index => $sidebar ) $defaults[$index] = array(); return $defaults; } /* Default Widgets */ function wp_widget_pages( $args ) { extract( $args ); $options = get_option( 'widget_pages' ); $title = empty( $options['title'] ) ? __( 'Pages' ) : apply_filters('widget_title', $options['title']); $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby']; $exclude = empty( $options['exclude'] ) ? '' : $options['exclude']; if ( $sortby == 'menu_order' ) { $sortby = 'menu_order, post_title'; } $out = wp_list_pages( array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ); if ( !empty( $out ) ) { ?>


    $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'show_images' => true, 'class' => 'linkcat widget' ))); } function wp_widget_search($args) { extract($args); $searchform_template = get_template_directory() . '/searchform.php'; echo $before_widget; // Use current theme search form if it exists if ( file_exists($searchform_template) ) { include_once($searchform_template); } else { ?>


    '; get_calendar(); echo '
    '; echo $after_widget; } function wp_widget_calendar_control() { $options = $newoptions = get_option('widget_calendar'); if ( $_POST["calendar-submit"] ) { $newoptions['title'] = strip_tags(stripslashes($_POST["calendar-title"])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_calendar', $options); } $title = attribute_escape($options['title']); ?>

    $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract( $widget_args, EXTR_SKIP ); $options = get_option('widget_text'); if ( !isset($options[$number]) ) return; $title = apply_filters('widget_title', $options[$number]['title']); $text = apply_filters( 'widget_text', $options[$number]['text'] ); ?>
    $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract( $widget_args, EXTR_SKIP ); $options = get_option('widget_text'); if ( !is_array($options) ) $options = array(); if ( !$updated && !empty($_POST['sidebar']) ) { $sidebar = (string) $_POST['sidebar']; $sidebars_widgets = wp_get_sidebars_widgets(); if ( isset($sidebars_widgets[$sidebar]) ) $this_sidebar =& $sidebars_widgets[$sidebar]; else $this_sidebar = array(); foreach ( $this_sidebar as $_widget_id ) { if ( 'wp_widget_text' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; if ( !in_array( "text-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. unset($options[$widget_number]); } } foreach ( (array) $_POST['widget-text'] as $widget_number => $widget_text ) { if ( !isset($widget_text['text']) && isset($options[$widget_number]) ) // user clicked cancel continue; $title = strip_tags(stripslashes($widget_text['title'])); if ( current_user_can('unfiltered_html') ) $text = stripslashes( $widget_text['text'] ); else $text = stripslashes(wp_filter_post_kses( $widget_text['text'] )); $options[$widget_number] = compact( 'title', 'text' ); } update_option('widget_text', $options); $updated = true; } if ( -1 == $number ) { $title = ''; $text = ''; $number = '%i%'; } else { $title = attribute_escape($options[$number]['title']); $text = format_to_edit($options[$number]['text']); } ?>

    'widget_text', 'description' => __('Arbitrary text or HTML')); $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'text'); $name = __('Text'); $id = false; foreach ( array_keys($options) as $o ) { // Old widgets can have null values for some reason if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) ) continue; $id = "text-$o"; // Never never never translate an id wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o )); wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o )); } // If there are none, we register the widget's existance with a generic template if ( !$id ) { wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) ); wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) ); } } // See large comment section at end of this file function wp_widget_categories($args, $widget_args = 1) { extract($args, EXTR_SKIP); if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract($widget_args, EXTR_SKIP); $options = get_option('widget_categories'); if ( !isset($options[$number]) ) return; $c = $options[$number]['count'] ? '1' : '0'; $h = $options[$number]['hierarchical'] ? '1' : '0'; $d = $options[$number]['dropdown'] ? '1' : '0'; $title = empty($options[$number]['title']) ? __('Categories') : apply_filters('widget_title', $options[$number]['title']); echo $before_widget; echo $before_title . $title . $after_title; $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ( $d ) { $cat_args['show_option_none'] = __('Select Category'); wp_dropdown_categories($cat_args); ?> $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract($widget_args, EXTR_SKIP); $options = get_option('widget_categories'); if ( !is_array( $options ) ) $options = array(); if ( !$updated && !empty($_POST['sidebar']) ) { $sidebar = (string) $_POST['sidebar']; $sidebars_widgets = wp_get_sidebars_widgets(); if ( isset($sidebars_widgets[$sidebar]) ) $this_sidebar =& $sidebars_widgets[$sidebar]; else $this_sidebar = array(); foreach ( $this_sidebar as $_widget_id ) { if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; if ( !in_array( "categories-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. unset($options[$widget_number]); } } foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) { if ( !isset($widget_cat['title']) && isset($options[$widget_number]) ) // user clicked cancel continue; $title = trim(strip_tags(stripslashes($widget_cat['title']))); $count = isset($widget_cat['count']); $hierarchical = isset($widget_cat['hierarchical']); $dropdown = isset($widget_cat['dropdown']); $options[$widget_number] = compact( 'title', 'count', 'hierarchical', 'dropdown' ); } update_option('widget_categories', $options); $updated = true; } if ( -1 == $number ) { $title = ''; $count = false; $hierarchical = false; $dropdown = false; $number = '%i%'; } else { $title = attribute_escape( $options[$number]['title'] ); $count = (bool) $options[$number]['count']; $hierarchical = (bool) $options[$number]['hierarchical']; $dropdown = (bool) $options[$number]['dropdown']; } ?>



    'widget_categories', 'description' => __( "A list or dropdown of categories" ) ); $name = __( 'Categories' ); $id = false; foreach ( array_keys($options) as $o ) { // Old widgets can have null values for some reason if ( !isset($options[$o]['title']) ) continue; $id = "categories-$o"; wp_register_sidebar_widget( $id, $name, 'wp_widget_categories', $widget_ops, array( 'number' => $o ) ); wp_register_widget_control( $id, $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => $o ) ); } // If there are none, we register the widget's existance with a generic template if ( !$id ) { wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) ); wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) ); } } function wp_widget_categories_upgrade() { $options = get_option( 'widget_categories' ); if ( !isset( $options['title'] ) ) return $options; $newoptions = array( 1 => $options ); update_option( 'widget_categories', $newoptions ); $sidebars_widgets = get_option( 'sidebars_widgets' ); if ( is_array( $sidebars_widgets ) ) { foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( is_array( $widgets ) ) { foreach ( $widgets as $widget ) $new_widgets[$sidebar][] = ( $widget == 'categories' ) ? 'categories-1' : $widget; } else { $new_widgets[$sidebar] = $widgets; } } if ( $new_widgets != $sidebars_widgets ) update_option( 'sidebars_widgets', $new_widgets ); } return $newoptions; } function wp_widget_recent_entries($args) { if ( '%BEG_OF_TITLE%' != $args['before_title'] ) { if ( $output = wp_cache_get('widget_recent_entries', 'widget') ) return print($output); ob_start(); } extract($args); $options = get_option('widget_recent_entries'); $title = empty($options['title']) ? __('Recent Posts') : apply_filters('widget_title', $options['title']); if ( !$number = (int) $options['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish')); if ($r->have_posts()) : ?>


    15 ) $number = 15; if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) { $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number"); wp_cache_add( 'recent_comments', $comments, 'widget' ); } ?>


    'widget_recent_comments', 'description' => __( 'The most recent comments' ) ); wp_register_sidebar_widget('recent-comments', __('Recent Comments'), 'wp_widget_recent_comments', $widget_ops); wp_register_widget_control('recent-comments', __('Recent Comments'), 'wp_widget_recent_comments_control'); if ( is_active_widget('wp_widget_recent_comments') ) add_action('wp_head', 'wp_widget_recent_comments_style'); } // See large comment section at end of this file function wp_widget_rss($args, $widget_args = 1) { extract($args, EXTR_SKIP); if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract($widget_args, EXTR_SKIP); $options = get_option('widget_rss'); if ( !isset($options[$number]) ) return; if ( isset($options[$number]['error']) && $options[$number]['error'] ) return; $url = $options[$number]['url']; while ( strstr($url, 'http') != $url ) $url = substr($url, 1); if ( empty($url) ) return; require_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss($url); $link = clean_url(strip_tags($rss->channel['link'])); while ( strstr($link, 'http') != $link ) $link = substr($link, 1); $desc = attribute_escape(strip_tags(html_entity_decode($rss->channel['description'], ENT_QUOTES))); $title = $options[$number]['title']; if ( empty($title) ) $title = htmlentities(strip_tags($rss->channel['title'])); if ( empty($title) ) $title = $desc; if ( empty($title) ) $title = __('Unknown Feed'); $title = apply_filters('widget_title', $title ); $url = clean_url(strip_tags($url)); if ( file_exists(dirname(__FILE__) . '/rss.png') ) $icon = str_replace(ABSPATH, site_url() . '/', dirname(__FILE__)) . '/rss.png'; else $icon = includes_url('images/rss.png'); $title = "RSS $title"; echo $before_widget; echo $before_title . $title . $after_title; wp_widget_rss_output( $rss, $options[$number] ); echo $after_widget; } function wp_widget_rss_output( $rss, $args = array() ) { if ( is_string( $rss ) ) { require_once(ABSPATH . WPINC . '/rss.php'); if ( !$rss = fetch_rss($rss) ) return; } elseif ( is_array($rss) && isset($rss['url']) ) { require_once(ABSPATH . WPINC . '/rss.php'); $args = $rss; if ( !$rss = fetch_rss($rss['url']) ) return; } elseif ( !is_object($rss) ) { return; } extract( $args, EXTR_SKIP ); $items = (int) $items; if ( $items < 1 || 20 < $items ) $items = 10; $show_summary = (int) $show_summary; $show_author = (int) $show_author; $show_date = (int) $show_date; if ( is_array( $rss->items ) && !empty( $rss->items ) ) { $rss->items = array_slice($rss->items, 0, $items); echo ''; } else { echo ''; } } function wp_widget_rss_control($widget_args) { global $wp_registered_widgets; static $updated = false; if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract($widget_args, EXTR_SKIP); $options = get_option('widget_rss'); if ( !is_array($options) ) $options = array(); $urls = array(); foreach ( $options as $option ) if ( isset($option['url']) ) $urls[$option['url']] = true; if ( !$updated && 'POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['sidebar']) ) { $sidebar = (string) $_POST['sidebar']; $sidebars_widgets = wp_get_sidebars_widgets(); if ( isset($sidebars_widgets[$sidebar]) ) $this_sidebar =& $sidebars_widgets[$sidebar]; else $this_sidebar = array(); foreach ( $this_sidebar as $_widget_id ) { if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; if ( !in_array( "rss-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. unset($options[$widget_number]); } } foreach( (array) $_POST['widget-rss'] as $widget_number => $widget_rss ) { if ( !isset($widget_rss['url']) && isset($options[$widget_number]) ) // user clicked cancel continue; $widget_rss = stripslashes_deep( $widget_rss ); $url = sanitize_url(strip_tags($widget_rss['url'])); $options[$widget_number] = wp_widget_rss_process( $widget_rss, !isset($urls[$url]) ); } update_option('widget_rss', $options); $updated = true; } if ( -1 == $number ) { $title = ''; $url = ''; $items = 10; $error = false; $number = '%i%'; $show_summary = 0; $show_author = 0; $show_date = 0; } else { extract( (array) $options[$number] ); } wp_widget_rss_form( compact( 'number', 'title', 'url', 'items', 'error', 'show_summary', 'show_author', 'show_date' ) ); } function wp_widget_rss_form( $args, $inputs = null ) { $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true ); $inputs = wp_parse_args( $inputs, $default_inputs ); extract( $args ); $number = attribute_escape( $number ); $title = attribute_escape( $title ); $url = attribute_escape( $url ); $items = (int) $items; if ( $items < 1 || 20 < $items ) $items = 10; $show_summary = (int) $show_summary; $show_author = (int) $show_author; $show_date = (int) $show_date; if ( $inputs['url'] ) : ?>

    channel['link'])); while ( strstr($link, 'http') != $link ) $link = substr($link, 1); } } return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' ); } function wp_widget_rss_register() { if ( !$options = get_option('widget_rss') ) $options = array(); $widget_ops = array('classname' => 'widget_rss', 'description' => __( 'Entries from any RSS or Atom feed' )); $control_ops = array('width' => 400, 'height' => 200, 'id_base' => 'rss'); $name = __('RSS'); $id = false; foreach ( array_keys($options) as $o ) { // Old widgets can have null values for some reason if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) ) continue; $id = "rss-$o"; // Never never never translate an id wp_register_sidebar_widget($id, $name, 'wp_widget_rss', $widget_ops, array( 'number' => $o )); wp_register_widget_control($id, $name, 'wp_widget_rss_control', $control_ops, array( 'number' => $o )); } // If there are none, we register the widget's existance with a generic template if ( !$id ) { wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) ); wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) ); } } function wp_widget_tag_cloud($args) { extract($args); $options = get_option('widget_tag_cloud'); $title = empty($options['title']) ? __('Tags') : apply_filters('widget_title', $options['title']); echo $before_widget; echo $before_title . $title . $after_title; wp_tag_cloud(); echo $after_widget; } function wp_widget_tag_cloud_control() { $options = $newoptions = get_option('widget_tag_cloud'); if ( $_POST['tag-cloud-submit'] ) { $newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title'])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_tag_cloud', $options); } $title = attribute_escape( $options['title'] ); ?>

    'widget_pages', 'description' => __( "Your blog's WordPress Pages") ); wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $widget_ops); wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control' ); $widget_ops = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") ); wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $widget_ops); wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control' ); $widget_ops = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") ); wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $widget_ops); wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control' ); $widget_ops = array('classname' => 'widget_links', 'description' => __( "Your blogroll") ); wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $widget_ops); $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops); wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control' ); $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") ); wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $widget_ops); $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") ); wp_register_sidebar_widget('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries', $widget_ops); wp_register_widget_control('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries_control' ); $widget_ops = array('classname' => 'widget_tag_cloud', 'description' => __( "Your most used tags in cloud format") ); wp_register_sidebar_widget('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud', $widget_ops); wp_register_widget_control('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud_control' ); wp_widget_categories_register(); wp_widget_text_register(); wp_widget_rss_register(); wp_widget_recent_comments_register(); do_action('widgets_init'); } add_action('init', 'wp_widgets_init', 1); /* Pattern for multi-widget (allows multiple instances such as the text widget). // Displays widget on blag // $widget_args: number // number: which of the several widgets of this type do we mean function widget_many( $args, $widget_args = 1 ) { extract( $args, EXTR_SKIP ); if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract( $widget_args, EXTR_SKIP ); // Data should be stored as array: array( number => data for that instance of the widget, ... ) $options = get_option('widget_many'); if ( !isset($options[$number]) ) return; echo $before_widget; // Do stuff for this widget, drawing data from $options[$number] echo $after_widget; } // Displays form for a particular instance of the widget. Also updates the data after a POST submit // $widget_args: number // number: which of the several widgets of this type do we mean function widget_many_control( $widget_args = 1 ) { global $wp_registered_widgets; static $updated = false; // Whether or not we have already updated the data after a POST submit if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract( $widget_args, EXTR_SKIP ); // Data should be stored as array: array( number => data for that instance of the widget, ... ) $options = get_option('widget_many'); if ( !is_array($options) ) $options = array(); // We need to update the data if ( !$updated && !empty($_POST['sidebar']) ) { // Tells us what sidebar to put the data in $sidebar = (string) $_POST['sidebar']; $sidebars_widgets = wp_get_sidebars_widgets(); if ( isset($sidebars_widgets[$sidebar]) ) $this_sidebar =& $sidebars_widgets[$sidebar]; else $this_sidebar = array(); foreach ( $this_sidebar as $_widget_id ) { // Remove all widgets of this type from the sidebar. We'll add the new data in a second. This makes sure we don't get any duplicate data // since widget ids aren't necessarily persistent across multiple updates if ( 'widget_many' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; if ( !in_array( "many-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. "many-$widget_number" is "{id_base}-{widget_number} unset($options[$widget_number]); } } foreach ( (array) $_POST['widget-many'] as $widget_number => $widget_many_instance ) { // compile data from $widget_many_instance if ( !isset($widget_many_instance['something']) && isset($options[$widget_number]) ) // user clicked cancel continue; $something = wp_specialchars( $widget_many_instance['something'] ); $options[$widget_number] = array( 'something' => $something ); // Even simple widgets should store stuff in array, rather than in scalar } update_option('widget_many', $options); $updated = true; // So that we don't go through this more than once } // Here we echo out the form if ( -1 == $number ) { // We echo out a template for a form which can be converted to a specific form later via JS $something = ''; $number = '%i%'; } else { $something = attribute_escape($options[$number]['something']); } // The form has inputs with names like widget-many[$number][something] so that all data for that instance of // the widget are stored in one $_POST variable: $_POST['widget-many'][$number] ?>

    'widget_many', 'description' => __('Widget which allows multiple instances')); $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'many'); $name = __('Many'); $registered = false; foreach ( array_keys($options) as $o ) { // Old widgets can have null values for some reason if ( !isset($options[$o]['something']) ) // we used 'something' above in our exampple. Replace with with whatever your real data are. continue; // $id should look like {$id_base}-{$o} $id = "many-$o"; // Never never never translate an id $registered = true; wp_register_sidebar_widget( $id, $name, 'widget_many', $widget_ops, array( 'number' => $o ) ); wp_register_widget_control( $id, $name, 'widget_many_control', $control_ops, array( 'number' => $o ) ); } // If there are none, we register the widget's existance with a generic template if ( !$registered ) { wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) ); wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) ); } } // This is important add_action( 'widgets_init', 'widget_many_register' ) */ ?> blogs/wp-includes/streams.php0000644000000000000000000001052311077635520015312 0ustar rootroot. This file is part of PHP-gettext. PHP-gettext is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PHP-gettext is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PHP-gettext; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Simple class to wrap file streams, string streams, etc. // seek is essential, and it should be byte stream class StreamReader { // should return a string [FIXME: perhaps return array of bytes?] function read($bytes) { return false; } // should return new position function seekto($position) { return false; } // returns current position function currentpos() { return false; } // returns length of entire stream (limit for seekto()s) function length() { return false; } } class StringReader { var $_pos; var $_str; function StringReader($str='') { $this->_str = $str; $this->_pos = 0; // If string functions are overloaded, we need to use the mb versions $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); } function _substr($string, $start, $length) { if ($this->is_overloaded) { return mb_substr($string,$start,$length,'ascii'); } else { return substr($string,$start,$length); } } function _strlen($string) { if ($this->is_overloaded) { return mb_strlen($string,'ascii'); } else { return strlen($string); } } function read($bytes) { $data = $this->_substr($this->_str, $this->_pos, $bytes); $this->_pos += $bytes; if ($this->_strlen($this->_str)<$this->_pos) $this->_pos = $this->_strlen($this->_str); return $data; } function seekto($pos) { $this->_pos = $pos; if ($this->_strlen($this->_str)<$this->_pos) $this->_pos = $this->_strlen($this->_str); return $this->_pos; } function currentpos() { return $this->_pos; } function length() { return $this->_strlen($this->_str); } } class FileReader { var $_pos; var $_fd; var $_length; function FileReader($filename) { if (file_exists($filename)) { $this->_length=filesize($filename); $this->_pos = 0; $this->_fd = fopen($filename,'rb'); if (!$this->_fd) { $this->error = 3; // Cannot read file, probably permissions return false; } } else { $this->error = 2; // File doesn't exist return false; } } function read($bytes) { if ($bytes) { fseek($this->_fd, $this->_pos); // PHP 5.1.1 does not read more than 8192 bytes in one fread() // the discussions at PHP Bugs suggest it's the intended behaviour while ($bytes > 0) { $chunk = fread($this->_fd, $bytes); $data .= $chunk; $bytes -= strlen($chunk); } $this->_pos = ftell($this->_fd); return $data; } else return ''; } function seekto($pos) { fseek($this->_fd, $pos); $this->_pos = ftell($this->_fd); return $this->_pos; } function currentpos() { return $this->_pos; } function length() { return $this->_length; } function close() { fclose($this->_fd); } } // Preloads entire file in memory first, then creates a StringReader // over it (it assumes knowledge of StringReader internals) class CachedFileReader extends StringReader { function CachedFileReader($filename) { parent::StringReader(); if (file_exists($filename)) { $length=filesize($filename); $fd = fopen($filename,'rb'); if (!$fd) { $this->error = 3; // Cannot read file, probably permissions return false; } $this->_str = fread($fd, $length); fclose($fd); } else { $this->error = 2; // File doesn't exist return false; } } } ?> blogs/wp-includes/taxonomy.php0000644000000000000000000020766411077635520015530 0ustar rootroot 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false); /** * Return all of the taxonomy names that are of $object_type. * * It appears that this function can be used to find all of the names inside of * $wp_taxonomies global variable. * * Should * result in Array('category', 'post_tag') * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wp_taxonomies * * @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts) * @return array The names of all taxonomy of $object_type. */ function get_object_taxonomies($object) { global $wp_taxonomies; if ( is_object($object) ) { if ( $object->post_type == 'attachment' ) return get_attachment_taxonomies($object); $object = $object->post_type; } $object = (array) $object; $taxonomies = array(); foreach ( $wp_taxonomies as $taxonomy ) { if ( array_intersect($object, (array) $taxonomy->object_type) ) $taxonomies[] = $taxonomy->name; } return $taxonomies; } /** * Retrieves the taxonomy object of $taxonomy. * * The get_taxonomy function will first check that the parameter string given * is a taxonomy object and if it is, it will return it. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wp_taxonomies * @uses is_taxonomy() Checks whether taxonomy exists * * @param string $taxonomy Name of taxonomy object to return * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist */ function get_taxonomy( $taxonomy ) { global $wp_taxonomies; if ( ! is_taxonomy($taxonomy) ) return false; return $wp_taxonomies[$taxonomy]; } /** * Checks that the taxonomy name exists. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wp_taxonomies * * @param string $taxonomy Name of taxonomy object * @return bool Whether the taxonomy exists or not. */ function is_taxonomy( $taxonomy ) { global $wp_taxonomies; return isset($wp_taxonomies[$taxonomy]); } /** * Whether the taxonomy object is hierarchical. * * Checks to make sure that the taxonomy is an object first. Then Gets the * object, and finally returns the hierarchical value in the object. * * A false return value might also mean that the taxonomy does not exist. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses is_taxonomy() Checks whether taxonomy exists * @uses get_taxonomy() Used to get the taxonomy object * * @param string $taxonomy Name of taxonomy object * @return bool Whether the taxonomy is hierarchical */ function is_taxonomy_hierarchical($taxonomy) { if ( ! is_taxonomy($taxonomy) ) return false; $taxonomy = get_taxonomy($taxonomy); return $taxonomy->hierarchical; } /** * Create or modify a taxonomy object. Do not use before init. * * A simple function for creating or modifying a taxonomy object based on the * parameters given. The function will accept an array (third optional * parameter), along with strings for the taxonomy name and another string for * the object type. * * Nothing is returned, so expect error maybe or use is_taxonomy() to check * whether taxonomy exists. * * Optional $args contents: * * hierarachical - has some defined purpose at other parts of the API and is a * boolean value. * * update_count_callback - works much like a hook, in that it will be called * when the count is updated. * * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize * permastruct; default will use $taxonomy as slug. * * query_var - false to prevent queries, or string to customize query var * (?$query_var=$term); default will use $taxonomy as query var. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wp_taxonomies Inserts new taxonomy object into the list * @uses $wp_rewrite Adds rewrite tags and permastructs * @uses $wp Adds query vars * * @param string $taxonomy Name of taxonomy object * @param array|string $object_type Name of the object type for the taxonomy object. * @param array|string $args See above description for the two keys values. */ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { global $wp_taxonomies, $wp_rewrite, $wp; $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true); $args = wp_parse_args($args, $defaults); if ( false !== $args['query_var'] && !empty($wp) ) { if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy; $args['query_var'] = sanitize_title_with_dashes($args['query_var']); $wp->add_query_var($args['query_var']); } if ( false !== $args['rewrite'] && !empty($wp_rewrite) ) { if ( !is_array($args['rewrite']) ) $args['rewrite'] = array(); if ( !isset($args['rewrite']['slug']) ) $args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy); $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term"); $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%"); } $args['name'] = $taxonomy; $args['object_type'] = $object_type; $wp_taxonomies[$taxonomy] = (object) $args; } // // Term API // /** * Retrieve object_ids of valid taxonomy and term. * * The strings of $taxonomies must exist before this function will continue. On * failure of finding a valid taxonomy, it will return an WP_Error class, kind * of like Exceptions in PHP 5, except you can't catch them. Even so, you can * still test for the WP_Error class and get the error message. * * The $terms aren't checked the same as $taxonomies, but still need to exist * for $object_ids to be returned. * * It is possible to change the order that object_ids is returned by either * using PHP sort family functions or using the database by using $args with * either ASC or DESC array. The value should be in the key named 'order'. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses wp_parse_args() Creates an array from string $args. * * @param string|array $terms String of term or array of string values of terms that will be used * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names * @param array|string $args Change the order of the object_ids, either ASC or DESC * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success * the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found. */ function get_objects_in_term( $terms, $taxonomies, $args = array() ) { global $wpdb; if ( !is_array( $terms) ) $terms = array($terms); if ( !is_array($taxonomies) ) $taxonomies = array($taxonomies); foreach ( $taxonomies as $taxonomy ) { if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); } $defaults = array('order' => 'ASC'); $args = wp_parse_args( $args, $defaults ); extract($args, EXTR_SKIP); $order = ( 'desc' == strtolower($order) ) ? 'DESC' : 'ASC'; $terms = array_map('intval', $terms); $taxonomies = "'" . implode("', '", $taxonomies) . "'"; $terms = "'" . implode("', '", $terms) . "'"; $object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($terms) ORDER BY tr.object_id $order"); if ( ! $object_ids ) return array(); return $object_ids; } /** * Get all Term data from database by Term ID. * * The usage of the get_term function is to apply filters to a term object. It * is possible to get a term object from the database before applying the * filters. * * $term ID must be part of $taxonomy, to get from the database. Failure, might * be able to be captured by the hooks. Failure would be the same value as $wpdb * returns for the get_row method. * * There are two hooks, one is specifically for each term, named 'get_term', and * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the * term object, and the taxonomy name as parameters. Both hooks are expected to * return a Term object. * * 'get_term' hook - Takes two parameters the term Object and the taxonomy name. * Must return term object. Used in get_term() as a catch-all filter for every * $term. * * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy * name. Must return term object. $taxonomy will be the taxonomy name, so for * example, if 'category', it would be 'get_category' as the filter name. Useful * for custom taxonomies or plugging into default taxonomies. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses sanitize_term() Cleanses the term based on $filter context before returning. * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param. * * @param int|object $term If integer, will get from database. If object will apply filters and return $term. * @param string $taxonomy Taxonomy name that $term is part of. * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N * @param string $filter Optional, default is raw or no WordPress defined filter will applied. * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not * exist then WP_Error will be returned. */ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') { global $wpdb; if ( empty($term) ) return null; if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); if ( is_object($term) ) { wp_cache_add($term->term_id, $term, $taxonomy); $_term = $term; } else { $term = (int) $term; if ( ! $_term = wp_cache_get($term, $taxonomy) ) { $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) ); wp_cache_add($term, $_term, $taxonomy); } } $_term = apply_filters('get_term', $_term, $taxonomy); $_term = apply_filters("get_$taxonomy", $_term, $taxonomy); $_term = sanitize_term($_term, $taxonomy, $filter); if ( $output == OBJECT ) { return $_term; } elseif ( $output == ARRAY_A ) { return get_object_vars($_term); } elseif ( $output == ARRAY_N ) { return array_values(get_object_vars($_term)); } else { return $_term; } } /** * Get all Term data from database by Term field and data. * * Warning: $value is not escaped for 'name' $field. You must do it yourself, if * required. * * The default $field is 'id', therefore it is possible to also use null for * field, but not recommended that you do so. * * If $value does not exist, the return value will be false. If $taxonomy exists * and $field and $value combinations exist, the Term will be returned. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses sanitize_term() Cleanses the term based on $filter context before returning. * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param. * * @param string $field Either 'slug', 'name', or 'id' * @param string|int $value Search for this term value * @param string $taxonomy Taxonomy Name * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N * @param string $filter Optional, default is raw or no WordPress defined filter will applied. * @return mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found. */ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') { global $wpdb; if ( ! is_taxonomy($taxonomy) ) return false; if ( 'slug' == $field ) { $field = 't.slug'; $value = sanitize_title($value); if ( empty($value) ) return false; } else if ( 'name' == $field ) { // Assume already escaped $field = 't.name'; } else { $field = 't.term_id'; $value = (int) $value; } $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) ); if ( !$term ) return false; wp_cache_add($term->term_id, $term, $taxonomy); $term = sanitize_term($term, $taxonomy, $filter); if ( $output == OBJECT ) { return $term; } elseif ( $output == ARRAY_A ) { return get_object_vars($term); } elseif ( $output == ARRAY_N ) { return array_values(get_object_vars($term)); } else { return $term; } } /** * Merge all term children into a single array. * * This recursive function will merge all of the children of $term into the same * array. Only useful for taxonomies which are hierarchical. * * Will return an empty array if $term does not exist in $taxonomy. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses _get_term_hierarchy() * @uses get_term_children() Used to get the children of both $taxonomy and the parent $term * * @param string $term Name of Term to get children * @param string $taxonomy Taxonomy Name * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist */ function get_term_children( $term, $taxonomy ) { if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); $terms = _get_term_hierarchy($taxonomy); if ( ! isset($terms[$term]) ) return array(); $children = $terms[$term]; foreach ( $terms[$term] as $child ) { if ( isset($terms[$child]) ) $children = array_merge($children, get_term_children($child, $taxonomy)); } return $children; } /** * Get sanitized Term field. * * Does checks for $term, based on the $taxonomy. The function is for contextual * reasons and for simplicity of usage. See sanitize_term_field() for more * information. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses sanitize_term_field() Passes the return value in sanitize_term_field on success. * * @param string $field Term field to fetch * @param int $term Term ID * @param string $taxonomy Taxonomy Name * @param string $context Optional, default is display. Look at sanitize_term_field() for available options. * @return mixed Will return an empty string if $term is not an object or if $field is not set in $term. */ function get_term_field( $field, $term, $taxonomy, $context = 'display' ) { $term = (int) $term; $term = get_term( $term, $taxonomy ); if ( is_wp_error($term) ) return $term; if ( !is_object($term) ) return ''; if ( !isset($term->$field) ) return ''; return sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context); } /** * Sanitizes Term for editing. * * Return value is sanitize_term() and usage is for sanitizing the term for * editing. Function is for contextual and simplicity. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses sanitize_term() Passes the return value on success * * @param int|object $id Term ID or Object * @param string $taxonomy Taxonomy Name * @return mixed|null|WP_Error Will return empty string if $term is not an object. */ function get_term_to_edit( $id, $taxonomy ) { $term = get_term( $id, $taxonomy ); if ( is_wp_error($term) ) return $term; if ( !is_object($term) ) return ''; return sanitize_term($term, $taxonomy, 'edit'); } /** * Retrieve the terms in taxonomy or list of taxonomies. * * You can fully inject any customizations to the query before it is sent, as * well as control the output with a filter. * * The 'get_terms' filter will be called when the cache has the term and will * pass the found term along with the array of $taxonomies and array of $args. * This filter is also called before the array of terms is passed and will pass * the array of terms, along with the $taxonomies and $args. * * The 'list_terms_exclusions' filter passes the compiled exclusions along with * the $args. * * The list that $args can contain, which will overwrite the defaults. * * orderby - Default is 'name'. Can be name, count, or nothing (will use * term_id). * * order - Default is ASC. Can use DESC. * hide_empty - Default is true. Will not return empty $terms. * fields - Default is all. * slug - Any terms that has this value. Default is empty string. * hierarchical - Whether to return hierarchical taxonomy. Default is true. * name__like - Default is empty string. * * The argument 'pad_counts' will count all of the children along with the * $terms. * * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which * can be done by setting the value to 'all', instead of its default empty * string value. * * The 'child_of' argument will be used if you use multiple taxonomy or the * first $taxonomy isn't hierarchical or 'parent' isn't used. The default is 0, * which will be translated to a false value. If 'child_of' is set, then * 'child_of' value will be tested against $taxonomy to see if 'child_of' is * contained within. Will return an empty array if test fails. * * If 'parent' is set, then it will be used to test against the first taxonomy. * Much like 'child_of'. Will return an empty array if the test fails. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings. * * @param string|array Taxonomy name or list of Taxonomy names * @param string|array $args The values of what to search for when returning terms * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist. */ function &get_terms($taxonomies, $args = '') { global $wpdb; $empty_array = array(); $single_taxonomy = false; if ( !is_array($taxonomies) ) { $single_taxonomy = true; $taxonomies = array($taxonomies); } foreach ( $taxonomies as $taxonomy ) { if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); } $in_taxonomies = "'" . implode("', '", $taxonomies) . "'"; $defaults = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'exclude' => '', 'include' => '', 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'pad_counts' => false, 'offset' => '', 'search' => ''); $args = wp_parse_args( $args, $defaults ); $args['number'] = absint( $args['number'] ); $args['offset'] = absint( $args['offset'] ); if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) || '' != $args['parent'] ) { $args['child_of'] = 0; $args['hierarchical'] = false; $args['pad_counts'] = false; } if ( 'all' == $args['get'] ) { $args['child_of'] = 0; $args['hide_empty'] = 0; $args['hierarchical'] = false; $args['pad_counts'] = false; } extract($args, EXTR_SKIP); if ( $child_of ) { $hierarchy = _get_term_hierarchy($taxonomies[0]); if ( !isset($hierarchy[$child_of]) ) return $empty_array; } if ( $parent ) { $hierarchy = _get_term_hierarchy($taxonomies[0]); if ( !isset($hierarchy[$parent]) ) return $empty_array; } // $args can be whatever, only use the args defined in defaults to compute the key $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) { if ( isset( $cache[ $key ] ) ) return apply_filters('get_terms', $cache[$key], $taxonomies, $args); } if ( 'count' == $orderby ) $orderby = 'tt.count'; else if ( 'name' == $orderby ) $orderby = 't.name'; else if ( 'slug' == $orderby ) $orderby = 't.slug'; else if ( 'term_group' == $orderby ) $orderby = 't.term_group'; else $orderby = 't.term_id'; $where = ''; $inclusions = ''; if ( !empty($include) ) { $exclude = ''; $interms = preg_split('/[\s,]+/',$include); if ( count($interms) ) { foreach ( $interms as $interm ) { if (empty($inclusions)) $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' '; else $inclusions .= ' OR t.term_id = ' . intval($interm) . ' '; } } } if ( !empty($inclusions) ) $inclusions .= ')'; $where .= $inclusions; $exclusions = ''; if ( !empty($exclude) ) { $exterms = preg_split('/[\s,]+/',$exclude); if ( count($exterms) ) { foreach ( $exterms as $exterm ) { if (empty($exclusions)) $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; else $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' '; } } } if ( !empty($exclusions) ) $exclusions .= ')'; $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args ); $where .= $exclusions; if ( !empty($slug) ) { $slug = sanitize_title($slug); $where .= " AND t.slug = '$slug'"; } if ( !empty($name__like) ) $where .= " AND t.name LIKE '{$name__like}%'"; if ( '' != $parent ) { $parent = (int) $parent; $where .= " AND tt.parent = '$parent'"; } if ( $hide_empty && !$hierarchical ) $where .= ' AND tt.count > 0'; if ( !empty($number) ) { if( $offset ) $number = 'LIMIT ' . $offset . ',' . $number; else $number = 'LIMIT ' . $number; } else $number = ''; if ( !empty($search) ) { $search = like_escape($search); $where .= " AND (t.name LIKE '%$search%')"; } $select_this = ''; if ( 'all' == $fields ) $select_this = 't.*, tt.*'; else if ( 'ids' == $fields ) $select_this = 't.term_id'; else if ( 'names' == $fields ) $select_this = 't.name'; $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $number"; if ( 'all' == $fields ) { $terms = $wpdb->get_results($query); update_term_cache($terms); } else if ( ('ids' == $fields) || ('names' == $fields) ) { $terms = $wpdb->get_col($query); } if ( empty($terms) ) { $cache[ $key ] = array(); wp_cache_set( 'get_terms', $cache, 'terms' ); return apply_filters('get_terms', array(), $taxonomies, $args); } if ( $child_of || $hierarchical ) { $children = _get_term_hierarchy($taxonomies[0]); if ( ! empty($children) ) $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); } // Update term counts to include children. if ( $pad_counts ) _pad_term_counts($terms, $taxonomies[0]); // Make sure we show empty categories that have children. if ( $hierarchical && $hide_empty ) { foreach ( $terms as $k => $term ) { if ( ! $term->count ) { $children = _get_term_children($term->term_id, $terms, $taxonomies[0]); foreach ( $children as $child ) if ( $child->count ) continue 2; // It really is empty unset($terms[$k]); } } } reset ( $terms ); $cache[ $key ] = $terms; wp_cache_set( 'get_terms', $cache, 'terms' ); $terms = apply_filters('get_terms', $terms, $taxonomies, $args); return $terms; } /** * Check if Term exists. * * Returns the index of a defined term, or 0 (false) if the term doesn't exist. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * * @param int|string $term The term to check * @param string $taxonomy The taxonomy name to use * @return mixed Get the term id or Term Object, if exists. */ function is_term($term, $taxonomy = '') { global $wpdb; $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; if ( is_int($term) ) { if ( 0 == $term ) return 0; $where = 't.term_id = %d'; if ( !empty($taxonomy) ) return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A ); else return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) ); } if ( '' === $slug = sanitize_title($term) ) return 0; $where = 't.slug = %s'; $else_where = 't.name = %s'; if ( !empty($taxonomy) ) { if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) ) return $result; return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); } if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) ) return $result; return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) ); } /** * Sanitize Term all fields. * * Relys on sanitize_term_field() to sanitize the term. The difference is that * this function will sanitize all fields. The context is based * on sanitize_term_field(). * * The $term is expected to be either an array or an object. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses sanitize_term_field Used to sanitize all fields in a term * * @param array|object $term The term to check * @param string $taxonomy The taxonomy name to use * @param string $context Default is 'display'. * @return array|object Term with all fields sanitized */ function sanitize_term($term, $taxonomy, $context = 'display') { if ( 'raw' == $context ) return $term; $fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group'); $do_object = false; if ( is_object($term) ) $do_object = true; foreach ( $fields as $field ) { if ( $do_object ) $term->$field = sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context); else $term[$field] = sanitize_term_field($field, $term[$field], $term['term_id'], $taxonomy, $context); } return $term; } /** * Cleanse the field value in the term based on the context. * * Passing a term field value through the function should be assumed to have * cleansed the value for whatever context the term field is going to be used. * * If no context or an unsupported context is given, then default filters will * be applied. * * There are enough filters for each context to support a custom filtering * without creating your own filter function. Simply create a function that * hooks into the filter you need. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * * @param string $field Term field to sanitize * @param string $value Search for this term value * @param int $term_id Term ID * @param string $taxonomy Taxonomy Name * @param string $context Either edit, db, display, attribute, or js. * @return mixed sanitized field */ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) { if ( 'parent' == $field || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) { $value = (int) $value; if ( $value < 0 ) $value = 0; } if ( 'raw' == $context ) return $value; if ( 'edit' == $context ) { $value = apply_filters("edit_term_$field", $value, $term_id, $taxonomy); $value = apply_filters("edit_${taxonomy}_$field", $value, $term_id); if ( 'description' == $field ) $value = format_to_edit($value); else $value = attribute_escape($value); } else if ( 'db' == $context ) { $value = apply_filters("pre_term_$field", $value, $taxonomy); $value = apply_filters("pre_${taxonomy}_$field", $value); // Back compat filters if ( 'slug' == $field ) $value = apply_filters('pre_category_nicename', $value); } else if ( 'rss' == $context ) { $value = apply_filters("term_${field}_rss", $value, $taxonomy); $value = apply_filters("${taxonomy}_${field}_rss", $value); } else { // Use display filters by default. $value = apply_filters("term_$field", $value, $term_id, $taxonomy, $context); $value = apply_filters("${taxonomy}_$field", $value, $term_id, $context); } if ( 'attribute' == $context ) $value = attribute_escape($value); else if ( 'js' == $context ) $value = js_escape($value); return $value; } /** * Count how many terms are in Taxonomy. * * Default $args is 'ignore_empty' which can be 'ignore_empty=true' * or array('ignore_empty' => true);. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array. * * @param string $taxonomy Taxonomy name * @param array|string $args Overwrite defaults * @return int How many terms are in $taxonomy */ function wp_count_terms( $taxonomy, $args = array() ) { global $wpdb; $defaults = array('ignore_empty' => false); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); $where = ''; if ( $ignore_empty ) $where = 'AND count > 0'; return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = %s $where", $taxonomy) ); } /** * Will unlink the term from the taxonomy. * * Will remove the term's relationship to the taxonomy, not the term or taxonomy * itself. The term and taxonomy will still exist. Will require the term's * object ID to perform the operation. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param int $object_id The term Object Id that refers to the term * @param string|array $taxonomy List of Taxonomy Names or single Taxonomy name. */ function wp_delete_object_term_relationships( $object_id, $taxonomies ) { global $wpdb; $object_id = (int) $object_id; if ( !is_array($taxonomies) ) $taxonomies = array($taxonomies); foreach ( $taxonomies as $taxonomy ) { $terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); $in_terms = "'" . implode("', '", $terms) . "'"; $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_terms)", $object_id) ); wp_update_term_count($terms, $taxonomy); } } /** * Removes a term from the database. * * If the term is a parent of other terms, then the children will be updated to * that term's parent. * * The $args 'default' will only override the terms found, if there is only one * term found. Any other and the found terms are used. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action * hooks, passing term object, term id. 'delete_term' gets an additional * parameter with the $taxonomy parameter. * * @param int $term Term ID * @param string $taxonomy Taxonomy Name * @param array|string $args Optional. Change 'default' term id and override found term ids. * @return bool|WP_Error Returns false if not term; true if completes delete action. */ function wp_delete_term( $term, $taxonomy, $args = array() ) { global $wpdb; $term = (int) $term; if ( ! $ids = is_term($term, $taxonomy) ) return false; if ( is_wp_error( $ids ) ) return $ids; $tt_id = $ids['term_taxonomy_id']; $defaults = array(); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if ( isset($default) ) { $default = (int) $default; if ( ! is_term($default, $taxonomy) ) unset($default); } // Update children to point to new parent if ( is_taxonomy_hierarchical($taxonomy) ) { $term_obj = get_term($term, $taxonomy); if ( is_wp_error( $term_obj ) ) return $term_obj; $parent = $term_obj->parent; $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) ); } $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) ); foreach ( (array) $objects as $object ) { $terms = wp_get_object_terms($object, $taxonomy, 'fields=ids'); if ( 1 == count($terms) && isset($default) ) $terms = array($default); else $terms = array_diff($terms, array($term)); $terms = array_map('intval', $terms); wp_set_object_terms($object, $terms, $taxonomy); } $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) ); // Delete the term if no taxonomies use it. if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term) ) ) $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->terms WHERE term_id = %d", $term) ); clean_term_cache($term, $taxonomy); do_action('delete_term', $term, $tt_id, $taxonomy); do_action("delete_$taxonomy", $term, $tt_id); return true; } /** * Retrieves the terms associated with the given object(s), in the supplied taxonomies. * * The following information has to do the $args parameter and for what can be * contained in the string or array of that parameter, if it exists. * * The first argument is called, 'orderby' and has the default value of 'name'. * The other value that is supported is 'count'. * * The second argument is called, 'order' and has the default value of 'ASC'. * The only other value that will be acceptable is 'DESC'. * * The final argument supported is called, 'fields' and has the default value of * 'all'. There are multiple other options that can be used instead. Supported * values are as follows: 'all', 'ids', 'names', and finally * 'all_with_object_id'. * * The fields argument also decides what will be returned. If 'all' or * 'all_with_object_id' is choosen or the default kept intact, then all matching * terms objects will be returned. If either 'ids' or 'names' is used, then an * array of all matching term ids or term names will be returned respectively. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param int|array $object_id The id of the object(s) to retrieve. * @param string|array $taxonomies The taxonomies to retrieve terms from. * @param array|string $args Change what is returned * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist. */ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { global $wpdb; if ( !is_array($taxonomies) ) $taxonomies = array($taxonomies); foreach ( $taxonomies as $taxonomy ) { if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); } if ( !is_array($object_ids) ) $object_ids = array($object_ids); $object_ids = array_map('intval', $object_ids); $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); $args = wp_parse_args( $args, $defaults ); $terms = array(); if ( count($taxonomies) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy($taxonomy); if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) { unset($taxonomies[$index]); $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args))); } } } else { $t = get_taxonomy($taxonomies[0]); if ( isset($t->args) && is_array($t->args) ) $args = array_merge($args, $t->args); } extract($args, EXTR_SKIP); if ( 'count' == $orderby ) $orderby = 'tt.count'; else if ( 'name' == $orderby ) $orderby = 't.name'; else if ( 'slug' == $orderby ) $orderby = 't.slug'; else if ( 'term_group' == $orderby ) $orderby = 't.term_group'; else if ( 'term_order' == $orderby ) $orderby = 'tr.term_order'; else $orderby = 't.term_id'; $taxonomies = "'" . implode("', '", $taxonomies) . "'"; $object_ids = implode(', ', $object_ids); $select_this = ''; if ( 'all' == $fields ) $select_this = 't.*, tt.*'; else if ( 'ids' == $fields ) $select_this = 't.term_id'; else if ( 'names' == $fields ) $select_this = 't.name'; else if ( 'all_with_object_id' == $fields ) $select_this = 't.*, tt.*, tr.object_id'; $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) ORDER BY $orderby $order"; if ( 'all' == $fields || 'all_with_object_id' == $fields ) { $terms = array_merge($terms, $wpdb->get_results($query)); update_term_cache($terms); } else if ( 'ids' == $fields || 'names' == $fields ) { $terms = array_merge($terms, $wpdb->get_col($query)); } else if ( 'tt_ids' == $fields ) { $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) ORDER BY tr.term_taxonomy_id $order"); } if ( ! $terms ) return array(); return $terms; } /** * Adds a new term to the database. Optionally marks it as an alias of an existing term. * * Error handling is assigned for the nonexistance of the $taxonomy and $term * parameters before inserting. If both the term id and taxonomy exist * previously, then an array will be returned that contains the term id and the * contents of what is returned. The keys of the array are 'term_id' and * 'term_taxonomy_id' containing numeric values. * * It is assumed that the term does not yet exist or the above will apply. The * term will be first added to the term table and then related to the taxonomy * if everything is well. If everything is correct, then several actions will be * run prior to a filter and then several actions will be run after the filter * is run. * * The arguments decide how the term is handled based on the $args parameter. * The following is a list of the available overrides and the defaults. * * 'alias_of'. There is no default, but if added, expected is the slug that the * term will be an alias of. Expected to be a string. * * 'description'. There is no default. If exists, will be added to the database * along with the term. Expected to be a string. * * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value * of 'parent' to the term. * * 'slug'. Expected to be a string. There is no default. * * If 'slug' argument exists then the slug will be checked to see if it is not * a valid term. If that check succeeds (it is not a valid term), then it is * added and the term id is given. If it fails, then a check is made to whether * the taxonomy is hierarchical and the parent argument is not empty. If the * second check succeeds, the term will be inserted and the term id will be * given. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @uses do_action() Calls 'create_term' hook with the term id and taxonomy id as parameters. * @uses do_action() Calls 'create_$taxonomy' hook with term id and taxonomy id as parameters. * @uses apply_filters() Calls 'term_id_filter' hook with term id and taxonomy id as parameters. * @uses do_action() Calls 'created_term' hook with the term id and taxonomy id as parameters. * @uses do_action() Calls 'created_$taxonomy' hook with term id and taxonomy id as parameters. * * @param int|string $term The term to add or update. * @param string $taxonomy The taxonomy to which to add the term * @param array|string $args Change the values of the inserted term * @return array|WP_Error The Term ID and Term Taxonomy ID */ function wp_insert_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); if ( is_int($term) && 0 == $term ) return new WP_Error('invalid_term_id', __('Invalid term ID')); if ( '' == trim($term) ) return new WP_Error('empty_term_name', __('A name is required for this term')); $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); $args = wp_parse_args($args, $defaults); $args['name'] = $term; $args['taxonomy'] = $taxonomy; $args = sanitize_term($args, $taxonomy, 'db'); extract($args, EXTR_SKIP); // expected_slashed ($name) $name = stripslashes($name); $description = stripslashes($description); if ( empty($slug) ) $slug = sanitize_title($name); $term_group = 0; if ( $alias_of ) { $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); if ( $alias->term_group ) { // The alias we want is already in a group, so let's use that one. $term_group = $alias->term_group; } else { // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $alias->term_id ) ); } } if ( ! $term_id = is_term($slug) ) { $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) ) return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) { // If the taxonomy supports hierarchy and the term has a parent, make the slug unique // by incorporating parent slugs. $slug = wp_unique_term_slug($slug, (object) $args); $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) ) return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } if ( empty($slug) ) { $slug = sanitize_title($slug, $term_id); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); } $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); if ( !empty($tt_id) ) return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id); $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent') + array( 'count' => 0 ) ); $tt_id = (int) $wpdb->insert_id; do_action("create_term", $term_id, $tt_id); do_action("create_$taxonomy", $term_id, $tt_id); $term_id = apply_filters('term_id_filter', $term_id, $tt_id); clean_term_cache($term_id, $taxonomy); do_action("created_term", $term_id, $tt_id); do_action("created_$taxonomy", $term_id, $tt_id); return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id); } /** * Create Term and Taxonomy Relationships. * * Relates an object (post, link etc) to a term and taxonomy type. Creates the * term and taxonomy relationship if it doesn't already exist. Creates a term if * it doesn't exist (using the slug). * * A relationship means that the term is grouped in or belongs to the taxonomy. * A term has no meaning until it is given context by defining which taxonomy it * exists under. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param int $object_id The object to relate to. * @param array|int|string $term The slug or id of the term. * @param array|string $taxonomy The context in which to relate the term to the object. * @param bool $append If false will delete difference of terms. * @return array|WP_Error Affected Term IDs */ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) { global $wpdb; $object_id = (int) $object_id; if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); if ( !is_array($terms) ) $terms = array($terms); if ( ! $append ) $old_terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); $tt_ids = array(); $term_ids = array(); foreach ($terms as $term) { if ( !strlen(trim($term)) ) continue; if ( !$id = is_term($term, $taxonomy) ) $id = wp_insert_term($term, $taxonomy); if ( is_wp_error($id) ) return $id; $term_ids[] = $id['term_id']; $id = $id['term_taxonomy_id']; $tt_ids[] = $id; if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $id ) ) ) continue; $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $id ) ); } wp_update_term_count($tt_ids, $taxonomy); if ( ! $append ) { $delete_terms = array_diff($old_terms, $tt_ids); if ( $delete_terms ) { $in_delete_terms = "'" . implode("', '", $delete_terms) . "'"; $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) ); wp_update_term_count($delete_terms, $taxonomy); } } $t = get_taxonomy($taxonomy); if ( ! $append && isset($t->sort) && $t->sort ) { $values = array(); $term_order = 0; $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); foreach ( $tt_ids as $tt_id ) if ( in_array($tt_id, $final_tt_ids) ) $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order); if ( $values ) $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)"); } return $tt_ids; } /** * Will make slug unique, if it isn't already. * * The $slug has to be unique global to every taxonomy, meaning that one * taxonomy term can't have a matching slug with another taxonomy term. Each * slug has to be globally unique for every taxonomy. * * The way this works is that if the taxonomy that the term belongs to is * heirarchical and has a parent, it will append that parent to the $slug. * * If that still doesn't return an unique slug, then it try to append a number * until it finds a number that is truely unique. * * The only purpose for $term is for appending a parent, if one exists. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param string $slug The string that will be tried for a unique slug * @param object $term The term object that the $slug will belong too * @return string Will return a true unique slug. */ function wp_unique_term_slug($slug, $term) { global $wpdb; // If the taxonomy supports hierarchy and the term has a parent, make the slug unique // by incorporating parent slugs. if ( is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) { $the_parent = $term->parent; while ( ! empty($the_parent) ) { $parent_term = get_term($the_parent, $term->taxonomy); if ( is_wp_error($parent_term) || empty($parent_term) ) break; $slug .= '-' . $parent_term->slug; if ( empty($parent_term->parent) ) break; $the_parent = $parent_term->parent; } } // If we didn't get a unique slug, try appending a number to make it unique. if ( !empty($args['term_id']) ) $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $args['term_id'] ); else $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); if ( $wpdb->get_var( $query ) ) { $num = 2; do { $alt_slug = $slug . "-$num"; $num++; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); $slug = $alt_slug; } return $slug; } /** * Update term based on arguments provided. * * The $args will indiscriminately override all values with the same field name. * Care must be taken to not override important information need to update or * update will fail (or perhaps create a new term, neither would be acceptable). * * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not * defined in $args already. * * 'alias_of' will create a term group, if it doesn't already exist, and update * it for the $term. * * If the 'slug' argument in $args is missing, then the 'name' in $args will be * used. It should also be noted that if you set 'slug' and it isn't unique then * a WP_Error will be passed back. If you don't pass any slug, then a unique one * will be created for you. * * For what can be overrode in $args, check the term scheme can contain and stay * away from the term keys. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses $wpdb * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice. * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term * id and taxonomy id. * * @param int $term The ID of the term * @param string $taxonomy The context in which to relate the term to the object. * @param array|string $args Overwrite term field values * @return array|WP_Error Returns Term ID and Taxonomy Term ID */ function wp_update_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! is_taxonomy($taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); $term_id = (int) $term; $args = apply_filters( 'pre_update_term', $term, $taxonomy, $args ); // First, get all of the original args $term = get_term ($term_id, $taxonomy, ARRAY_A); // Escape data pulled from DB. $term = add_magic_quotes($term); // Merge old and new args with new args overwriting old ones. $args = array_merge($term, $args); $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); $args = wp_parse_args($args, $defaults); $args = sanitize_term($args, $taxonomy, 'db'); extract($args, EXTR_SKIP); // expected_slashed ($name) $name = stripslashes($name); $description = stripslashes($description); if ( '' == trim($name) ) return new WP_Error('empty_term_name', __('A name is required for this term')); $empty_slug = false; if ( empty($slug) ) { $empty_slug = true; $slug = sanitize_title($name); } if ( $alias_of ) { $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); if ( $alias->term_group ) { // The alias we want is already in a group, so let's use that one. $term_group = $alias->term_group; } else { // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); } } // Check for duplicate slug $id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE slug = %s", $slug ) ); if ( $id && ($id != $term_id) ) { // If an empty slug was passed or the parent changed, reset the slug to something unique. // Otherwise, bail. if ( $empty_slug || ( $parent != $term->parent) ) $slug = wp_unique_term_slug($slug, (object) $args); else return new WP_Error('duplicate_term_slug', sprintf(__('The slug "%s" is already in use by another term'), $slug)); } $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); if ( empty($slug) ) { $slug = sanitize_title($name, $term_id); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); } $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) ); $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); do_action("edit_term", $term_id, $tt_id); do_action("edit_$taxonomy", $term_id, $tt_id); $term_id = apply_filters('term_id_filter', $term_id, $tt_id); clean_term_cache($term_id, $taxonomy); do_action("edited_term", $term_id, $tt_id); do_action("edited_$taxonomy", $term_id, $tt_id); return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id); } /** * Enable or disable term counting. * * @since 2.6 * * @param bool $defer Optional. * @return bool */ function wp_defer_term_counting($defer=NULL) { static $_defer = false; if ( is_bool($defer) ) { $_defer = $defer; // flush any deferred counts if ( !$defer ) wp_update_term_count( NULL, NULL, true ); } return $_defer; } /** * Updates the amount of terms in taxonomy. * * If there is a taxonomy callback applyed, then it will be called for updating * the count. * * The default action is to count what the amount of terms have the relationship * of term ID. Once that is done, then update the database. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param int|array $terms The ID of the terms * @param string $taxonomy The context of the term. * @return bool If no terms will return false, and if successful will return true. */ function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) { static $_deferred = array(); if ( $do_deferred ) { foreach ( array_keys($_deferred) as $tax ) { wp_update_term_count_now( $_deferred[$tax], $tax ); unset( $_deferred[$tax] ); } } if ( empty($terms) ) return false; if ( !is_array($terms) ) $terms = array($terms); if ( wp_defer_term_counting() ) { if ( !isset($_deferred[$taxonomy]) ) $_deferred[$taxonomy] = array(); $_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) ); return true; } return wp_update_term_count_now( $terms, $taxonomy ); } /** * Perform term count update immediately. * * @since 2.6 * * @param array $terms IDs of Terms to update. * @param string $taxonomy The context of the term. * @return bool Always true when complete. */ function wp_update_term_count_now( $terms, $taxonomy ) { global $wpdb; $terms = array_map('intval', $terms); $taxonomy = get_taxonomy($taxonomy); if ( !empty($taxonomy->update_count_callback) ) { call_user_func($taxonomy->update_count_callback, $terms); } else { // Default count updater foreach ($terms as $term) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); } } clean_term_cache($terms); return true; } // // Cache // /** * Removes the taxonomy relationship to terms from the cache. * * Will remove the entire taxonomy relationship containing term $object_id. The * term IDs have to exist within the taxonomy $object_type for the deletion to * take place. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @see get_object_taxonomies() for more on $object_type * @uses do_action() Will call action hook named, 'clean_object_term_cache' after completion. * Passes, function params in same order. * * @param int|array $object_ids Single or list of term object ID(s) * @param array|string $object_type The taxonomy object type */ function clean_object_term_cache($object_ids, $object_type) { if ( !is_array($object_ids) ) $object_ids = array($object_ids); foreach ( $object_ids as $id ) foreach ( get_object_taxonomies($object_type) as $taxonomy ) wp_cache_delete($id, "{$taxonomy}_relationships"); do_action('clean_object_term_cache', $object_ids, $object_type); } /** * Will remove all of the term ids from the cache. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses $wpdb * * @param int|array $ids Single or list of Term IDs * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context. */ function clean_term_cache($ids, $taxonomy = '') { global $wpdb; if ( !is_array($ids) ) $ids = array($ids); $taxonomies = array(); // If no taxonomy, assume tt_ids. if ( empty($taxonomy) ) { $tt_ids = implode(', ', $ids); $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)"); foreach ( (array) $terms as $term ) { $taxonomies[] = $term->taxonomy; wp_cache_delete($term->term_id, $term->taxonomy); } $taxonomies = array_unique($taxonomies); } else { foreach ( $ids as $id ) { wp_cache_delete($id, $taxonomy); } $taxonomies = array($taxonomy); } foreach ( $taxonomies as $taxonomy ) { wp_cache_delete('all_ids', $taxonomy); wp_cache_delete('get', $taxonomy); delete_option("{$taxonomy}_children"); } wp_cache_delete('get_terms', 'terms'); do_action('clean_term_cache', $ids, $taxonomy); } /** * Retrieves the taxonomy relationship to the term object id. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @uses wp_cache_get() Retrieves taxonomy relationship from cache * * @param int|array $id Term object ID * @param string $taxonomy Taxonomy Name * @return bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id. */ function &get_object_term_cache($id, $taxonomy) { $cache = wp_cache_get($id, "{$taxonomy}_relationships"); return $cache; } /** * Updates the cache for Term ID(s). * * Will only update the cache for terms not already cached. * * The $object_ids expects that the ids be separated by commas, if it is a * string. * * It should be noted that update_object_term_cache() is very time extensive. It * is advised that the function is not called very often or at least not for a * lot of terms that exist in a lot of taxonomies. The amount of time increases * for each term and it also increases for each taxonomy the term belongs to. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * @uses wp_get_object_terms() Used to get terms from the database to update * * @param string|array $object_ids Single or list of term object ID(s) * @param array|string $object_type The taxonomy object type * @return null|bool Null value is given with empty $object_ids. False if */ function update_object_term_cache($object_ids, $object_type) { if ( empty($object_ids) ) return; if ( !is_array($object_ids) ) $object_ids = explode(',', $object_ids); $object_ids = array_map('intval', $object_ids); $taxonomies = get_object_taxonomies($object_type); $ids = array(); foreach ( (array) $object_ids as $id ) { foreach ( $taxonomies as $taxonomy ) { if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) { $ids[] = $id; break; } } } if ( empty( $ids ) ) return false; $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id'); $object_terms = array(); foreach ( (array) $terms as $term ) $object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term; foreach ( $ids as $id ) { foreach ( $taxonomies as $taxonomy ) { if ( ! isset($object_terms[$id][$taxonomy]) ) { if ( !isset($object_terms[$id]) ) $object_terms[$id] = array(); $object_terms[$id][$taxonomy] = array(); } } } foreach ( $object_terms as $id => $value ) { foreach ( $value as $taxonomy => $terms ) { wp_cache_set($id, $terms, "{$taxonomy}_relationships"); } } } /** * Updates Terms to Taxonomy in cache. * * @package WordPress * @subpackage Taxonomy * @since 2.3 * * @param array $terms List of Term objects to change * @param string $taxonomy Optional. Update Term to this taxonomy in cache */ function update_term_cache($terms, $taxonomy = '') { foreach ( $terms as $term ) { $term_taxonomy = $taxonomy; if ( empty($term_taxonomy) ) $term_taxonomy = $term->taxonomy; wp_cache_add($term->term_id, $term, $term_taxonomy); } } // // Private // /** * Retrieves children of taxonomy. * * @package WordPress * @subpackage Taxonomy * @access private * @since 2.3 * * @uses update_option() Stores all of the children in "$taxonomy_children" * option. That is the name of the taxonomy, immediately followed by '_children'. * * @param string $taxonomy Taxonomy Name * @return array Empty if $taxonomy isn't hierarachical or returns children. */ function _get_term_hierarchy($taxonomy) { if ( !is_taxonomy_hierarchical($taxonomy) ) return array(); $children = get_option("{$taxonomy}_children"); if ( is_array($children) ) return $children; $children = array(); $terms = get_terms($taxonomy, 'get=all'); foreach ( $terms as $term ) { if ( $term->parent > 0 ) $children[$term->parent][] = $term->term_id; } update_option("{$taxonomy}_children", $children); return $children; } /** * Get array of child terms. * * If $terms is an array of objects, then objects will returned from the * function. If $terms is an array of IDs, then an array of ids of children will * be returned. * * @package WordPress * @subpackage Taxonomy * @access private * @since 2.3 * * @param int $term_id Look for this Term ID in $terms * @param array $terms List of Term IDs * @param string $taxonomy Term Context * @return array Empty if $terms is empty else returns full list of child terms. */ function &_get_term_children($term_id, $terms, $taxonomy) { $empty_array = array(); if ( empty($terms) ) return $empty_array; $term_list = array(); $has_children = _get_term_hierarchy($taxonomy); if ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) ) return $empty_array; foreach ( $terms as $term ) { $use_id = false; if ( !is_object($term) ) { $term = get_term($term, $taxonomy); if ( is_wp_error( $term ) ) return $term; $use_id = true; } if ( $term->term_id == $term_id ) continue; if ( $term->parent == $term_id ) { if ( $use_id ) $term_list[] = $term->term_id; else $term_list[] = $term; if ( !isset($has_children[$term->term_id]) ) continue; if ( $children = _get_term_children($term->term_id, $terms, $taxonomy) ) $term_list = array_merge($term_list, $children); } } return $term_list; } /** * Add count of children to parent count. * * Recalculates term counts by including items from child terms. Assumes all * relevant children are already in the $terms argument. * * @package WordPress * @subpackage Taxonomy * @access private * @since 2.3 * @uses $wpdb * * @param array $terms List of Term IDs * @param string $taxonomy Term Context * @return null Will break from function if conditions are not met. */ function _pad_term_counts(&$terms, $taxonomy) { global $wpdb; // This function only works for post categories. if ( 'category' != $taxonomy ) return; $term_hier = _get_term_hierarchy($taxonomy); if ( empty($term_hier) ) return; $term_items = array(); foreach ( $terms as $key => $term ) { $terms_by_id[$term->term_id] = & $terms[$key]; $term_ids[$term->term_taxonomy_id] = $term->term_id; } // Get the object and term ids and stick them in a lookup table $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'"); foreach ( $results as $row ) { $id = $term_ids[$row->term_taxonomy_id]; ++$term_items[$id][$row->object_id]; } // Touch every ancestor's lookup row for each post in each term foreach ( $term_ids as $term_id ) { $child = $term_id; while ( $parent = $terms_by_id[$child]->parent ) { if ( !empty($term_items[$term_id]) ) foreach ( $term_items[$term_id] as $item_id => $touches ) ++$term_items[$parent][$item_id]; $child = $parent; } } // Transfer the touched cells foreach ( (array) $term_items as $id => $items ) if ( isset($terms_by_id[$id]) ) $terms_by_id[$id]->count = count($items); } // // Default callbacks // /** * Will update term count based on posts. * * Private function for the default callback for post_tag and category * taxonomies. * * @package WordPress * @subpackage Taxonomy * @access private * @since 2.3 * @uses $wpdb * * @param array $terms List of Term IDs */ function _update_post_term_count( $terms ) { global $wpdb; foreach ( $terms as $term ) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term ) ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); } } /** * Generates a permalink for a taxonomy term archive. * * @since 2.6 * * @param object|int|string $term * @param string $taxonomy * @return string HTML link to taxonomy term archive */ function get_term_link( $term, $taxonomy ) { global $wp_rewrite; // use legacy functions for core taxonomies until they are fully plugged in if ( $taxonomy == 'category' ) return get_category_link($term); if ( $taxonomy == 'post_tag' ) return get_tag_link($term); $termlink = $wp_rewrite->get_extra_permastruct($taxonomy); if ( !is_object($term) ) { if ( is_int($term) ) { $term = &get_term($term, $taxonomy); } else { $term = &get_term_by('slug', $term, $taxonomy); } } if ( is_wp_error( $term ) ) return $term; $slug = $term->slug; if ( empty($termlink) ) { $file = get_option('home') . '/'; $t = get_taxonomy($taxonomy); if ( $t->query_var ) $termlink = "$file?$t->query_var=$slug"; else $termlink = "$file?taxonomy=$taxonomy&term=$slug"; } else { $termlink = str_replace("%$taxonomy%", $slug, $termlink); $termlink = get_option('home') . user_trailingslashit($termlink, 'category'); } return apply_filters('term_link', $termlink, $term, $taxonomy); } /** * Display the taxonomies of a post with available options. * * This function can be used within the loop to display the taxonomies for a * post without specifying the Post ID. You can also use it outside the Loop to * display the taxonomies for a specific post. * * The available defaults are: * 'post' : default is 0. The post ID to get taxonomies of. * 'before' : default is empty string. Display before taxonomies list. * 'sep' : default is empty string. Separate every taxonomy with value in this. * 'after' : default is empty string. Display this after the taxonomies list. * * @since 2.6 * @uses get_the_taxonomies() * * @param array $args Override the defaults. */ function the_taxonomies($args = array()) { $defaults = array( 'post' => 0, 'before' => '', 'sep' => ' ', 'after' => '', ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); echo $before . join($sep, get_the_taxonomies($post)) . $after; } /** * Retrieve all taxonomies associated with a post. * * This function can be used within the loop. It will also return an array of * the taxonomies with links to the taxonomy and name. * * @since 2.6 * * @param int $post Optional. Post ID or will use Global Post ID (in loop). * @return array */ function get_the_taxonomies($post = 0) { if ( is_int($post) ) $post =& get_post($post); elseif ( !is_object($post) ) $post =& $GLOBALS['post']; $taxonomies = array(); if ( !$post ) return $taxonomies; $template = apply_filters('taxonomy_template', '%s: %l.'); foreach ( get_object_taxonomies($post) as $taxonomy ) { $t = (array) get_taxonomy($taxonomy); if ( empty($t['label']) ) $t['label'] = $taxonomy; if ( empty($t['args']) ) $t['args'] = array(); if ( empty($t['template']) ) $t['template'] = $template; $terms = get_object_term_cache($post->ID, $taxonomy); if ( empty($terms) ) $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); $links = array(); foreach ( $terms as $term ) $links[] = "$term->name"; if ( $links ) $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms); } return $taxonomies; } /** * Retrieve all taxonomies of a post with just the names. * * @since 2.6 * @uses get_object_taxonomies() * * @param int $post Optional. Post ID * @return array */ function get_post_taxonomies($post = 0) { $post =& get_post($post); return get_object_taxonomies($post); } ?> blogs/wp-includes/class-snoopy.php0000644000000000000000000011200111077635520016260 0ustar rootroot * @copyright 1999-2000 ispi, all rights reserved * @version 1.01 * @license GNU Lesser GPL * @link http://snoopy.sourceforge.net/ * @package Snoopy */ if ( !in_array('Snoopy', get_declared_classes() ) ) : /** * Snoopy - the PHP net client * * @author Monte Ohrt * @copyright (c): 1999-2000 ispi, all rights reserved * @version 1.01 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * You may contact the author of Snoopy by e-mail at: * monte@ispi.net * * Or, write to: * Monte Ohrt * CTO, ispi * 237 S. 70th suite 220 * Lincoln, NE 68510 * * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be * obtained */ class Snoopy { /**** Public variables ****/ /* user definable vars */ var $host = "www.php.net"; // host name we are connecting to var $port = 80; // port we are connecting to var $proxy_host = ""; // proxy host to use var $proxy_port = ""; // proxy port to use var $proxy_user = ""; // proxy user to use var $proxy_pass = ""; // proxy password to use var $agent = "Snoopy v1.2.3"; // agent we masquerade as var $referer = ""; // referer info to pass var $cookies = array(); // array of cookies to pass // $cookies["username"]="joe"; var $rawheaders = array(); // array of raw headers to send // $rawheaders["Content-type"]="text/html"; var $maxredirs = 5; // http redirection depth maximum. 0 = disallow var $lastredirectaddr = ""; // contains address of last redirected address var $offsiteok = true; // allows redirection off-site var $maxframes = 0; // frame content depth maximum. 0 = disallow var $expandlinks = true; // expand links to fully qualified URLs. // this only applies to fetchlinks() // submitlinks(), and submittext() var $passcookies = true; // pass set cookies back through redirects // NOTE: this currently does not respect // dates, domains or paths. var $user = ""; // user for http authentication var $pass = ""; // password for http authentication // http accept types var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; var $results = ""; // where the content is put var $error = ""; // error messages sent here var $response_code = ""; // response code returned from server var $headers = array(); // headers returned from server sent here var $maxlength = 8192; // max return data length (body) var $read_timeout = 0; // timeout on read operations, in seconds // supported only since PHP 4 Beta 4 // set to 0 to disallow timeouts var $timed_out = false; // if a read operation timed out var $status = 0; // http request status var $temp_dir = "/tmp"; // temporary directory that the webserver // has permission to write to. // under Windows, this should be C:\temp var $curl_path = "/usr/local/bin/curl"; // Snoopy will use cURL for fetching // SSL content if a full system path to // the cURL binary is supplied here. // set to false if you do not have // cURL installed. See http://curl.haxx.se // for details on installing cURL. // Snoopy does *not* use the cURL // library functions built into php, // as these functions are not stable // as of this Snoopy release. /**** Private variables ****/ var $_maxlinelen = 4096; // max line length (headers) var $_httpmethod = "GET"; // default http request method var $_httpversion = "HTTP/1.0"; // default http request version var $_submit_method = "POST"; // default submit method var $_submit_type = "application/x-www-form-urlencoded"; // default submit type var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type var $_redirectaddr = false; // will be set if page fetched is a redirect var $_redirectdepth = 0; // increments on an http redirect var $_frameurls = array(); // frame src urls var $_framedepth = 0; // increments on frame depth var $_isproxy = false; // set if using a proxy server var $_fp_timeout = 30; // timeout for socket connection /*======================================================================*\ Function: fetch Purpose: fetch the contents of a web page (and possibly other protocols in the future like ftp, nntp, gopher, etc.) Input: $URI the location of the page to fetch Output: $this->results the output text from the fetch \*======================================================================*/ function fetch($URI) { //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); $URI_PARTS = parse_url($URI); if (!empty($URI_PARTS["user"])) $this->user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { // using proxy, send entire URI $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); // no proxy, send only the path $this->_httprequest($path, $fp, $URI, $this->_httpmethod); } $this->_disconnect($fp); if($this->_redirectaddr) { /* url was redirected, check if we've hit the max depth */ if($this->maxredirs > $this->_redirectdepth) { // only follow redirect if it's on this site, or offsiteok is true if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { /* follow the redirect */ $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); while(list(,$frameurl) = each($frameurls)) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { // using proxy, send entire URI $this->_httpsrequest($URI,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); // no proxy, send only the path $this->_httpsrequest($path, $URI, $this->_httpmethod); } if($this->_redirectaddr) { /* url was redirected, check if we've hit the max depth */ if($this->maxredirs > $this->_redirectdepth) { // only follow redirect if it's on this site, or offsiteok is true if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { /* follow the redirect */ $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); while(list(,$frameurl) = each($frameurls)) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: // not a valid protocol $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } /*======================================================================*\ Function: submit Purpose: submit an http form Input: $URI the location to post the data $formvars the formvars to use. format: $formvars["var"] = "val"; $formfiles an array of files to submit format: $formfiles["var"] = "/dir/filename.ext"; Output: $this->results the text output from the post \*======================================================================*/ function submit($URI, $formvars="", $formfiles="") { unset($postdata); $postdata = $this->_prepare_post_body($formvars, $formfiles); $URI_PARTS = parse_url($URI); if (!empty($URI_PARTS["user"])) $this->user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { // using proxy, send entire URI $this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); // no proxy, send only the path $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); } $this->_disconnect($fp); if($this->_redirectaddr) { /* url was redirected, check if we've hit the max depth */ if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); // only follow redirect if it's on this site, or offsiteok is true if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { /* follow the redirect */ $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); while(list(,$frameurl) = each($frameurls)) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { // using proxy, send entire URI $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); // no proxy, send only the path $this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata); } if($this->_redirectaddr) { /* url was redirected, check if we've hit the max depth */ if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); // only follow redirect if it's on this site, or offsiteok is true if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { /* follow the redirect */ $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); while(list(,$frameurl) = each($frameurls)) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: // not a valid protocol $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } /*======================================================================*\ Function: fetchlinks Purpose: fetch the links from a web page Input: $URI where you are fetching from Output: $this->results an array of the URLs \*======================================================================*/ function fetchlinks($URI) { if ($this->fetch($URI)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striplinks($this->results[$x]); } else $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results, $URI); return true; } else return false; } /*======================================================================*\ Function: fetchform Purpose: fetch the form elements from a web page Input: $URI where you are fetching from Output: $this->results the resulting html form \*======================================================================*/ function fetchform($URI) { if ($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_stripform($this->results[$x]); } else $this->results = $this->_stripform($this->results); return true; } else return false; } /*======================================================================*\ Function: fetchtext Purpose: fetch the text from a web page, stripping the links Input: $URI where you are fetching from Output: $this->results the text from the web page \*======================================================================*/ function fetchtext($URI) { if($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striptext($this->results[$x]); } else $this->results = $this->_striptext($this->results); return true; } else return false; } /*======================================================================*\ Function: submitlinks Purpose: grab links from a form submission Input: $URI where you are submitting from Output: $this->results an array of the links from the post \*======================================================================*/ function submitlinks($URI, $formvars="", $formfiles="") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striplinks($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } /*======================================================================*\ Function: submittext Purpose: grab text from a form submission Input: $URI where you are submitting from Output: $this->results the text from the web page \*======================================================================*/ function submittext($URI, $formvars = "", $formfiles = "") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striptext($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striptext($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } /*======================================================================*\ Function: set_submit_multipart Purpose: Set the form submission content type to multipart/form-data \*======================================================================*/ function set_submit_multipart() { $this->_submit_type = "multipart/form-data"; } /*======================================================================*\ Function: set_submit_normal Purpose: Set the form submission content type to application/x-www-form-urlencoded \*======================================================================*/ function set_submit_normal() { $this->_submit_type = "application/x-www-form-urlencoded"; } /*======================================================================*\ Private functions \*======================================================================*/ /*======================================================================*\ Function: _striplinks Purpose: strip the hyperlinks from an html document Input: $document document to strip. Output: $match an array of the links \*======================================================================*/ function _striplinks($document) { preg_match_all("'<\s*a\s.*?href\s*=\s* # find ]+)) # if quote found, match up to next matching # quote, otherwise match up to next space 'isx",$document,$links); // catenate the non-empty matches from the conditional subpattern while(list($key,$val) = each($links[2])) { if(!empty($val)) $match[] = $val; } while(list($key,$val) = each($links[3])) { if(!empty($val)) $match[] = $val; } // return the links return $match; } /*======================================================================*\ Function: _stripform Purpose: strip the form elements from an html document Input: $document document to strip. Output: $match an array of the links \*======================================================================*/ function _stripform($document) { preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); // catenate the matches $match = implode("\r\n",$elements[0]); // return the links return $match; } /*======================================================================*\ Function: _striptext Purpose: strip the text from an html document Input: $document document to strip. Output: $text the resulting text \*======================================================================*/ function _striptext($document) { // I didn't use preg eval (//e) since that is only available in PHP 4.0. // so, list your entities one by one here. I included some of the // more common ones. $search = array("']*?>.*?'si", // strip out javascript "'<[\/\!]*?[^<>]*?>'si", // strip out html tags "'([\r\n])[\s]+'", // strip out white space "'&(quot|#34|#034|#x22);'i", // replace html entities "'&(amp|#38|#038|#x26);'i", // added hexadecimal values "'&(lt|#60|#060|#x3c);'i", "'&(gt|#62|#062|#x3e);'i", "'&(nbsp|#160|#xa0);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&(reg|#174);'i", "'&(deg|#176);'i", "'&(#39|#039|#x27);'", "'&(euro|#8364);'i", // europe "'&a(uml|UML);'", // german "'&o(uml|UML);'", "'&u(uml|UML);'", "'&A(uml|UML);'", "'&O(uml|UML);'", "'&U(uml|UML);'", "'ß'i", ); $replace = array( "", "", "\\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), chr(174), chr(176), chr(39), chr(128), "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß", ); $text = preg_replace($search,$replace,$document); return $text; } /*======================================================================*\ Function: _expandlinks Purpose: expand each link into a fully qualified URL Input: $links the links to qualify $URI the full URI to get the base from Output: $expandedLinks the expanded links \*======================================================================*/ function _expandlinks($links,$URI) { preg_match("/^[^\?]+/",$URI,$match); $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); $match = preg_replace("|/$|","",$match); $match_part = parse_url($match); $match_root = $match_part["scheme"]."://".$match_part["host"]; $search = array( "|^http://".preg_quote($this->host)."|i", "|^(\/)|i", "|^(?!http://)(?!mailto:)|i", "|/\./|", "|/[^\/]+/\.\./|" ); $replace = array( "", $match_root."/", $match."/", "/", "/" ); $expandedLinks = preg_replace($search,$replace,$links); return $expandedLinks; } /*======================================================================*\ Function: _httprequest Purpose: go get the http data from the server Input: $url the url to fetch $fp the current open file pointer $URI the full URI $body body contents to send if any (POST) Output: \*======================================================================*/ function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") { $cookie_headers = ''; if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; if(!empty($this->agent)) $headers .= "User-Agent: ".$this->agent."\r\n"; if(!empty($this->host) && !isset($this->rawheaders['Host'])) { $headers .= "Host: ".$this->host; if(!empty($this->port) && $this->port != 80) $headers .= ":".$this->port; $headers .= "\r\n"; } if(!empty($this->accept)) $headers .= "Accept: ".$this->accept."\r\n"; if(!empty($this->referer)) $headers .= "Referer: ".$this->referer."\r\n"; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_headers .= 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers .= substr($cookie_headers,0,-2) . "\r\n"; } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; while(list($headerKey,$headerVal) = each($this->rawheaders)) $headers .= $headerKey.": ".$headerVal."\r\n"; } if(!empty($content_type)) { $headers .= "Content-type: $content_type"; if ($content_type == "multipart/form-data") $headers .= "; boundary=".$this->_mime_boundary; $headers .= "\r\n"; } if(!empty($body)) $headers .= "Content-length: ".strlen($body)."\r\n"; if(!empty($this->user) || !empty($this->pass)) $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; //add proxy auth headers if(!empty($this->proxy_user)) $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; $headers .= "\r\n"; // set the read timeout if needed if ($this->read_timeout > 0) socket_set_timeout($fp, $this->read_timeout); $this->timed_out = false; fwrite($fp,$headers.$body,strlen($headers.$body)); $this->_redirectaddr = false; unset($this->headers); while($currentHeader = fgets($fp,$this->_maxlinelen)) { if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } if($currentHeader == "\r\n") break; // if a header begins with Location: or URI:, set the redirect if(preg_match("/^(Location:|URI:)/i",$currentHeader)) { // get URL portion of the redirect preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches); // look for :// in the Location header to see if hostname is included if(!preg_match("|\:\/\/|",$matches[2])) { // no host in the path, so prepend $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; // eliminate double slash if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$currentHeader)) { if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) { $this->status= $status[1]; } $this->response_code = $currentHeader; } $this->headers[] = $currentHeader; } $results = ''; do { $_data = fread($fp, $this->maxlength); if (strlen($_data) == 0) { break; } $results .= $_data; } while(true); if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } // check if there is a a redirect meta tag if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } // have we hit our frame depth and is there frame src to fetch? if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } // have we already fetched framed content? elseif(is_array($this->results)) $this->results[] = $results; // no framed content else $this->results = $results; return true; } /*======================================================================*\ Function: _httpsrequest Purpose: go get the https data from the server using curl Input: $url the url to fetch $URI the full URI $body body contents to send if any (POST) Output: \*======================================================================*/ function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") { if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $headers = array(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; // GET ... header not needed for curl //$headers[] = $http_method." ".$url." ".$this->_httpversion; if(!empty($this->agent)) $headers[] = "User-Agent: ".$this->agent; if(!empty($this->host)) if(!empty($this->port)) $headers[] = "Host: ".$this->host.":".$this->port; else $headers[] = "Host: ".$this->host; if(!empty($this->accept)) $headers[] = "Accept: ".$this->accept; if(!empty($this->referer)) $headers[] = "Referer: ".$this->referer; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_str = 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_str .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers[] = substr($cookie_str,0,-2); } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; while(list($headerKey,$headerVal) = each($this->rawheaders)) $headers[] = $headerKey.": ".$headerVal; } if(!empty($content_type)) { if ($content_type == "multipart/form-data") $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; else $headers[] = "Content-type: $content_type"; } if(!empty($body)) $headers[] = "Content-length: ".strlen($body); if(!empty($this->user) || !empty($this->pass)) $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); for($curr_header = 0; $curr_header < count($headers); $curr_header++) { $safer_header = strtr( $headers[$curr_header], "\"", " " ); $cmdline_params .= " -H \"".$safer_header."\""; } if(!empty($body)) $cmdline_params .= " -d \"$body\""; if($this->read_timeout > 0) $cmdline_params .= " -m ".$this->read_timeout; $headerfile = tempnam($temp_dir, "sno"); $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return); if($return) { $this->error = "Error: cURL could not retrieve the document, error $return."; return false; } $results = implode("\r\n",$results); $result_headers = file("$headerfile"); $this->_redirectaddr = false; unset($this->headers); for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) { // if a header begins with Location: or URI:, set the redirect if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) { // get URL portion of the redirect preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches); // look for :// in the Location header to see if hostname is included if(!preg_match("|\:\/\/|",$matches[2])) { // no host in the path, so prepend $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; // eliminate double slash if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) $this->response_code = $result_headers[$currentHeader]; $this->headers[] = $result_headers[$currentHeader]; } // check if there is a a redirect meta tag if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } // have we hit our frame depth and is there frame src to fetch? if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } // have we already fetched framed content? elseif(is_array($this->results)) $this->results[] = $results; // no framed content else $this->results = $results; unlink("$headerfile"); return true; } /*======================================================================*\ Function: setcookies() Purpose: set cookies for a redirection \*======================================================================*/ function setcookies() { for($x=0; $xheaders); $x++) { if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) $this->cookies[$match[1]] = urldecode($match[2]); } } /*======================================================================*\ Function: _check_timeout Purpose: checks whether timeout has occurred Input: $fp file pointer \*======================================================================*/ function _check_timeout($fp) { if ($this->read_timeout > 0) { $fp_status = socket_get_status($fp); if ($fp_status["timed_out"]) { $this->timed_out = true; return true; } } return false; } /*======================================================================*\ Function: _connect Purpose: make a socket connection Input: $fp file pointer \*======================================================================*/ function _connect(&$fp) { if(!empty($this->proxy_host) && !empty($this->proxy_port)) { $this->_isproxy = true; $host = $this->proxy_host; $port = $this->proxy_port; } else { $host = $this->host; $port = $this->port; } $this->status = 0; if($fp = fsockopen( $host, $port, $errno, $errstr, $this->_fp_timeout )) { // socket connection succeeded return true; } else { // socket connection failed $this->status = $errno; switch($errno) { case -3: $this->error="socket creation failed (-3)"; case -4: $this->error="dns lookup failure (-4)"; case -5: $this->error="connection refused or timed out (-5)"; default: $this->error="connection failed (".$errno.")"; } return false; } } /*======================================================================*\ Function: _disconnect Purpose: disconnect a socket connection Input: $fp file pointer \*======================================================================*/ function _disconnect($fp) { return(fclose($fp)); } /*======================================================================*\ Function: _prepare_post_body Purpose: Prepare post body according to encoding type Input: $formvars - form variables $formfiles - form upload files Output: post body \*======================================================================*/ function _prepare_post_body($formvars, $formfiles) { settype($formvars, "array"); settype($formfiles, "array"); $postdata = ''; if (count($formvars) == 0 && count($formfiles) == 0) return; switch ($this->_submit_type) { case "application/x-www-form-urlencoded": reset($formvars); while(list($key,$val) = each($formvars)) { if (is_array($val) || is_object($val)) { while (list($cur_key, $cur_val) = each($val)) { $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; } } else $postdata .= urlencode($key)."=".urlencode($val)."&"; } break; case "multipart/form-data": $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); reset($formvars); while(list($key,$val) = each($formvars)) { if (is_array($val) || is_object($val)) { while (list($cur_key, $cur_val) = each($val)) { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; $postdata .= "$cur_val\r\n"; } } else { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; $postdata .= "$val\r\n"; } } reset($formfiles); while (list($field_name, $file_names) = each($formfiles)) { settype($file_names, "array"); while (list(, $file_name) = each($file_names)) { if (!is_readable($file_name)) continue; $fp = fopen($file_name, "r"); while (!feof($fp)) { $file_content .= fread($fp, filesize($file_name)); } fclose($fp); $base_name = basename($file_name); $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; $postdata .= "$file_content\r\n"; } } $postdata .= "--".$this->_mime_boundary."--\r\n"; break; } return $postdata; } } endif; ?> blogs/wp-includes/deprecated.php0000644000000000000000000011125511077635520015740 0ustar rootrootposts */ $tableposts = $wpdb->posts; /** * The name of the Users table * @global string $tableusers * @deprecated Use $wpdb->users */ $tableusers = $wpdb->users; /** * The name of the Categories table * @global string $tablecategories * @deprecated Use $wpdb->categories */ $tablecategories = $wpdb->categories; /** * The name of the post to category table * @global string $tablepost2cat * @deprecated Use $wpdb->post2cat; */ $tablepost2cat = $wpdb->post2cat; /** * The name of the comments table * @global string $tablecomments * @deprecated Use $wpdb->comments; */ $tablecomments = $wpdb->comments; /** * The name of the links table * @global string $tablelinks * @deprecated Use $wpdb->links; */ $tablelinks = $wpdb->links; /** * @global string $tablelinkcategories * @deprecated Not used anymore; */ $tablelinkcategories = 'linkcategories_is_gone'; /** * The name of the options table * @global string $tableoptions * @deprecated Use $wpdb->options; */ $tableoptions = $wpdb->options; /** * The name of the postmeta table * @global string $tablepostmeta * @deprecated Use $wpdb->postmeta; */ $tablepostmeta = $wpdb->postmeta; /* * Deprecated functions come here to die. */ /** * get_postdata() - Entire Post data * * @since 0.71 * @deprecated Use get_post() * @see get_post() * * @param int $postid * @return array */ function get_postdata($postid) { _deprecated_function(__FUNCTION__, '0.0', 'get_post()'); $post = &get_post($postid); $postdata = array ( 'ID' => $post->ID, 'Author_ID' => $post->post_author, 'Date' => $post->post_date, 'Content' => $post->post_content, 'Excerpt' => $post->post_excerpt, 'Title' => $post->post_title, 'Category' => $post->post_category, 'post_status' => $post->post_status, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'post_password' => $post->post_password, 'to_ping' => $post->to_ping, 'pinged' => $post->pinged, 'post_type' => $post->post_type, 'post_name' => $post->post_name ); return $postdata; } /** * start_wp() - Sets up the WordPress Loop * * @since 1.0.1 * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop} */ function start_wp() { global $wp_query, $post; _deprecated_function(__FUNCTION__, '1.5', __('new WordPress Loop') ); // Since the old style loop is being used, advance the query iterator here. $wp_query->next_post(); setup_postdata($post); } /** * the_category_ID() - Return or Print Category ID * * @since 0.71 * @deprecated use get_the_category() * @see get_the_category() * * @param bool $echo * @return null|int */ function the_category_ID($echo = true) { _deprecated_function(__FUNCTION__, '0.0', 'get_the_category()'); // Grab the first cat in the list. $categories = get_the_category(); $cat = $categories[0]->term_id; if ( $echo ) echo $cat; return $cat; } /** * the_category_head() - Print category with optional text before and after * * @since 0.71 * @deprecated use get_the_category_by_ID() * @see get_the_category_by_ID() * * @param string $before * @param string $after */ function the_category_head($before='', $after='') { global $currentcat, $previouscat; _deprecated_function(__FUNCTION__, '0.0', 'get_the_category_by_ID()'); // Grab the first cat in the list. $categories = get_the_category(); $currentcat = $categories[0]->category_id; if ( $currentcat != $previouscat ) { echo $before; echo get_the_category_by_ID($currentcat); echo $after; $previouscat = $currentcat; } } /** * previous_post() - Prints link to the previous post * * @since 1.5 * @deprecated Use previous_post_link() * @see previous_post_link() * * @param string $format * @param string $previous * @param string $title * @param string $in_same_cat * @param int $limitprev * @param string $excluded_categories */ function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { _deprecated_function(__FUNCTION__, '0.0', 'previous_post_link()'); if ( empty($in_same_cat) || 'no' == $in_same_cat ) $in_same_cat = false; else $in_same_cat = true; $post = get_previous_post($in_same_cat, $excluded_categories); if ( !$post ) return; $string = ''.$previous; if ( 'yes' == $title ) $string .= apply_filters('the_title', $post->post_title, $post); $string .= ''; $format = str_replace('%', $string, $format); echo $format; } /** * next_post() - Prints link to the next post * * @since 0.71 * @deprecated Use next_post_link() * @see next_post_link() * * @param string $format * @param string $previous * @param string $title * @param string $in_same_cat * @param int $limitprev * @param string $excluded_categories */ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { _deprecated_function(__FUNCTION__, '0.0', 'next_post_link()'); if ( empty($in_same_cat) || 'no' == $in_same_cat ) $in_same_cat = false; else $in_same_cat = true; $post = get_next_post($in_same_cat, $excluded_categories); if ( !$post ) return; $string = ''.$next; if ( 'yes' == $title ) $string .= apply_filters('the_title', $post->post_title, $nextpost); $string .= ''; $format = str_replace('%', $string, $format); echo $format; } /** * user_can_create_post() - Whether user can create a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $blog_id Not Used * @param int $category_id Not Used * @return bool */ function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); $author_data = get_userdata($user_id); return ($author_data->user_level > 1); } /** * user_can_create_draft() - Whether user can create a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $blog_id Not Used * @param int $category_id Not Used * @return bool */ function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); $author_data = get_userdata($user_id); return ($author_data->user_level >= 1); } /** * user_can_edit_post() - Whether user can edit a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $post_id * @param int $blog_id Not Used * @return bool */ function user_can_edit_post($user_id, $post_id, $blog_id = 1) { _deprecated_function(__FUNCTION__, '0', 'current_user_can()'); $author_data = get_userdata($user_id); $post = get_post($post_id); $post_author_data = get_userdata($post->post_author); if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) || ($author_data->user_level > $post_author_data->user_level) || ($author_data->user_level >= 10) ) { return true; } else { return false; } } /** * user_can_delete_post() - Whether user can delete a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $post_id * @param int $blog_id Not Used * @return bool */ function user_can_delete_post($user_id, $post_id, $blog_id = 1) { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); // right now if one can edit, one can delete return user_can_edit_post($user_id, $post_id, $blog_id); } /** * user_can_set_post_date() - Whether user can set new posts' dates * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $blog_id Not Used * @param int $category_id Not Used * @return bool */ function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); $author_data = get_userdata($user_id); return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); } /* returns true if $user_id can edit $post_id's date */ /** * user_can_edit_post_date() - Whether user can delete a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $post_id * @param int $blog_id Not Used * @return bool */ function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); $author_data = get_userdata($user_id); return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); } /* returns true if $user_id can edit $post_id's comments */ /** * user_can_edit_post_comments() - Whether user can delete a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $post_id * @param int $blog_id Not Used * @return bool */ function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); // right now if one can edit a post, one can edit comments made on it return user_can_edit_post($user_id, $post_id, $blog_id); } /* returns true if $user_id can delete $post_id's comments */ /** * user_can_delete_post_comments() - Whether user can delete a post * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $post_id * @param int $blog_id Not Used * @return bool */ function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); // right now if one can edit comments, one can delete comments return user_can_edit_post_comments($user_id, $post_id, $blog_id); } /** * user_can_edit_user() - Can user can edit other user * * @since 1.5 * @deprecated Use current_user_can() * @see current_user_can() * * @param int $user_id * @param int $other_user * @return bool */ function user_can_edit_user($user_id, $other_user) { _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()'); $user = get_userdata($user_id); $other = get_userdata($other_user); if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) return true; else return false; } /** * get_linksbyname() - Gets the links associated with category $cat_name. * * @since 0.71 * @deprecated Use get_links() * @see get_links() * * @param string $cat_name Optional. The category name to use. If no match is found uses all. * @param string $before Optional. The html to output before the link. * @param string $after Optional. The html to output after the link. * @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true. * @param bool $show_images Optional. Whether to show images (if defined). * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a * random order. * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. * @param bool $show_rating Optional. Show rating stars/chars. * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. * @param int $show_updated Optional. Whether to show last updated timestamp */ function get_linksbyname($cat_name = "noname", $before = '', $after = '
    ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 0) { _deprecated_function(__FUNCTION__, '0.0', 'get_links()'); $cat_id = -1; $cat = get_term_by('name', $cat_name, 'link_category'); if ( $cat ) $cat_id = $cat->term_id; get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); } /** * wp_get_linksbyname() - Gets the links associated with the named category. * * @since 1.0.1 * @deprecated Use wp_get_links() * @see wp_get_links() * * @param string $category The category to use. * @param string $args * @return bool|null */ function wp_get_linksbyname($category, $args = '') { _deprecated_function(__FUNCTION__, '0.0', 'wp_get_links()'); $cat = get_term_by('name', $category, 'link_category'); if ( !$cat ) return false; $cat_id = $cat->term_id; $args = add_query_arg('category', $cat_id, $args); wp_get_links($args); } /** * get_linkobjectsbyname() - Gets an array of link objects associated with category $cat_name. * * * $links = get_linkobjectsbyname('fred'); * foreach ($links as $link) { * echo '
  • '.$link->link_name.'
  • '; * } *
    * * @since 1.0.1 * @deprecated Use get_linkobjects() * @see get_linkobjects() * * @param string $cat_name The category name to use. If no match is found uses all. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also * specify 'rand' as the order which will return links in a random order. * @param int $limit Limit to X entries. If not specified, all entries are shown. * @return unknown */ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { _deprecated_function(__FUNCTION__, '0.0', 'get_linkobjects()'); $cat_id = -1; $cat = get_term_by('name', $cat_name, 'link_category'); if ( $cat ) $cat_id = $cat->term_id; return get_linkobjects($cat_id, $orderby, $limit); } /** * get_linkobjects() - Gets an array of link objects associated with category n. * * Usage: * * $links = get_linkobjects(1); * if ($links) { * foreach ($links as $link) { * echo '
  • '.$link->link_name.'
    '.$link->link_description.'
  • '; * } * } *
    * * Fields are: *
      *
    1. link_id
    2. *
    3. link_url
    4. *
    5. link_name
    6. *
    7. link_image
    8. *
    9. link_target
    10. *
    11. link_category
    12. *
    13. link_description
    14. *
    15. link_visible
    16. *
    17. link_owner
    18. *
    19. link_rating
    20. *
    21. link_updated
    22. *
    23. link_rel
    24. *
    25. link_notes
    26. *
    * * @since 1.0.1 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param int $category The category to use. If no category supplied uses all * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', * 'description', or 'rating'. Or maybe owner. If you start the name with an * underscore the order will be reversed. You can also specify 'rand' as the * order which will return links in a random order. * @param int $limit Limit to X entries. If not specified, all entries are shown. * @return unknown */ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()'); $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); $links_array = array(); foreach ($links as $link) $links_array[] = $link; return $links_array; } /** * get_linksbyname_withrating() - Gets the links associated with category 'cat_name' and display rating stars/chars. * * @since 0.71 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param string $cat_name The category name to use. If no match is found uses all * @param string $before The html to output before the link * @param string $after The html to output after the link * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images is true * @param bool $show_images Whether to show images (if defined). * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', * 'description', or 'rating'. Or maybe owner. If you start the name with an * underscore the order will be reversed. You can also specify 'rand' as the * order which will return links in a random order. * @param bool $show_description Whether to show the description if show_images=false/not defined * @param int $limit Limit to X entries. If not specified, all entries are shown. * @param int $show_updated Whether to show last updated timestamp */ function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '
    ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()'); get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); } /** * get_links_withrating() - Gets the links associated with category n and display rating stars/chars. * * @since 0.71 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param int $category The category to use. If no category supplied uses all * @param string $before The html to output before the link * @param string $after The html to output after the link * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images == true * @param bool $show_images Whether to show images (if defined). * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', * 'description', or 'rating'. Or maybe owner. If you start the name with an * underscore the order will be reversed. You can also specify 'rand' as the * order which will return links in a random order. * @param bool $show_description Whether to show the description if show_images=false/not defined. * @param string $limit Limit to X entries. If not specified, all entries are shown. * @param int $show_updated Whether to show last updated timestamp */ function get_links_withrating($category = -1, $before = '', $after = '
    ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()'); get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); } /** * get_autotoggle() - Gets the auto_toggle setting * * @since 0.71 * @deprecated No alternative function available * * @param int $id The category to get. If no category supplied uses 0 * @return int Only returns 0. */ function get_autotoggle($id = 0) { _deprecated_function(__FUNCTION__, '0.0' ); return 0; } /** * @since 0.71 * @deprecated Use wp_list_categories() * @see wp_list_categories() * * @param int $optionall * @param string $all * @param string $sort_column * @param string $sort_order * @param string $file * @param bool $list * @param int $optiondates * @param int $optioncount * @param int $hide_empty * @param int $use_desc_for_title * @param bool $children * @param int $child_of * @param int $categories * @param int $recurse * @param string $feed * @param string $feed_image * @param string $exclude * @param bool $hierarchical * @return unknown */ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()'); $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); return wp_list_cats($query); } /** * @since 1.2 * @deprecated Use wp_list_categories() * @see wp_list_categories() * * @param string|array $args * @return unknown */ function wp_list_cats($args = '') { _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()'); $r = wp_parse_args( $args ); // Map to new names. if ( isset($r['optionall']) && isset($r['all'])) $r['show_option_all'] = $r['all']; if ( isset($r['sort_column']) ) $r['orderby'] = $r['sort_column']; if ( isset($r['sort_order']) ) $r['order'] = $r['sort_order']; if ( isset($r['optiondates']) ) $r['show_last_update'] = $r['optiondates']; if ( isset($r['optioncount']) ) $r['show_count'] = $r['optioncount']; if ( isset($r['list']) ) $r['style'] = $r['list'] ? 'list' : 'break'; $r['title_li'] = ''; return wp_list_categories($r); } /** * @since 0.71 * @deprecated Use wp_dropdown_categories() * @see wp_dropdown_categories() * * @param int $optionall * @param string $all * @param string $orderby * @param string $order * @param int $show_last_update * @param int $show_count * @param int $hide_empty * @param bool $optionnone * @param int $selected * @param int $exclude * @return unknown */ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, $selected = 0, $exclude = 0) { _deprecated_function(__FUNCTION__, '0.0', 'wp_dropdown_categories()'); $show_option_all = ''; if ( $optionall ) $show_option_all = $all; $show_option_none = ''; if ( $optionnone ) $show_option_none = __('None'); $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); $query = add_query_arg($vars, ''); return wp_dropdown_categories($query); } /** * @since 2.1 * @deprecated Use wp_print_scripts() or WP_Scripts. * @see wp_print_scripts() * @see WP_Scripts */ function tinymce_include() { _deprecated_function(__FUNCTION__, '0.0', 'wp_print_scripts()/WP_Scripts'); wp_print_script('wp_tiny_mce'); } /** * @since 1.2 * @deprecated Use wp_list_authors() * @see wp_list_authors() * * @param bool $optioncount * @param bool $exclude_admin * @param bool $show_fullname * @param bool $hide_empty * @param string $feed * @param string $feed_image * @return unknown */ function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { _deprecated_function(__FUNCTION__, '0.0', 'wp_list_authors()'); $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); return wp_list_authors($args); } /** * @since 1.0.1 * @deprecated Use wp_get_post_categories() * @see wp_get_post_categories() * * @param int $blogid Not Used * @param int $post_ID * @return unknown */ function wp_get_post_cats($blogid = '1', $post_ID = 0) { _deprecated_function(__FUNCTION__, '0.0', 'wp_get_post_categories()'); return wp_get_post_categories($post_ID); } /** * wp_set_post_cats() - Sets the categories that the post id belongs to. * * @since 1.0.1 * @deprecated Use wp_set_post_categories() * @see wp_set_post_categories() * * @param int $blogid Not used * @param int $post_ID * @param array $post_categories * @return unknown */ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { _deprecated_function(__FUNCTION__, '0.0', 'wp_set_post_categories()'); return wp_set_post_categories($post_ID, $post_categories); } /** * @since 0.71 * @deprecated Use wp_get_archives() * @see wp_get_archives() * * @param string $type * @param string $limit * @param string $format * @param string $before * @param string $after * @param bool $show_post_count * @return unknown */ function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { _deprecated_function(__FUNCTION__, '0.0', 'wp_get_archives()'); $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); return wp_get_archives($args); } /** * get_author_link() - Returns or Prints link to the author's posts * * @since 1.2 * @deprecated Use get_author_posts_url() * @see get_author_posts_url() * * @param bool $echo Optional. * @param int $author_id Required. * @param string $author_nicename Optional. * @return string|null */ function get_author_link($echo = false, $author_id, $author_nicename = '') { _deprecated_function(__FUNCTION__, '0.0', 'get_author_posts_url()'); $link = get_author_posts_url($author_id, $author_nicename); if ( $echo ) echo $link; return $link; } /** * link_pages() - Print list of pages based on arguments * * @since 0.71 * @deprecated Use wp_link_pages() * @see wp_link_pages() * * @param string $before * @param string $after * @param string $next_or_number * @param string $nextpagelink * @param string $previouspagelink * @param string $pagelink * @param string $more_file * @return string */ function link_pages($before='
    ', $after='
    ', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { _deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()'); $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); return wp_link_pages($args); } /** * get_settings() - Get value based on option * * @since 0.71 * @deprecated Use get_option() * @see get_option() * * @param string $option * @return string */ function get_settings($option) { _deprecated_function(__FUNCTION__, '0.0', 'get_option()'); return get_option($option); } /** * permalink_link() - Print the permalink of the current post in the loop * * @since 0.71 * @deprecated Use the_permalink() * @see the_permalink() */ function permalink_link() { _deprecated_function(__FUNCTION__, '0.0', 'the_permalink()'); the_permalink(); } /** * permalink_single_rss() - Print the permalink to the RSS feed * * @since 0.71 * @deprecated Use the_permalink_rss() * @see the_permalink_rss() * * @param string $file */ function permalink_single_rss($deprecated = '') { _deprecated_function(__FUNCTION__, '0.0', 'the_permalink_rss()'); the_permalink_rss(); } /** * wp_get_links() - Gets the links associated with category. * * @see get_links() for argument information that can be used in $args * @since 1.0.1 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param string $args a query string * @return null|string */ function wp_get_links($args = '') { _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()'); if ( strpos( $args, '=' ) === false ) { $cat_id = $args; $args = add_query_arg( 'category', $cat_id, $args ); } $defaults = array( 'category' => -1, 'before' => '', 'after' => '
    ', 'between' => ' ', 'show_images' => true, 'orderby' => 'name', 'show_description' => true, 'show_rating' => false, 'limit' => -1, 'show_updated' => true, 'echo' => true ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo); } /** * get_links() - Gets the links associated with category by id. * * @since 0.71 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param int $category The category to use. If no category supplied uses all * @param string $before the html to output before the link * @param string $after the html to output after the link * @param string $between the html to output between the link/image and its description. * Not used if no image or show_images == true * @param bool $show_images whether to show images (if defined). * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', * 'description', or 'rating'. Or maybe owner. If you start the name with an * underscore the order will be reversed. You can also specify 'rand' as the order * which will return links in a random order. * @param bool $show_description whether to show the description if show_images=false/not defined. * @param bool $show_rating show rating stars/chars * @param int $limit Limit to X entries. If not specified, all entries are shown. * @param int $show_updated whether to show last updated timestamp * @param bool $echo whether to echo the results, or return them instead * @return null|string */ function get_links($category = -1, $before = '', $after = '
    ', $between = ' ', $show_images = true, $orderby = 'name', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()'); $order = 'ASC'; if ( substr($orderby, 0, 1) == '_' ) { $order = 'DESC'; $orderby = substr($orderby, 1); } if ( $category == -1 ) //get_bookmarks uses '' to signify all categories $category = ''; $results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit"); if ( !$results ) return; $output = ''; foreach ( (array) $results as $row ) { if ( !isset($row->recently_updated) ) $row->recently_updated = false; $output .= $before; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; if ( !empty($row->link_url) ) $the_link = clean_url($row->link_url); $rel = $row->link_rel; if ( '' != $rel ) $rel = ' rel="' . $rel . '"'; $desc = attribute_escape(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); $name = attribute_escape(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); $title = $desc; if ( $show_updated ) if (substr($row->link_updated_f, 0, 2) != '00') $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')'; if ( '' != $title ) $title = ' title="' . $title . '"'; $alt = ' alt="' . $name . '"'; $target = $row->link_target; if ( '' != $target ) $target = ' target="' . $target . '"'; $output .= ''; if ( $row->link_image != null && $show_images ) { if ( strpos($row->link_image, 'http') !== false ) $output .= "link_image\" $alt $title />"; else // If it's a relative path $output .= "link_image\" $alt $title />"; } else { $output .= $name; } $output .= ''; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_append'); if ( $show_description && '' != $desc ) $output .= $between . $desc; if ($show_rating) { $output .= $between . get_linkrating($row); } $output .= "$after\n"; } // end while if ( !$echo ) return $output; echo $output; } /** * get_links_list() - Output entire list of links by category * * Output a list of all links, listed by category, using the * settings in $wpdb->linkcategories and output it as a nested * HTML unordered list. * * @author Dougal * @since 1.0.1 * @deprecated Use wp_list_bookmarks() * @see wp_list_bookmarks() * * @param string $order Sort link categories by 'name' or 'id' * @param string $$deprecated Not Used */ function get_links_list($order = 'name', $deprecated = '') { _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()'); $order = strtolower($order); // Handle link category sorting $direction = 'ASC'; if ( '_' == substr($order,0,1) ) { $direction = 'DESC'; $order = substr($order,1); } if ( !isset($direction) ) $direction = ''; $cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0"); // Display each category if ( $cats ) { foreach ( (array) $cats as $cat ) { // Handle each category. // Display the category name echo '
  • ' . apply_filters('link_category', $cat->name ) . "

    \n\t
      \n"; // Call get_links() with all the appropriate params get_links($cat->term_id, '
    • ', "
    • ", "\n", true, 'name', false); // Close the last category echo "\n\t
    \n
  • \n"; } } } /** * links_popup_script() - Show the link to the links popup and the number of links * * @author Fullo * @link http://sprite.csr.unibo.it/fullo/ * * @since 0.71 * @deprecated {@internal Use function instead is unknown}} * * @param string $text the text of the link * @param int $width the width of the popup window * @param int $height the height of the popup window * @param string $file the page to open in the popup window * @param bool $count the number of links in the db */ function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { _deprecated_function(__FUNCTION__, '0.0' ); if ( $count ) $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); $javascript = ""; $javascript .= $text; if ( $count ) $javascript .= " ($counts)"; $javascript .= "\n\n"; echo $javascript; } /** * @since 1.0.1 * @deprecated Use sanitize_bookmark_field() * @see sanitize_bookmark_field() * * @param object $link * @return unknown */ function get_linkrating($link) { _deprecated_function(__FUNCTION__, '0.0', 'sanitize_bookmark_field()'); return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); } /** * get_linkcatname() - Gets the name of category by id. * * @since 0.71 * @deprecated Use get_category() * @see get_category() * * @param int $id The category to get. If no category supplied uses 0 * @return string */ function get_linkcatname($id = 0) { _deprecated_function(__FUNCTION__, '0.0', 'get_category()'); $id = (int) $id; if ( empty($id) ) return ''; $cats = wp_get_link_cats($id); if ( empty($cats) || ! is_array($cats) ) return ''; $cat_id = (int) $cats[0]; // Take the first cat. $cat = get_category($cat_id); return $cat->name; } /** * comment_rss_link() - Print RSS comment feed link * * @since 1.0.1 * @deprecated Use post_comments_feed_link() * @see post_comments_feed_link() * * @param string $link_text * @param string $deprecated Not used */ function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') { _deprecated_function(__FUNCTION__, '0.0', 'post_comments_feed_link()'); post_comments_feed_link($link_text); } /** * get_category_rss_link() - Print/Return link to category RSS2 feed * * @since 1.2 * @deprecated Use get_category_feed_link() * @see get_category_feed_link() * * @param bool $echo * @param int $cat_ID * @param string $deprecated Not used * @return string|null */ function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') { _deprecated_function(__FUNCTION__, '0.0', 'get_category_feed_link()'); $link = get_category_feed_link($cat_ID, 'rss2'); if ( $echo ) echo $link; return $link; } /** * get_author_rss_link() - Print/Return link to author RSS feed * * @since 1.2 * @deprecated Use get_author_feed_link() * @see get_author_feed_link() * * @param bool $echo * @param int $author_id * @param string $deprecated Not used * @return string|null */ function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') { _deprecated_function(__FUNCTION__, '0.0', 'get_author_feed_link()'); $link = get_author_feed_link($author_id); if ( $echo ) echo $link; return $link; } /** * comments_rss() - Return link to the post RSS feed * * @since 1.5 * @deprecated Use get_post_comments_feed_link() * @see get_post_comments_feed_link() * * @param string $deprecated Not used * @return string */ function comments_rss($deprecated = '') { _deprecated_function(__FUNCTION__, '2.2', 'get_post_comments_feed_link()'); return get_post_comments_feed_link(); } /** * create_user() - An alias of wp_create_user(). * @param string $username The user's username. * @param string $password The user's password. * @param string $email The user's email (optional). * @return int The new user's ID. * @deprecated Use wp_create_user() * @see wp_create_user() */ function create_user($username, $password, $email) { _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' ); return wp_create_user($username, $password, $email); } /** * documentation_link() - Unused Admin function * @since 2.0 * @param string $deprecated Unknown * @deprecated 2.5 */ function documentation_link( $deprecated = '' ) { _deprecated_function( __FUNCTION__, '2.5', '' ); return; } /** * gzip_compression() - Unused function * * @deprecated 2.5 */ function gzip_compression() { return false; } ?> blogs/wp-includes/functions.php0000644000000000000000000021424411077635520015652 0ustar rootrootmonth ) && !empty( $wp_locale->weekday ) && $translate ) { $datemonth = $wp_locale->get_month( date( 'm', $i ) ); $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) ); $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) ); $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) ); $dateformatstring = ' ' . $dateformatstring; $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring ); $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); } $j = @date( $dateformatstring, $i ); /* if ( !$j ) // for debug purposes echo $i." ".$mysqlstring; */ return $j; } /** * Retrieve the current time based on specified type. * * The 'mysql' type will return the time in the format for MySQL DATETIME field. * The 'timestamp' type will return the current timestamp. * * If the $gmt is set to either '1' or 'true', then both types will use the * GMT offset in the WordPress option to add the GMT offset to the time. * * @since 1.0.0 * * @param string $type Either 'mysql' or 'timestamp'. * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false. * @return unknown */ function current_time( $type, $gmt = 0 ) { switch ( $type ) { case 'mysql': return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) ); break; case 'timestamp': return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 ); break; } } /** * Retrieve the date in localized format, based on timestamp. * * If the locale specifies the locale month and weekday, then the locale will * take over the format for the date. If it isn't, then the date format string * will be used instead. * * @since 0.71 * * @param string $dateformatstring Format to display the date * @param int $unixtimestamp Unix timestamp * @return string The date, translated if locale specifies it. */ function date_i18n( $dateformatstring, $unixtimestamp ) { global $wp_locale; $i = $unixtimestamp; // Sanity check for PHP 5.1.0- if ( -1 == $i ) $i = false; if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { $datemonth = $wp_locale->get_month( date( 'm', $i ) ); $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) ); $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) ); $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) ); $dateformatstring = ' '.$dateformatstring; $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring ); $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); } $j = @date( $dateformatstring, $i ); return $j; } /** * Convert number to format based on the locale. * * @since 2.3.0 * * @param mixed $number The number to convert based on locale. * @param int $decimals Precision of the number of decimal places. * @return string Converted number in string format. */ function number_format_i18n( $number, $decimals = null ) { global $wp_locale; // let the user override the precision only $decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals ); return number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); } /** * Convert number of bytes largest unit bytes will fit into. * * It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts * number of bytes to human readable number by taking the number of that unit * that the bytes will go into it. Supports TB value. * * Please note that integers in PHP are limited to 32 bits, unless they are on * 64 bit architecture, then they have 64 bit size. If you need to place the * larger size then what PHP integer type will hold, then use a string. It will * be converted to a double, which should always have 64 bit length. * * Technically the correct unit names for powers of 1024 are KiB, MiB etc. * @link http://en.wikipedia.org/wiki/Byte * * @since 2.3.0 * * @param int|string $bytes Number of bytes. Note max integer size for integers. * @param int $decimals Precision of number of decimal places. * @return unknown */ function size_format( $bytes, $decimals = null ) { $quant = array( // ========================= Origin ==== 'TB' => 1099511627776, // pow( 1024, 4) 'GB' => 1073741824, // pow( 1024, 3) 'MB' => 1048576, // pow( 1024, 2) 'kB' => 1024, // pow( 1024, 1) 'B ' => 1, // pow( 1024, 0) ); foreach ( $quant as $unit => $mag ) if ( doubleval($bytes) >= $mag ) return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; return false; } function get_weekstartend( $mysqlstring, $start_of_week = '' ) { $my = substr( $mysqlstring, 0, 4 ); $mm = substr( $mysqlstring, 8, 2 ); $md = substr( $mysqlstring, 5, 2 ); $day = mktime( 0, 0, 0, $md, $mm, $my ); $weekday = date( 'w', $day ); $i = 86400; if( !is_numeric($start_of_week) ) $start_of_week = get_option( 'start_of_week' ); if ( $weekday < $start_of_week ) $weekday = 7 - $start_of_week - $weekday; while ( $weekday > $start_of_week ) { $weekday = date( 'w', $day ); if ( $weekday < $start_of_week ) $weekday = 7 - $start_of_week - $weekday; $day -= 86400; $i = 0; } $week['start'] = $day + 86400 - $i; $week['end'] = $week['start'] + 604799; return $week; } /** * Unserialize value only if it was serialized. * * @since 2.0.0 * * @param string $original Maybe unserialized original, if is needed. * @return mixed Unserialized data can be any type. */ function maybe_unserialize( $original ) { if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in if ( false !== $gm = @unserialize( $original ) ) return $gm; return $original; } /** * Check value to find if it was serialized. * * If $data is not an string, then returned value will always be false. * Serialized data is always a string. * * @since 2.0.5 * * @param mixed $data Value to check to see if was serialized. * @return bool False if not serialized and true if it was. */ function is_serialized( $data ) { // if it isn't a string, it isn't serialized if ( !is_string( $data ) ) return false; $data = trim( $data ); if ( 'N;' == $data ) return true; if ( !preg_match( '/^([adObis]):/', $data, $badions ) ) return false; switch ( $badions[1] ) { case 'a' : case 'O' : case 's' : if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) ) return true; break; case 'b' : case 'i' : case 'd' : if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) ) return true; break; } return false; } /** * Check whether serialized data is of string type. * * @since 2.0.5 * * @param mixed $data Serialized data * @return bool False if not a serialized string, true if it is. */ function is_serialized_string( $data ) { // if it isn't a string, it isn't a serialized string if ( !is_string( $data ) ) return false; $data = trim( $data ); if ( preg_match( '/^s:[0-9]+:.*;$/s', $data ) ) // this should fetch all serialized strings return true; return false; } /** * Retrieve option value based on setting name. * * If the option does not exist or does not have a value, then the return value * will be false. This is useful to check whether you need to install an option * and is commonly used during installation of plugin options and to test * whether upgrading is required. * * You can "short-circuit" the retrieval of the option from the database for * your plugin or core options that aren't protected. You can do so by hooking * into the 'pre_option_$option' with the $option being replaced by the option * name. You should not try to override special options, but you will not be * prevented from doing so. * * There is a second filter called 'option_$option' with the $option being * replaced with the option name. This gives the value as the only parameter. * * @since 1.5.0 * @package WordPress * @subpackage Option * @uses apply_filters() Calls 'pre_option_$optionname' false to allow * overwriting the option value in a plugin. * @uses apply_filters() Calls 'option_$optionname' with the option name value. * * @param string $setting Name of option to retrieve. Should already be SQL-escaped * @return mixed Value set for the option. */ function get_option( $setting, $default = false ) { global $wpdb, $switched, $current_blog; $wpdb->hide_errors(); // Allow plugins to short-circuit options. $pre = apply_filters( 'pre_option_' . $setting, false ); if ( false !== $pre ) return $pre; $value = _get_option_cache( $setting ); if ( false === $value ) return $default; // If home is not set use siteurl. if ( 'home' == $setting && '' == $value ) return get_option( 'siteurl' ); if ( in_array( $setting, array('siteurl', 'home', 'category_base', 'tag_base') ) ) $value = untrailingslashit( $value ); if (! unserialize($value) ) $value = stripslashes( $value ); return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) ); } /** * Protect WordPress special option from being modified. * * Will die if $option is in protected list. * * @since 2.2.0 * @package WordPress * @subpackage Option * * @param string $option Option name. */ function wp_protect_special_option( $option ) { $protected = array( 'alloptions', 'notoptions' ); if ( in_array( $option, $protected ) ) die( sprintf( __( '%s is a protected WP option and may not be modified' ), wp_specialchars( $option ) ) ); } /** * Print option value after sanitizing for forms. * * @uses attribute_escape Sanitizes value. * @since 1.5.0 * @package WordPress * @subpackage Option * * @param string $option Option name. */ function form_option( $option ) { echo attribute_escape (get_option( $option ) ); } /** * Retrieve all autoload options or all options, if no autoloaded ones exist. * * This is different from wp_load_alloptions(), in this that function does not * cache all options and will retrieve all options from the database every time * it is called. * * @since 1.0.0 * @package WordPress * @subpackage Option * @uses apply_filters() Calls 'pre_option_$optionname' hook with option value as parameter. * @uses apply_filters() Calls 'all_options' on options list. * * @return array List of all options. */ function get_alloptions() { global $wpdb; $show = $wpdb->hide_errors(); if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); $wpdb->show_errors($show); foreach ( (array) $options as $option ) { // "When trying to design a foolproof system, // never underestimate the ingenuity of the fools :)" -- Dougal if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) ) $option->option_value = untrailingslashit( $option->option_value ); $value = maybe_unserialize( $option->option_value ); $all_options->{$option->option_name} = apply_filters( 'pre_option_' . $option->option_name, $value ); } return apply_filters( 'all_options', $all_options ); } /** * Loads and caches all autoloaded options, if available or all options. * * This is different from get_alloptions(), in that this function will cache the * options and will return the cached options when called again. * * @since 2.2.0 * @package WordPress * @subpackage Option * * @return array List all options. */ function wp_load_alloptions() { global $wpdb; global $_wp_alloptions; global $blog_id; if( !defined( 'WP_INSTALLING' ) ) { if ( !empty($_wp_alloptions[$blog_id]) ) return $_wp_alloptions[$blog_id]; $alloptions = wp_cache_get('alloptions', 'options'); if ( false !== $alloptions ) { $_wp_alloptions[$blog_id] = $alloptions; return $alloptions; } $_wp_alloptions[$blog_id] = array(); } $suppress = $wpdb->suppress_errors(); // order by option_id asc in case there are duplicate values - this makes the most recent value overwrite the others in the array $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options FORCE INDEX(PRIMARY) ORDER BY option_id ASC" ); $wpdb->suppress_errors($suppress); foreach ( (array) $alloptions_db as $o ) $_wp_alloptions[$blog_id][$o->option_name] = $o->option_value; wp_cache_set('alloptions', $_wp_alloptions[$blog_id], 'options'); return $_wp_alloptions[$blog_id]; } function _get_option_cache( $setting ) { global $_wp_alloptions; global $blog_id; wp_load_alloptions(); if ( isset($_wp_alloptions[$blog_id][$setting]) ) return $_wp_alloptions[$blog_id][$setting]; return false; } function _set_option_cache( $setting, $value ) { global $_wp_alloptions; global $blog_id; wp_load_alloptions(); $_wp_alloptions[$blog_id][$setting] = $value; wp_cache_delete('alloptions', 'options'); } function _delete_option_cache( $setting ) { global $_wp_alloptions; global $blog_id; wp_load_alloptions(); if ( isset($_wp_alloptions[$blog_id][$setting]) ) unset($_wp_alloptions[$blog_id][$setting]); wp_cache_delete('alloptions', 'options'); } /** * Update the value of an option that was already added. * * If the option does not exist, then the option will be added with the option * value, but you will not be able to set whether it is autoloaded. If you want * to set whether an option autoloaded, then you need to use the add_option(). * * When the option is updated, then the filter named * 'update_option_$option_name', with the $option_name as the $option_name * parameter value, will be called. The hook should accept two parameters, the * first is the old parameter and the second is the new parameter. * * @since 1.0.0 * @package WordPress * @subpackage Option * * @param string $option_name Option name. Expected to not be SQL-escaped * @param mixed $newvalue Option value. * @return bool False if value was not updated and true if value was updated. */ function update_option( $option_name, $newvalue ) { global $wpdb; wp_protect_special_option( $option_name ); $safe_option_name = $wpdb->escape( $option_name ); $newvalue = sanitize_option( $option_name, $newvalue ); $oldvalue = get_option( $safe_option_name ); $newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue ); // If the new and old values are the same, no need to update. if ( $newvalue === $oldvalue ) return false; if ( false === $oldvalue ) { add_option( $option_name, $newvalue ); return true; } $_newvalue = $newvalue; $newvalue = maybe_serialize( $newvalue ); _set_option_cache($option_name, $newvalue); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $newvalue, $option_name ) ); if ( $wpdb->rows_affected == 1 ) { do_action( "update_option_{$option_name}", $oldvalue, $_newvalue ); return true; } return false; } /** * Add a new option. * * You can create options without values and then add values later. Does not * check whether the option has already been added, but does check that you * aren't adding a protected WordPress option. Care should be taken to not name * options, the same as the ones which are protected and to not add options * that were already added. * * The filter named 'add_option_$optionname', with the $optionname being * replaced with the option's name, will be called. The hook should accept two * parameters, the first is the option name, and the second is the value. * * @package WordPress * @subpackage Option * @since 1.0.0 * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton * * @param string $name Option name to add. Expects to NOT be SQL escaped. * @param mixed $value Optional. Option value, can be anything. * @param mixed $deprecated Optional. Description. Not used anymore. * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up. * @return null returns when finished. */ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { global $wpdb; wp_protect_special_option( $name ); $safe_name = $wpdb->escape( $name ); $value = sanitize_option( $name, $value ); if ( false !== get_option( $safe_name ) ) return; $value = maybe_serialize( $value ); $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; _set_option_cache( $name, $value ); $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) ); do_action( "add_option_{$name}", $name, $value ); return; } /** * Removes option by name and prevents removal of protected WordPress options. * * @package WordPress * @subpackage Option * @since unknown * * @param string $name Option name to remove. * @return bool True, if succeed. False, if failure. */ function delete_option( $name ) { global $wpdb; wp_protect_special_option( $name ); _delete_option_cache( $name ); // Get the ID, if no ID then return // expected_slashed ($name) $option = $wpdb->get_row( "SELECT option_id, autoload FROM $wpdb->options WHERE option_name = '$name'" ); if ( is_null($option) || !$option->option_id ) return false; // expected_slashed ($name) $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$name'" ); return true; } /** * Serialize data, if needed. * * @param mixed $data Data that might be serialized. * @return mixed A scalar data */ function maybe_serialize( $data ) { if ( is_array( $data ) || is_object( $data ) ) return serialize( $data ); if ( is_serialized( $data ) ) return serialize( $data ); return $data; } function make_url_footnote( $content ) { preg_match_all( '/(.+?)<\/a>/', $content, $matches ); $j = 0; for ( $i=0; $i(.+?)<\/title>/is', $content, $matchtitle ) ) { $post_title = $matchtitle[0]; $post_title = preg_replace( '//si', '', $post_title ); $post_title = preg_replace( '/<\/title>/si', '', $post_title ); } else { $post_title = $post_default_title; } return $post_title; } function xmlrpc_getpostcategory( $content ) { global $post_default_category; if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) { $post_category = trim( $matchcat[1], ',' ); $post_category = explode( ',', $post_category ); } else { $post_category = $post_default_category; } return $post_category; } function xmlrpc_removepostdata( $content ) { $content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content ); $content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content ); $content = trim( $content ); return $content; } /** * Open the file handle for debugging. * * This function is used for XMLRPC feature, but it is general purpose enough * to be used in anywhere. * * @see fopen() for mode options. * @package WordPress * @subpackage Debug * @since unknown * @uses $debug Used for whether debugging is enabled. * * @param string $filename File path to debug file. * @param string $mode Same as fopen() mode parameter. * @return bool|resource File handle. False on failure. */ function debug_fopen( $filename, $mode ) { global $debug; if ( 1 == $debug ) { $fp = fopen( $filename, $mode ); return $fp; } else { return false; } } /** * Write contents to the file used for debugging. * * Technically, this can be used to write to any file handle when the global * $debug is set to 1 or true. * * @package WordPress * @subpackage Debug * @since unknown * @uses $debug Used for whether debugging is enabled. * * @param resource $fp File handle for debugging file. * @param string $string Content to write to debug file. */ function debug_fwrite( $fp, $string ) { global $debug; if ( 1 == $debug ) fwrite( $fp, $string ); } /** * Close the debugging file handle. * * Technically, this can be used to close any file handle when the global $debug * is set to 1 or true. * * @package WordPress * @subpackage Debug * @since unknown * @uses $debug Used for whether debugging is enabled. * * @param resource $fp Debug File handle. */ function debug_fclose( $fp ) { global $debug; if ( 1 == $debug ) fclose( $fp ); } function do_enclose( $content, $post_ID ) { global $wpdb; include_once( ABSPATH . WPINC . '/class-IXR.php' ); $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' ); $post_links = array(); debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" ); $pung = get_enclosed( $post_ID ); $ltrs = '\w'; $gunk = '/#~:.?+=&%@!\-'; $punc = '.:?\-'; $any = $ltrs . $gunk . $punc; preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp ); debug_fwrite( $log, 'Post contents:' ); debug_fwrite( $log, $content . "\n" ); foreach ( $post_links_temp[0] as $link_test ) { if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already $test = parse_url( $link_test ); if ( isset( $test['query'] ) ) $post_links[] = $link_test; elseif ( $test['path'] != '/' && $test['path'] != '' ) $post_links[] = $link_test; } } foreach ( $post_links as $url ) { if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) { if ( $headers = wp_get_http_headers( $url) ) { $len = (int) $headers['content-length']; $type = $wpdb->escape( $headers['content-type'] ); $allowed_types = array( 'video', 'audio' ); if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { $meta_value = "$url\n$len\n$type\n"; $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` ) VALUES ( %d, 'enclosure' , %s)", $post_ID, $meta_value ) ); } } } } } /** * Perform a HTTP HEAD or GET request. * * If $file_path is a writable filename, this will do a GET request and write * the file to that path. * * @since unknown * * @param string $url * @param string|bool $file_path Optional. File path to write request to. * @param int $red Optional. Number of Redirects. Stops at 5 redirects. * @return bool|string False on failure and string of headers if HEAD request. */ function wp_get_http( $url, $file_path = false, $red = 1 ) { global $wp_version; @set_time_limit( 60 ); if ( $red > 5 ) return false; $parts = parse_url( $url ); $file = $parts['path'] . ( ( $parts['query'] ) ? '?' . $parts['query'] : '' ); $host = $parts['host']; if ( !isset( $parts['port'] ) ) $parts['port'] = 80; if ( $file_path ) $request_type = 'GET'; else $request_type = 'HEAD'; $head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n"; $fp = @fsockopen( $host, $parts['port'], $err_num, $err_msg, 3 ); if ( !$fp ) return false; $response = ''; fputs( $fp, $head ); while ( !feof( $fp ) && strpos( $response, "\r\n\r\n" ) == false ) $response .= fgets( $fp, 2048 ); preg_match_all( '/(.*?): (.*)\r/', $response, $matches ); $count = count( $matches[1] ); for ( $i = 0; $i < $count; $i++ ) { $key = strtolower( $matches[1][$i] ); $headers["$key"] = $matches[2][$i]; } preg_match( '/.*([0-9]{3}).*/', $response, $return ); $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404 $code = $headers['response']; if ( ( '302' == $code || '301' == $code ) && isset( $headers['location'] ) ) { fclose($fp); return wp_get_http( $headers['location'], $file_path, ++$red ); } // make a note of the final location, so the caller can tell if we were redirected or not $headers['x-final-location'] = $url; // HEAD request only if ( !$file_path ) { fclose($fp); return $headers; } // GET request - fetch and write it to the supplied filename $content_length = $headers['content-length']; $got_bytes = 0; $out_fp = fopen($file_path, 'w'); while ( !feof($fp) ) { $buf = fread( $fp, 4096 ); fwrite( $out_fp, $buf ); $got_bytes += strlen($buf); // don't read past the content-length if ($content_length and $got_bytes >= $content_length) break; } fclose($out_fp); fclose($fp); return $headers; } /** * Retrieve HTTP Headers from URL. * * @since 1.5.1 * * @param string $url * @param int $red Optional. Number of redirects. * @return bool|string False on failure, headers on success. */ function wp_get_http_headers( $url, $red = 1 ) { return wp_get_http( $url, false, $red ); } /** * Whether today is a new day. * * {@internal Need to find out how this function is used.}} * * @since 0.71 * @uses $day Today * @uses $previousday Previous day * * @return int 1 when new day, 0 if not a new day. */ function is_new_day() { global $day, $previousday; if ( $day != $previousday ) return 1; else return 0; } /** * Build URL query based on an associative and, or indexed array. * * This is a convenient function for easily building url queries. It sets the * separator to '&' and uses _http_build_query() function. * * @see _http_build_query() Used to build the query * @link http://us2.php.net/manual/en/function.http-build-query.php more on what * http_build_query() does. * * @since unknown * * @param array $data URL-encode key/value pairs. * @return string URL encoded string */ function build_query( $data ) { return _http_build_query( $data, NULL, '&', '', false ); } /** * Retrieve a modified URL query string. * * You can rebuild the URL and append a new query variable to the URL query by * using this function. You can also retrieve the full URL with query data. * * Adding a single key & value or an associative array. Setting a key value to * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER * value. * * @since 1.5.0 * * @param mixed $param1 Either newkey or an associative_array * @param mixed $param2 Either newvalue or oldquery or uri * @param mixed $param3 Optional. Old query or uri * @return unknown */ function add_query_arg() { $ret = ''; if ( is_array( func_get_arg(0) ) ) { if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) ) $uri = $_SERVER['REQUEST_URI']; else $uri = @func_get_arg( 1 ); } else { if ( @func_num_args() < 3 || false === @func_get_arg( 2 ) ) $uri = $_SERVER['REQUEST_URI']; else $uri = @func_get_arg( 2 ); } if ( $frag = strstr( $uri, '#' ) ) $uri = substr( $uri, 0, -strlen( $frag ) ); else $frag = ''; if ( preg_match( '|^https?://|i', $uri, $matches ) ) { $protocol = $matches[0]; $uri = substr( $uri, strlen( $protocol ) ); } else { $protocol = ''; } if ( strpos( $uri, '?' ) !== false ) { $parts = explode( '?', $uri, 2 ); if ( 1 == count( $parts ) ) { $base = '?'; $query = $parts[0]; } else { $base = $parts[0] . '?'; $query = $parts[1]; } } elseif ( !empty( $protocol ) || strpos( $uri, '=' ) === false ) { $base = $uri . '?'; $query = ''; } else { $base = ''; $query = $uri; } wp_parse_str( $query, $qs ); $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string if ( is_array( func_get_arg( 0 ) ) ) { $kayvees = func_get_arg( 0 ); $qs = array_merge( $qs, $kayvees ); } else { $qs[func_get_arg( 0 )] = func_get_arg( 1 ); } foreach ( $qs as $k => $v ) { if ( $v === false ) unset( $qs[$k] ); } $ret = build_query( $qs ); $ret = trim( $ret, '?' ); $ret = preg_replace( '#=(&|$)#', '$1', $ret ); $ret = $protocol . $base . $ret . $frag; $ret = rtrim( $ret, '?' ); return $ret; } /** * Removes an item or list from the query string. * * @since 1.5.0 * * @param string|array $key Query key or keys to remove. * @param bool $query When false uses the $_SERVER value. * @return unknown */ function remove_query_arg( $key, $query=false ) { if ( is_array( $key ) ) { // removing multiple keys foreach ( (array) $key as $k ) $query = add_query_arg( $k, false, $query ); return $query; } return add_query_arg( $key, false, $query ); } /** * Walks the array while sanitizing the contents. * * @uses $wpdb Used to sanitize values * * @param array $array Array to used to walk while sanitizing contents. * @return array Sanitized $array. */ function add_magic_quotes( $array ) { global $wpdb; foreach ( $array as $k => $v ) { if ( is_array( $v ) ) { $array[$k] = add_magic_quotes( $v ); } else { $array[$k] = $wpdb->escape( $v ); } } return $array; } /** * HTTP request for URI to retrieve content. * * Tries to retrieve the HTTP content with fopen first and then using cURL, if * fopen can't be used. * * @since unknown * * @param string $uri URI/URL of web page to retrieve. * @return string HTTP content. */ function wp_remote_fopen( $uri ) { $timeout = 10; $parsed_url = @parse_url( $uri ); if ( !$parsed_url || !is_array( $parsed_url ) ) return false; if ( !isset( $parsed_url['scheme'] ) || !in_array( $parsed_url['scheme'], array( 'http','https' ) ) ) $uri = 'http://' . $uri; if ( ini_get( 'allow_url_fopen' ) ) { $fp = @fopen( $uri, 'r' ); if ( !$fp ) return false; //stream_set_timeout($fp, $timeout); // Requires php 4.3 $linea = ''; while ( $remote_read = fread( $fp, 4096 ) ) $linea .= $remote_read; fclose( $fp ); return $linea; } elseif ( function_exists( 'curl_init' ) ) { $handle = curl_init(); curl_setopt( $handle, CURLOPT_URL, $uri); curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 1 ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); $buffer = curl_exec( $handle ); curl_close( $handle ); return $buffer; } else { return false; } } function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; $wp->main( $query_vars ); if( !isset($wp_the_query) ) $wp_the_query = $wp_query; } /** * Retrieve the description for the HTTP status. * * @since 2.3.0 * * @param int $code HTTP status code. * @return string Empty string if not found, or description if found. */ function get_status_header_desc( $code ) { global $wp_header_to_desc; $code = absint( $code ); if ( !isset( $wp_header_to_desc ) ) { $wp_header_to_desc = array( 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported' ); } if ( isset( $wp_header_to_desc[$code] ) ) return $wp_header_to_desc[$code]; else return ''; } /** * Set HTTP status header. * * @since unknown * @uses apply_filters() Calls 'status_header' on status header string, HTTP * HTTP code, HTTP code description, and protocol string as separate * parameters. * * @param int $header HTTP status code * @return null Does not return anything. */ function status_header( $header ) { $text = get_status_header_desc( $header ); if ( empty( $text ) ) return false; $protocol = $_SERVER["SERVER_PROTOCOL"]; if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0'; $status_header = "$protocol $header $text"; if ( function_exists( 'apply_filters' ) ) $status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol ); if ( version_compare( phpversion(), '4.3.0', '>=' ) ) return @header( $status_header, true, $header ); else return @header( $status_header ); } /** * Sets the headers to prevent caching for the different browsers. * * Different browsers support different nocache headers, so several headers must * be sent so that all of them get the point that no caching should occur. * * @since 2.0.0 */ function nocache_headers() { // why are these @-silenced when other header calls aren't? @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); @header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); @header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); @header( 'Pragma: no-cache' ); } /** * Set the headers for caching for 10 days with JavaScript content type. * * @since 2.1.0 */ function cache_javascript_headers() { $expiresOffset = 864000; // 10 days header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) ); header( "Vary: Accept-Encoding" ); // Handle proxies header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" ); } /** * Retrieve the number of database queries during the WordPress execution. * * @since 2.0.0 * * @return int Number of database queries */ function get_num_queries() { global $wpdb; return $wpdb->num_queries; } /** * Whether input is yes or no. Must be 'y' to be true. * * @since 1.0.0 * * @param string $yn Character string containing either 'y' or 'n' * @return bool True if yes, false on anything else */ function bool_from_yn( $yn ) { return ( strtolower( $yn ) == 'y' ); } function do_feed() { global $wp_query; $feed = get_query_var( 'feed' ); // Remove the pad, if present. $feed = preg_replace( '/^_+/', '', $feed ); if ( $feed == '' || $feed == 'feed' ) $feed = get_default_feed(); $hook = 'do_feed_' . $feed; if ( !has_action($hook) ) { $message = sprintf( __( 'ERROR: %s is not a valid feed template' ), wp_specialchars($feed)); wp_die($message); } do_action( $hook, $wp_query->is_comment_feed ); } /** * Load the RDF RSS 0.91 Feed template. * * @since 2.1.0 */ function do_feed_rdf() { load_template( ABSPATH . WPINC . '/feed-rdf.php' ); } /** * Load the RSS 1.0 Feed Template * * @since 2.1.0 */ function do_feed_rss() { load_template( ABSPATH . WPINC . '/feed-rss.php' ); } /** * Load either the RSS2 comment feed or the RSS2 posts feed. * * @since 2.1.0 * * @param bool $for_comments True for the comment feed, false for normal feed. */ function do_feed_rss2( $for_comments ) { if ( $for_comments ) load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' ); else load_template( ABSPATH . WPINC . '/feed-rss2.php' ); } /** * Load either Atom comment feed or Atom posts feed. * * @since 2.1.0 * * @param bool $for_comments True for the comment feed, false for normal feed. */ function do_feed_atom( $for_comments ) { if ($for_comments) load_template( ABSPATH . WPINC . '/feed-atom-comments.php'); else load_template( ABSPATH . WPINC . '/feed-atom.php' ); } /** * Display the robot.txt file content. * * The echo content should be with usage of the permalinks or for creating the * robot.txt file. * * @since 2.1.0 * @uses do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules. */ function do_robots() { global $current_blog; header('Content-Type: text/plain; charset=utf-8'); do_action( 'do_robotstxt' ); if ( '0' == $current_blog->public ) { echo "User-agent: *\n"; echo "Disallow: /\n"; } else { echo "User-agent: *\n"; echo "Disallow:\n"; } } function is_blog_installed() { global $wpdb; // Check cache first. If options table goes away and we have true cached, oh well. if ( wp_cache_get('is_blog_installed') ) return true; $suppress = $wpdb->suppress_errors(); $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); $wpdb->suppress_errors($suppress); $installed = !empty( $installed ) ? true : false; wp_cache_set('is_blog_installed', $installed); return $installed; } function wp_nonce_url( $actionurl, $action = -1 ) { $actionurl = str_replace( '&', '&', $actionurl ); return wp_specialchars( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) ); } function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) { $name = attribute_escape( $name ); $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; if ( $echo ) echo $nonce_field; if ( $referer ) wp_referer_field( $echo, 'previous' ); return $nonce_field; } function wp_referer_field( $echo = true) { $ref = attribute_escape( $_SERVER['REQUEST_URI'] ); $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; if ( $echo ) echo $referer_field; return $referer_field; } function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI']; $ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to; $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape( stripslashes( $ref ) ) . '" />'; if ( $echo ) echo $orig_referer_field; return $orig_referer_field; } function wp_get_referer() { if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) $ref = $_REQUEST['_wp_http_referer']; else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) $ref = $_SERVER['HTTP_REFERER']; if ( $ref !== $_SERVER['REQUEST_URI'] ) return $ref; return false; } function wp_get_original_referer() { if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) return $_REQUEST['_wp_original_http_referer']; return false; } function wp_mkdir_p( $target ) { // from php.net/mkdir user contributed notes $target = str_replace( '//', '/', $target ); if ( file_exists( $target ) ) return @is_dir( $target ); // Attempting to create the directory may clutter up our display. if ( @mkdir( $target ) ) { $stat = @stat( dirname( $target ) ); $dir_perms = $stat['mode'] & 0007777; // Get the permission bits. @chmod( $target, $dir_perms ); return true; } elseif ( is_dir( dirname( $target ) ) ) { return false; } // If the above failed, attempt to create the parent node, then try again. if ( wp_mkdir_p( dirname( $target ) ) ) return wp_mkdir_p( $target ); return false; } // Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows') function path_is_absolute( $path ) { // this is definitive if true but fails if $path does not exist or contains a symbolic link if ( realpath($path) == $path ) return true; if ( strlen($path) == 0 || $path{0} == '.' ) return false; // windows allows absolute paths like this if ( preg_match('#^[a-zA-Z]:\\\\#', $path) ) return true; // a path starting with / or \ is absolute; anything else is relative return (bool) preg_match('#^[/\\\\]#', $path); } // Join two filesystem paths together (e.g. 'give me $path relative to $base') function path_join( $base, $path ) { if ( path_is_absolute($path) ) return $path; return rtrim($base, '/') . '/' . ltrim($path, '/'); } // Returns an array containing the current upload directory's path and url, or an error message. function wp_upload_dir( $time = NULL ) { $siteurl = get_option( 'siteurl' ); $upload_path = get_option( 'upload_path' ); $upload_path = trim($upload_path); if ( empty($upload_path) ) $dir = WP_CONTENT_DIR . '/uploads'; else $dir = $upload_path; // $dir is absolute, $path is (maybe) relative to ABSPATH $dir = path_join( ABSPATH, $dir ); if ( !$url = get_option( 'upload_url_path' ) ) { if ( empty($upload_path) or ( $upload_path == $dir ) ) $url = WP_CONTENT_URL . '/uploads'; else $url = trailingslashit( $siteurl ) . $upload_path; } if ( defined('UPLOADS') ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS; } $bdir = $dir; $burl = $url; $subdir = ''; if ( get_option( 'uploads_use_yearmonth_folders' ) ) { // Generate the yearly and monthly dirs if ( !$time ) $time = current_time( 'mysql' ); $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $subdir = "/$y/$m"; } $dir .= $subdir; $url .= $subdir; // Make sure we have an uploads dir if ( ! wp_mkdir_p( $dir ) ) { $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir ); return array( 'error' => $message ); } $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ); return apply_filters( 'upload_dir', $uploads ); } // return a filename that is sanitized and unique for the given directory function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) { $filename = strtolower( $filename ); // separate the filename into a name and extension $info = pathinfo($filename); $ext = $info['extension']; $name = basename($filename, ".{$ext}"); // edge case: if file is named '.ext', treat as an empty name if( $name === ".$ext" ) $name = ''; // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) { $filename = $unique_filename_callback( $dir, $name ); } else { $number = ''; if ( empty( $ext ) ) $ext = ''; else $ext = strtolower( ".$ext" ); $filename = str_replace( $ext, '', $filename ); // Strip % so the server doesn't try to decode entities. $filename = str_replace('%', '', sanitize_title_with_dashes( $filename ) ) . $ext; while ( file_exists( $dir . "/$filename" ) ) { if ( '' == "$number$ext" ) $filename = $filename . ++$number . $ext; else $filename = str_replace( "$number$ext", ++$number . $ext, $filename ); } } return $filename; } function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) { if ( empty( $name ) ) return array( 'error' => __( "Empty filename" ) ); $wp_filetype = wp_check_filetype( $name ); if ( !$wp_filetype['ext'] ) return array( 'error' => __( "Invalid file type" ) ); $upload = wp_upload_dir( $time ); if ( $upload['error'] !== false ) return $upload; /* WPMU check file before writing it */ $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) ); if( is_array( $upload_bits_error ) == false ) { $upload[ 'error' ] = $upload_bits_error; return $upload; } $filename = wp_unique_filename( $upload['path'], $name ); $new_file = $upload['path'] . "/$filename"; if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) ); return array( 'error' => $message ); } $ifp = @ fopen( $new_file, 'wb' ); if ( ! $ifp ) return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) ); @fwrite( $ifp, $bits ); fclose( $ifp ); // Set correct file permissions $stat = @ stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0007777; $perms = $perms & 0000666; @ chmod( $new_file, $perms ); // Compute the URL $url = $upload['url'] . "/$filename"; return array( 'file' => $new_file, 'url' => $url, 'error' => false ); } function wp_ext2type( $ext ) { $ext2type = apply_filters('ext2type', array( 'audio' => array('aac','ac3','aif','aiff','mp1','mp2','mp3','m3a','m4a','m4b','ogg','ram','wav','wma'), 'video' => array('asf','avi','divx','dv','mov','mpg','mpeg','mp4','mpv','ogm','qt','rm','vob','wmv'), 'document' => array('doc','pages','odt','rtf','pdf'), 'spreadsheet' => array('xls','numbers','ods'), 'interactive' => array('ppt','key','odp','swf'), 'text' => array('txt'), 'archive' => array('tar','bz2','gz','cab','dmg','rar','sea','sit','sqx','zip'), 'code' => array('css','html','php','js'), )); foreach ( $ext2type as $type => $exts ) if ( in_array($ext, $exts) ) return $type; } function wp_check_filetype( $filename, $mimes = null ) { // Accepted MIME types are set here as PCRE unless provided. $mimes = ( is_array( $mimes ) ) ? $mimes : apply_filters( 'upload_mimes', array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon', 'asf|asx|wax|wmv|wmx' => 'video/asf', 'avi' => 'video/avi', 'mov|qt' => 'video/quicktime', 'mpeg|mpg|mpe|mp4' => 'video/mpeg', 'txt|c|cc|h' => 'text/plain', 'rtx' => 'text/richtext', 'css' => 'text/css', 'htm|html' => 'text/html', 'mp3|m4a' => 'audio/mpeg', 'ra|ram' => 'audio/x-realaudio', 'wav' => 'audio/wav', 'ogg' => 'audio/ogg', 'mid|midi' => 'audio/midi', 'wma' => 'audio/wma', 'rtf' => 'application/rtf', 'js' => 'application/javascript', 'pdf' => 'application/pdf', 'doc' => 'application/msword', 'pot|pps|ppt' => 'application/vnd.ms-powerpoint', 'wri' => 'application/vnd.ms-write', 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel', 'mdb' => 'application/vnd.ms-access', 'mpp' => 'application/vnd.ms-project', 'swf' => 'application/x-shockwave-flash', 'class' => 'application/java', 'tar' => 'application/x-tar', 'zip' => 'application/zip', 'gz|gzip' => 'application/x-gzip', 'exe' => 'application/x-msdownload', // openoffice formats 'odt' => 'application/vnd.oasis.opendocument.text', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odb' => 'application/vnd.oasis.opendocument.database', 'odf' => 'application/vnd.oasis.opendocument.formula', ) ); $type = false; $ext = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!\.(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $filename, $ext_matches ) ) { $type = $mime_match; $ext = $ext_matches[1]; break; } } return compact( 'ext', 'type' ); } function wp_explain_nonce( $action ) { if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) { $verb = $matches[1]; $noun = $matches[2]; $trans = array(); $trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: "%s" has failed.' ), 'get_the_title' ); $trans['add']['category'] = array( __( 'Your attempt to add this category has failed.' ), false ); $trans['delete']['category'] = array( __( 'Your attempt to delete this category: "%s" has failed.' ), 'get_catname' ); $trans['update']['category'] = array( __( 'Your attempt to edit this category: "%s" has failed.' ), 'get_catname' ); $trans['delete']['comment'] = array( __( 'Your attempt to delete this comment: "%s" has failed.' ), 'use_id' ); $trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: "%s" has failed.' ), 'use_id' ); $trans['approve']['comment'] = array( __( 'Your attempt to approve this comment: "%s" has failed.' ), 'use_id' ); $trans['update']['comment'] = array( __( 'Your attempt to edit this comment: "%s" has failed.' ), 'use_id' ); $trans['bulk']['comments'] = array( __( 'Your attempt to bulk modify comments has failed.' ), false ); $trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false ); $trans['add']['bookmark'] = array( __( 'Your attempt to add this link has failed.' ), false ); $trans['delete']['bookmark'] = array( __( 'Your attempt to delete this link: "%s" has failed.' ), 'use_id' ); $trans['update']['bookmark'] = array( __( 'Your attempt to edit this link: "%s" has failed.' ), 'use_id' ); $trans['bulk']['bookmarks'] = array( __( 'Your attempt to bulk modify links has failed.' ), false ); $trans['add']['page'] = array( __( 'Your attempt to add this page has failed.' ), false ); $trans['delete']['page'] = array( __( 'Your attempt to delete this page: "%s" has failed.' ), 'get_the_title' ); $trans['update']['page'] = array( __( 'Your attempt to edit this page: "%s" has failed.' ), 'get_the_title' ); $trans['edit']['plugin'] = array( __( 'Your attempt to edit this plugin file: "%s" has failed.' ), 'use_id' ); $trans['activate']['plugin'] = array( __( 'Your attempt to activate this plugin: "%s" has failed.' ), 'use_id' ); $trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: "%s" has failed.' ), 'use_id' ); $trans['upgrade']['plugin'] = array( __( 'Your attempt to upgrade this plugin: "%s" has failed.' ), 'use_id' ); $trans['add']['post'] = array( __( 'Your attempt to add this post has failed.' ), false ); $trans['delete']['post'] = array( __( 'Your attempt to delete this post: "%s" has failed.' ), 'get_the_title' ); $trans['update']['post'] = array( __( 'Your attempt to edit this post: "%s" has failed.' ), 'get_the_title' ); $trans['add']['user'] = array( __( 'Your attempt to add this user has failed.' ), false ); $trans['delete']['users'] = array( __( 'Your attempt to delete users has failed.' ), false ); $trans['bulk']['users'] = array( __( 'Your attempt to bulk modify users has failed.' ), false ); $trans['update']['user'] = array( __( 'Your attempt to edit this user: "%s" has failed.' ), 'get_author_name' ); $trans['update']['profile'] = array( __( 'Your attempt to modify the profile for: "%s" has failed.' ), 'get_author_name' ); $trans['update']['options'] = array( __( 'Your attempt to edit your settings has failed.' ), false ); $trans['update']['permalink'] = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' ); $trans['edit']['file'] = array( __( 'Your attempt to edit this file: "%s" has failed.' ), 'use_id' ); $trans['edit']['theme'] = array( __( 'Your attempt to edit this theme file: "%s" has failed.' ), 'use_id' ); $trans['switch']['theme'] = array( __( 'Your attempt to switch to this theme: "%s" has failed.' ), 'use_id' ); if ( isset( $trans[$verb][$noun] ) ) { if ( !empty( $trans[$verb][$noun][1] ) ) { $lookup = $trans[$verb][$noun][1]; $object = $matches[4]; if ( 'use_id' != $lookup ) $object = call_user_func( $lookup, $object ); return sprintf( $trans[$verb][$noun][0], wp_specialchars($object) ); } else { return $trans[$verb][$noun][0]; } } } return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), $matches[4] ); } function wp_nonce_ays( $action ) { $title = __( 'WordPress Failure Notice' ); $html = wp_specialchars( wp_explain_nonce( $action ) ) . '</p>'; if ( wp_get_referer() ) $html .= "<p><a href='" . remove_query_arg( 'updated', clean_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>"; wp_die( $html, $title); } function wp_die( $message, $title = '' ) { global $wp_locale; if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) { if ( empty( $title ) ) { $error_data = $message->get_error_data(); if ( is_array( $error_data ) && isset( $error_data['title'] ) ) $title = $error_data['title']; } $errors = $message->get_error_messages(); switch ( count( $errors ) ) : case 0 : $message = ''; break; case 1 : $message = "<p>{$errors[0]}</p>"; break; default : $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>"; break; endswitch; } elseif ( is_string( $message ) ) { $message = "<p>$message</p>"; } if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) $admin_dir = WP_SITEURL . '/wp-admin/'; elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) ) $admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/'; elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false ) $admin_dir = ''; else $admin_dir = 'wp-admin/'; if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) : if( !headers_sent() ){ status_header( 500 ); nocache_headers(); header( 'Content-Type: text/html; charset=utf-8' ); } if ( empty($title) ) { if ( function_exists( '__' ) ) $title = __( 'WordPress › Error' ); else $title = 'WordPress › Error'; } ?> <!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" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $title ?> text_direction ) ) : ?> text_direction ) { $input['directionality'] = 'rtl'; $input['plugins'] .= ',directionality'; $input['theme_advanced_buttons1'] .= ',ltr'; } return $input; } function smilies_init() { global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace; // don't bother setting up smilies if they are disabled if ( !get_option( 'use_smilies' ) ) return; if ( !isset( $wpsmiliestrans ) ) { $wpsmiliestrans = array( ':mrgreen:' => 'icon_mrgreen.gif', ':neutral:' => 'icon_neutral.gif', ':twisted:' => 'icon_twisted.gif', ':arrow:' => 'icon_arrow.gif', ':shock:' => 'icon_eek.gif', ':smile:' => 'icon_smile.gif', ':???:' => 'icon_confused.gif', ':cool:' => 'icon_cool.gif', ':evil:' => 'icon_evil.gif', ':grin:' => 'icon_biggrin.gif', ':idea:' => 'icon_idea.gif', ':oops:' => 'icon_redface.gif', ':razz:' => 'icon_razz.gif', ':roll:' => 'icon_rolleyes.gif', ':wink:' => 'icon_wink.gif', ':cry:' => 'icon_cry.gif', ':eek:' => 'icon_surprised.gif', ':lol:' => 'icon_lol.gif', ':mad:' => 'icon_mad.gif', ':sad:' => 'icon_sad.gif', '8-)' => 'icon_cool.gif', '8-O' => 'icon_eek.gif', ':-(' => 'icon_sad.gif', ':-)' => 'icon_smile.gif', ':-?' => 'icon_confused.gif', ':-D' => 'icon_biggrin.gif', ':-P' => 'icon_razz.gif', ':-o' => 'icon_surprised.gif', ':-x' => 'icon_mad.gif', ':-|' => 'icon_neutral.gif', ';-)' => 'icon_wink.gif', '8)' => 'icon_cool.gif', '8O' => 'icon_eek.gif', ':(' => 'icon_sad.gif', ':)' => 'icon_smile.gif', ':?' => 'icon_confused.gif', ':D' => 'icon_biggrin.gif', ':P' => 'icon_razz.gif', ':o' => 'icon_surprised.gif', ':x' => 'icon_mad.gif', ':|' => 'icon_neutral.gif', ';)' => 'icon_wink.gif', ':!:' => 'icon_exclaim.gif', ':?:' => 'icon_question.gif', ); } $siteurl = get_option( 'siteurl' ); foreach ( (array) $wpsmiliestrans as $smiley => $img ) { $wp_smiliessearch[] = '/(\s|^)' . preg_quote( $smiley, '/' ) . '(\s|$)/'; $smiley_masked = attribute_escape( trim( $smiley ) ); $wp_smiliesreplace[] = " $smiley_masked "; } } /** * Merge user defined arguments into defaults array. * * This function is used throughout WordPress to allow for both string or array * to be merged into another array. * * @since 2.2.0 * * @param string|array $args Value to merge with $defaults * @param array $defaults Array that serves as the defaults. * @return array Merged user defined values with defaults. */ function wp_parse_args( $args, $defaults = '' ) { if ( is_object( $args ) ) $r = get_object_vars( $args ); elseif ( is_array( $args ) ) $r =& $args; else wp_parse_str( $args, $r ); if ( is_array( $defaults ) ) return array_merge( $defaults, $r ); return $r; } /** * Determines if Widgets library should be loaded. * * Checks to make sure that the widgets library hasn't already been loaded. If * it hasn't, then it will load the widgets library and run an action hook. * * @since 2.2.0 * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value. */ function wp_maybe_load_widgets() { if ( !function_exists( 'dynamic_sidebar' ) ) { require_once( ABSPATH . WPINC . '/widgets.php' ); add_action( '_admin_menu', 'wp_widgets_add_menu' ); } } /** * Append the Widgets menu to the themes main menu. * * @since 2.2.0 * @uses $submenu The administration submenu list. */ function wp_widgets_add_menu() { global $submenu; $submenu['themes.php'][7] = array( __( 'Widgets' ), 'switch_themes', 'widgets.php' ); ksort( $submenu['themes.php'], SORT_NUMERIC ); } /** * Flush all output buffers for PHP 5.2. * * Make sure all output buffers are flushed before our singletons our destroyed. * * @since 2.2.0 */ function wp_ob_end_flush_all() { while ( @ob_end_flush() ); } /** * Load the correct database class file. * * This function is used to load the database class file either at runtime or by * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is * defined globally by the inline code in wp-db.php. * * @since 2.5 * @global $wpdb WordPress Database Object */ function require_wp_db() { global $wpdb; if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) require_once( WP_CONTENT_DIR . '/db.php' ); else require_once( ABSPATH . WPINC . '/wp-db.php' ); } /** * Load custom DB error or display WordPress DB error. * * If a file exists in the wp-content directory named db-error.php, then it will * be loaded instead of displaying the WordPress DB error. If it is not found, * then the WordPress DB error will be displayed instead. * * The WordPress DB error sets the HTTP status header to 500 to try to prevent * search engines from caching the message. Custom DB messages should do the * same. * * @since 2.5 * @uses $wpdb */ function dead_db() { global $wpdb; // Load custom DB error template, if present. if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) { require_once( WP_CONTENT_DIR . '/db-error.php' ); die(); } // If installing or in the admin, provide the verbose message. if ( defined('WP_INSTALLING') || defined('WP_ADMIN') ) wp_die($wpdb->error); // Otherwise, be terse. status_header( 500 ); nocache_headers(); header( 'Content-Type: text/html; charset=utf-8' ); ?> > Database Error

    Error establishing a database connection

    deprecated since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) ); else trigger_error( sprintf( __('%1$s is deprecated since version %2$s with no alternative available.'), $function, $version ) ); } } /** * Marks a file as deprecated and informs when it has been used. * * There is a hook deprecated_file_included that will be called that can be used * to get the backtrace up to what file and function included the deprecated * file. * * The current behavior is to trigger an user error if WP_DEBUG is defined and * is true. * * This function is to be used in every file that is depreceated * * @package WordPress * @package Debug * @since 2.5 * @access private * * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead. * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. * * @param string $file The file that was included * @param string $version The version of WordPress that depreceated the function * @param string $replacement Optional. The function that should have been called */ function _deprecated_file($file, $version, $replacement=null) { do_action('deprecated_file_included', $file, $replacement); // Allow plugin to filter the output error trigger if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_file_trigger_error', true )) { if( !is_null($replacement) ) trigger_error( sprintf( __('%1$s is deprecated since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) ); else trigger_error( sprintf( __('%1$s is deprecated since version %2$s with no alternative available.'), $file, $version ) ); } } /** * Is the server running earlier than 1.5.0 version of lighttpd * * @since unknown * * @return bool Whether the server is running lighttpd < 1.5.0 */ function is_lighttpd_before_150() { $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' ); $server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : ''; return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ); } /** * Does the specified module exist in the apache config? * * @since unknown * * @param string $mod e.g. mod_rewrite * @param bool $default The default return value if the module is not found * @return bool */ function apache_mod_loaded($mod, $default = false) { global $is_apache; if ( !$is_apache ) return false; if ( function_exists('apache_get_modules') ) { $mods = apache_get_modules(); if ( in_array($mod, $mods) ) return true; } elseif ( function_exists('phpinfo') ) { ob_start(); phpinfo(8); $phpinfo = ob_get_clean(); if ( false !== strpos($phpinfo, $mod) ) return true; } return $default; } /** * File validates against allowed set of defined rules. * * A return value of '1' means that the $file contains either '..' or './'. A * return value of '2' means that the $file contains ':' after the first * character. A return value of '3' means that the file is not in the allowed * files list. * * @since 2.6 * * @param string $file File path. * @param array $allowed_files List of allowed files. * @return int 0 means nothing is wrong, greater than 0 means something was wrong. */ function validate_file( $file, $allowed_files = '' ) { if ( false !== strpos( $file, '..' )) return 1; if ( false !== strpos( $file, './' )) return 1; if (':' == substr( $file, 1, 1 )) return 2; if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) ) return 3; return 0; } /** * Determine if SSL is used. * * @since 2.6 * * @return bool True if SSL, false if not used. */ function is_ssl() { return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; } /** * Whether SSL login should be forced. * * @since 2.6 * * @param string|bool $force Optional. * @return bool True if forced, false if not forced. */ function force_ssl_login($force = '') { static $forced; if ( '' != $force ) { $old_forced = $forced; $forced = $force; return $old_forced; } return $forced; } /** * Whether to force SSL used for the Administration Panels. * * @since 2.6 * * @param string|bool $force * @return bool True if forced, false if not forced. */ function force_ssl_admin($force = '') { static $forced; if ( '' != $force ) { $old_forced = $forced; $forced = $force; return $old_forced; } return $forced; } /** * Guess the URL for the site. * * Will remove wp-admin links to retrieve only return URLs not in the wp-admin * directory. * * @since 2.6 * * @return string */ function wp_guess_url() { if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { $url = WP_SITEURL; } else { $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } return $url; } ?> blogs/wp-includes/registration.php0000644000000000000000000002124711077635520016353 0ustar rootrootID; } else { return null; } } /** * email_exists() - Checks whether the given email exists. * * @since 2.1.0 * @uses $wpdb * * @param string $email Email. * @return bool|int The user's ID on success, and false on failure. */ function email_exists( $email ) { if ( $user = get_user_by_email($email) ) return $user->ID; return false; } /** * validate_username() - Checks whether an username is valid. * * @since 2.0.1 * @uses apply_filters() Calls 'validate_username' hook on $valid check and $username as parameters * * @param string $username Username. * @return bool Whether username given is valid */ function validate_username( $username ) { $sanitized = sanitize_user( $username, true ); $valid = ( $sanitized == $username ); return apply_filters( 'validate_username', $valid, $username ); } /** * wp_insert_user() - Insert an user into the database. * * Can update a current user or insert a new user based on whether * the user's ID is present. * * Can be used to update the user's info (see below), set the user's * role, and set the user's preference on whether they want the rich * editor on. * * Most of the $userdata array fields have filters associated with * the values. The exceptions are 'rich_editing', 'role', 'jabber', * 'aim', 'yim', 'user_registered', and 'ID'. The filters have the * prefix 'pre_user_' followed by the field name. An example using * 'description' would have the filter called, 'pre_user_description' * that can be hooked into. * * The $userdata array can contain the following fields: * 'ID' - An integer that will be used for updating an existing user. * 'user_pass' - A string that contains the plain text password for the user. * 'user_login' - A string that contains the user's username for logging in. * 'user_nicename' - A string that contains a nicer looking name for the user. * The default is the user's username. * 'user_url' - A string containing the user's URL for the user's web site. * 'user_email' - A string containing the user's email address. * 'display_name' - A string that will be shown on the site. Defaults to user's username. * It is likely that you will want to change this, for both appearance and security * through obscurity (that is if you don't use and delete the default 'admin' user). * 'nickname' - The user's nickname, defaults to the user's username. * 'first_name' - The user's first name. * 'last_name' - The user's last name. * 'description' - A string containing content about the user. * 'rich_editing' - A string for whether to enable the rich editor or not. False if not * empty. * 'user_registered' - The date the user registered. Format is 'Y-m-d H:i:s'. * 'role' - A string used to set the user's role. * 'jabber' - User's Jabber account. * 'aim' - User's AOL IM account. * 'yim' - User's Yahoo IM account. * * @since 2.0.0 * @uses $wpdb WordPress database layer. * @uses apply_filters() Calls filters for most of the $userdata fields with the prefix 'pre_user'. See note above. * @uses do_action() Calls 'profile_update' hook when updating giving the user's ID * @uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID * * @param array $userdata An array of user data. * @return int The newly created user's ID. */ function wp_insert_user($userdata) { global $wpdb; extract($userdata, EXTR_SKIP); // Are we updating or creating? if ( !empty($ID) ) { $ID = (int) $ID; $update = true; } else { $update = false; // Hash the password $user_pass = wp_hash_password($user_pass); } $user_login = sanitize_user($user_login, true); $user_login = apply_filters('pre_user_login', $user_login); if ( empty($user_nicename) ) $user_nicename = sanitize_title( $user_login ); $user_nicename = apply_filters('pre_user_nicename', $user_nicename); if ( empty($user_url) ) $user_url = ''; $user_url = apply_filters('pre_user_url', $user_url); if ( empty($user_email) ) $user_email = ''; $user_email = apply_filters('pre_user_email', $user_email); if ( empty($display_name) ) $display_name = $user_login; $display_name = apply_filters('pre_user_display_name', $display_name); if ( empty($nickname) ) $nickname = $user_login; $nickname = apply_filters('pre_user_nickname', $nickname); if ( empty($first_name) ) $first_name = ''; $first_name = apply_filters('pre_user_first_name', $first_name); if ( empty($last_name) ) $last_name = ''; $last_name = apply_filters('pre_user_last_name', $last_name); if ( empty($description) ) $description = ''; $description = apply_filters('pre_user_description', $description); if ( empty($rich_editing) ) $rich_editing = 'true'; if ( empty($admin_color) ) $admin_color = 'fresh'; $admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color); if ( empty($user_registered) ) $user_registered = gmdate('Y-m-d H:i:s'); $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); $data = stripslashes_deep( $data ); if ( $update ) { $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); $user_id = (int) $ID; } else { $wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) ); $user_id = (int) $wpdb->insert_id; } update_usermeta( $user_id, 'first_name', $first_name); update_usermeta( $user_id, 'last_name', $last_name); update_usermeta( $user_id, 'nickname', $nickname ); update_usermeta( $user_id, 'description', $description ); update_usermeta( $user_id, 'jabber', $jabber ); update_usermeta( $user_id, 'aim', $aim ); update_usermeta( $user_id, 'yim', $yim ); update_usermeta( $user_id, 'rich_editing', $rich_editing); update_usermeta( $user_id, 'admin_color', $admin_color); if ( $update && isset($role) ) { $user = new WP_User($user_id); $user->set_role($role); } if ( !$update ) { $user = new WP_User($user_id); $user->set_role(get_option('default_role')); } wp_cache_delete($user_id, 'users'); wp_cache_delete($user_login, 'userlogins'); if ( $update ) do_action('profile_update', $user_id); else do_action('user_register', $user_id); return $user_id; } /** * wp_update_user() - Update an user in the database * * It is possible to update a user's password by specifying the * 'user_pass' value in the $userdata parameter array. * * If $userdata does not contain an 'ID' key, then a new user * will be created and the new user's ID will be returned. * * If current user's password is being updated, then the cookies * will be cleared. * * @since 2.0.0 * @see wp_insert_user() For what fields can be set in $userdata * @uses wp_insert_user() Used to update existing user or add new one if user doesn't exist already * * @param array $userdata An array of user data. * @return int The updated user's ID. */ function wp_update_user($userdata) { $ID = (int) $userdata['ID']; // First, get all of the original fields $user = get_userdata($ID); // Escape data pulled from DB. $user = add_magic_quotes(get_object_vars($user)); // If password is changing, hash it now. if ( ! empty($userdata['user_pass']) ) { $plaintext_pass = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password($userdata['user_pass']); } // Merge old and new fields with new fields overwriting old ones. $userdata = array_merge($user, $userdata); $user_id = wp_insert_user($userdata); // Update the cookies if the password changed. $current_user = wp_get_current_user(); if ( $current_user->id == $ID ) { if ( isset($plaintext_pass) ) { wp_clear_auth_cookie(); wp_set_auth_cookie($ID); } } return $user_id; } /** * wp_create_user() - A simpler way of inserting an user into the database. * * Creates a new user with just the username, password, and email. For a more * detail creation of a user, use wp_insert_user() to specify more infomation. * * @since 2.0.0 * @see wp_insert_user() More complete way to create a new user * @uses $wpdb Escapes $username and $email parameters * * @param string $username The user's username. * @param string $password The user's password. * @param string $email The user's email (optional). * @return int The new user's ID. */ function wp_create_user($username, $password, $email = '') { global $wpdb; $user_login = $wpdb->escape($username); $user_email = $wpdb->escape($email); $user_pass = $password; $userdata = compact('user_login', 'user_email', 'user_pass'); return wp_insert_user($userdata); } ?> blogs/wp-includes/class-IXR.php0000644000000000000000000006674211077635520015417 0ustar rootrootdata = $data; if (!$type) { $type = $this->calculateType(); } $this->type = $type; if ($type == 'struct') { /* Turn all the values in the array in to new IXR_Value objects */ foreach ($this->data as $key => $value) { $this->data[$key] = new IXR_Value($value); } } if ($type == 'array') { for ($i = 0, $j = count($this->data); $i < $j; $i++) { $this->data[$i] = new IXR_Value($this->data[$i]); } } } function calculateType() { if ($this->data === true || $this->data === false) { return 'boolean'; } if (is_integer($this->data)) { return 'int'; } if (is_double($this->data)) { return 'double'; } // Deal with IXR object types base64 and date if (is_object($this->data) && is_a($this->data, 'IXR_Date')) { return 'date'; } if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) { return 'base64'; } // If it is a normal PHP object convert it in to a struct if (is_object($this->data)) { $this->data = get_object_vars($this->data); return 'struct'; } if (!is_array($this->data)) { return 'string'; } /* We have an array - is it an array or a struct ? */ if ($this->isStruct($this->data)) { return 'struct'; } else { return 'array'; } } function getXml() { /* Return XML for this value */ switch ($this->type) { case 'boolean': return ''.(($this->data) ? '1' : '0').''; break; case 'int': return ''.$this->data.''; break; case 'double': return ''.$this->data.''; break; case 'string': return ''.htmlspecialchars($this->data).''; break; case 'array': $return = ''."\n"; foreach ($this->data as $item) { $return .= ' '.$item->getXml()."\n"; } $return .= ''; return $return; break; case 'struct': $return = ''."\n"; foreach ($this->data as $name => $value) { $name = htmlspecialchars($name); $return .= " $name"; $return .= $value->getXml()."\n"; } $return .= ''; return $return; break; case 'date': case 'base64': return $this->data->getXml(); break; } return false; } function isStruct($array) { /* Nasty function to check if an array is a struct or not */ $expected = 0; foreach ($array as $key => $value) { if ((string)$key != (string)$expected) { return true; } $expected++; } return false; } } /** * IXR_Message * * @package IXR * @since 1.5 */ class IXR_Message { var $message; var $messageType; // methodCall / methodResponse / fault var $faultCode; var $faultString; var $methodName; var $params; // Current variable stacks var $_arraystructs = array(); // The stack used to keep track of the current array/struct var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array var $_currentStructName = array(); // A stack as well var $_param; var $_value; var $_currentTag; var $_currentTagContents; // The XML parser var $_parser; function IXR_Message ($message) { $this->message = $message; } function parse() { // first remove the XML declaration $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); if (trim($this->message) == '') { return false; } $this->_parser = xml_parser_create(); // Set XML parser to take the case of tags in to account xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false); // Set XML parser callback functions xml_set_object($this->_parser, $this); xml_set_element_handler($this->_parser, 'tag_open', 'tag_close'); xml_set_character_data_handler($this->_parser, 'cdata'); if (!xml_parse($this->_parser, $this->message)) { /* die(sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($this->_parser)), xml_get_current_line_number($this->_parser))); */ return false; } xml_parser_free($this->_parser); // Grab the error messages, if any if ($this->messageType == 'fault') { $this->faultCode = $this->params[0]['faultCode']; $this->faultString = $this->params[0]['faultString']; } return true; } function tag_open($parser, $tag, $attr) { $this->_currentTagContents = ''; $this->currentTag = $tag; switch($tag) { case 'methodCall': case 'methodResponse': case 'fault': $this->messageType = $tag; break; /* Deal with stacks of arrays and structs */ case 'data': // data is to all intents and puposes more interesting than array $this->_arraystructstypes[] = 'array'; $this->_arraystructs[] = array(); break; case 'struct': $this->_arraystructstypes[] = 'struct'; $this->_arraystructs[] = array(); break; } } function cdata($parser, $cdata) { $this->_currentTagContents .= $cdata; } function tag_close($parser, $tag) { $valueFlag = false; switch($tag) { case 'int': case 'i4': $value = (int) trim($this->_currentTagContents); $valueFlag = true; break; case 'double': $value = (double) trim($this->_currentTagContents); $valueFlag = true; break; case 'string': $value = $this->_currentTagContents; $valueFlag = true; break; case 'dateTime.iso8601': $value = new IXR_Date(trim($this->_currentTagContents)); // $value = $iso->getTimestamp(); $valueFlag = true; break; case 'value': // "If no type is indicated, the type is string." if (trim($this->_currentTagContents) != '') { $value = (string)$this->_currentTagContents; $valueFlag = true; } break; case 'boolean': $value = (boolean) trim($this->_currentTagContents); $valueFlag = true; break; case 'base64': $value = base64_decode( trim( $this->_currentTagContents ) ); $valueFlag = true; break; /* Deal with stacks of arrays and structs */ case 'data': case 'struct': $value = array_pop($this->_arraystructs); array_pop($this->_arraystructstypes); $valueFlag = true; break; case 'member': array_pop($this->_currentStructName); break; case 'name': $this->_currentStructName[] = trim($this->_currentTagContents); break; case 'methodName': $this->methodName = trim($this->_currentTagContents); break; } if ($valueFlag) { if (count($this->_arraystructs) > 0) { // Add value to struct or array if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { // Add to struct $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; } else { // Add to array $this->_arraystructs[count($this->_arraystructs)-1][] = $value; } } else { // Just add as a paramater $this->params[] = $value; } } $this->_currentTagContents = ''; } } /** * IXR_Server * * @package IXR * @since 1.5 */ class IXR_Server { var $data; var $callbacks = array(); var $message; var $capabilities; function IXR_Server($callbacks = false, $data = false) { $this->setCapabilities(); if ($callbacks) { $this->callbacks = $callbacks; } $this->setCallbacks(); $this->serve($data); } function serve($data = false) { if (!$data) { global $HTTP_RAW_POST_DATA; if (!$HTTP_RAW_POST_DATA) { die('XML-RPC server accepts POST requests only.'); } $data = $HTTP_RAW_POST_DATA; } $this->message = new IXR_Message($data); if (!$this->message->parse()) { $this->error(-32700, 'parse error. not well formed'); } if ($this->message->messageType != 'methodCall') { $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall'); } $result = $this->call($this->message->methodName, $this->message->params); // Is the result an error? if (is_a($result, 'IXR_Error')) { $this->error($result); } // Encode the result $r = new IXR_Value($result); $resultxml = $r->getXml(); // Create the XML $xml = << $resultxml EOD; // Send it $this->output($xml); } function call($methodname, $args) { if (!$this->hasMethod($methodname)) { return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); } $method = $this->callbacks[$methodname]; // Perform the callback and send the response if (count($args) == 1) { // If only one paramater just send that instead of the whole array $args = $args[0]; } // Are we dealing with a function or a method? if (substr($method, 0, 5) == 'this:') { // It's a class method - check it exists $method = substr($method, 5); if (!method_exists($this, $method)) { return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); } // Call the method $result = $this->$method($args); } else { // It's a function - does it exist? if (is_array($method)) { if (!method_exists($method[0], $method[1])) { return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.'); } } else if (!function_exists($method)) { return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); } // Call the function $result = call_user_func($method, $args); } return $result; } function error($error, $message = false) { // Accepts either an error object or an error code and message if ($message && !is_object($error)) { $error = new IXR_Error($error, $message); } $this->output($error->getXml()); } function output($xml) { $xml = ''."\n".$xml; $length = strlen($xml); header('Connection: close'); header('Content-Length: '.$length); header('Content-Type: text/xml'); header('Date: '.date('r')); echo $xml; exit; } function hasMethod($method) { return in_array($method, array_keys($this->callbacks)); } function setCapabilities() { // Initialises capabilities array $this->capabilities = array( 'xmlrpc' => array( 'specUrl' => 'http://www.xmlrpc.com/spec', 'specVersion' => 1 ), 'faults_interop' => array( 'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php', 'specVersion' => 20010516 ), 'system.multicall' => array( 'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208', 'specVersion' => 1 ), ); } function getCapabilities($args) { return $this->capabilities; } function setCallbacks() { $this->callbacks['system.getCapabilities'] = 'this:getCapabilities'; $this->callbacks['system.listMethods'] = 'this:listMethods'; $this->callbacks['system.multicall'] = 'this:multiCall'; } function listMethods($args) { // Returns a list of methods - uses array_reverse to ensure user defined // methods are listed before server defined methods return array_reverse(array_keys($this->callbacks)); } function multiCall($methodcalls) { // See http://www.xmlrpc.com/discuss/msgReader$1208 $return = array(); foreach ($methodcalls as $call) { $method = $call['methodName']; $params = $call['params']; if ($method == 'system.multicall') { $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden'); } else { $result = $this->call($method, $params); } if (is_a($result, 'IXR_Error')) { $return[] = array( 'faultCode' => $result->code, 'faultString' => $result->message ); } else { $return[] = array($result); } } return $return; } } /** * IXR_Request * * @package IXR * @since 1.5 */ class IXR_Request { var $method; var $args; var $xml; function IXR_Request($method, $args) { $this->method = $method; $this->args = $args; $this->xml = << {$this->method} EOD; foreach ($this->args as $arg) { $this->xml .= ''; $v = new IXR_Value($arg); $this->xml .= $v->getXml(); $this->xml .= "\n"; } $this->xml .= ''; } function getLength() { return strlen($this->xml); } function getXml() { return $this->xml; } } /** * IXR_Client * * @package IXR * @since 1.5 */ class IXR_Client { var $server; var $port; var $path; var $useragent; var $response; var $message = false; var $debug = false; var $timeout; // Storage place for an error message var $error = false; function IXR_Client($server, $path = false, $port = 80, $timeout = false) { if (!$path) { // Assume we have been given a URL instead $bits = parse_url($server); $this->server = $bits['host']; $this->port = isset($bits['port']) ? $bits['port'] : 80; $this->path = isset($bits['path']) ? $bits['path'] : '/'; // Make absolutely sure we have a path if (!$this->path) { $this->path = '/'; } } else { $this->server = $server; $this->path = $path; $this->port = $port; } $this->useragent = 'Incutio XML-RPC'; $this->timeout = $timeout; } function query() { $args = func_get_args(); $method = array_shift($args); $request = new IXR_Request($method, $args); $length = $request->getLength(); $xml = $request->getXml(); $r = "\r\n"; $request = "POST {$this->path} HTTP/1.0$r"; $request .= "Host: {$this->server}$r"; $request .= "Content-Type: text/xml$r"; $request .= "User-Agent: {$this->useragent}$r"; $request .= "Content-length: {$length}$r$r"; $request .= $xml; // Now send the request if ($this->debug) { echo '
    '.htmlspecialchars($request)."\n
    \n\n"; } if ($this->timeout) { $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); } else { $fp = @fsockopen($this->server, $this->port, $errno, $errstr); } if (!$fp) { $this->error = new IXR_Error(-32300, "transport error - could not open socket: $errno $errstr"); return false; } fputs($fp, $request); $contents = ''; $gotFirstLine = false; $gettingHeaders = true; while (!feof($fp)) { $line = fgets($fp, 4096); if (!$gotFirstLine) { // Check line for '200' if (strstr($line, '200') === false) { $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200'); return false; } $gotFirstLine = true; } if (trim($line) == '') { $gettingHeaders = false; } if (!$gettingHeaders) { $contents .= trim($line)."\n"; } } if ($this->debug) { echo '
    '.htmlspecialchars($contents)."\n
    \n\n"; } // Now parse what we've got back $this->message = new IXR_Message($contents); if (!$this->message->parse()) { // XML error $this->error = new IXR_Error(-32700, 'parse error. not well formed'); return false; } // Is the message a fault? if ($this->message->messageType == 'fault') { $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString); return false; } // Message must be OK return true; } function getResponse() { // methodResponses can only have one param - return that return $this->message->params[0]; } function isError() { return (is_object($this->error)); } function getErrorCode() { return $this->error->code; } function getErrorMessage() { return $this->error->message; } } /** * IXR_Error * * @package IXR * @since 1.5 */ class IXR_Error { var $code; var $message; function IXR_Error($code, $message) { $this->code = $code; $this->message = htmlspecialchars($message); } function getXml() { $xml = << faultCode {$this->code} faultString {$this->message} EOD; return $xml; } } /** * IXR_Date * * @package IXR * @since 1.5 */ class IXR_Date { var $year; var $month; var $day; var $hour; var $minute; var $second; function IXR_Date($time) { // $time can be a PHP timestamp or an ISO one if (is_numeric($time)) { $this->parseTimestamp($time); } else { $this->parseIso($time); } } function parseTimestamp($timestamp) { $this->year = date('Y', $timestamp); $this->month = date('m', $timestamp); $this->day = date('d', $timestamp); $this->hour = date('H', $timestamp); $this->minute = date('i', $timestamp); $this->second = date('s', $timestamp); } function parseIso($iso) { $this->year = substr($iso, 0, 4); $this->month = substr($iso, 4, 2); $this->day = substr($iso, 6, 2); $this->hour = substr($iso, 9, 2); $this->minute = substr($iso, 12, 2); $this->second = substr($iso, 15, 2); $this->timezone = substr($iso, 17); } function getIso() { return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone; } function getXml() { return ''.$this->getIso().''; } function getTimestamp() { return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); } } /** * IXR_Base64 * * @package IXR * @since 1.5 */ class IXR_Base64 { var $data; function IXR_Base64($data) { $this->data = $data; } function getXml() { return ''.base64_encode($this->data).''; } } /** * IXR_IntrospectionServer * * @package IXR * @since 1.5 */ class IXR_IntrospectionServer extends IXR_Server { var $signatures; var $help; function IXR_IntrospectionServer() { $this->setCallbacks(); $this->setCapabilities(); $this->capabilities['introspection'] = array( 'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html', 'specVersion' => 1 ); $this->addCallback( 'system.methodSignature', 'this:methodSignature', array('array', 'string'), 'Returns an array describing the return type and required parameters of a method' ); $this->addCallback( 'system.getCapabilities', 'this:getCapabilities', array('struct'), 'Returns a struct describing the XML-RPC specifications supported by this server' ); $this->addCallback( 'system.listMethods', 'this:listMethods', array('array'), 'Returns an array of available methods on this server' ); $this->addCallback( 'system.methodHelp', 'this:methodHelp', array('string', 'string'), 'Returns a documentation string for the specified method' ); } function addCallback($method, $callback, $args, $help) { $this->callbacks[$method] = $callback; $this->signatures[$method] = $args; $this->help[$method] = $help; } function call($methodname, $args) { // Make sure it's in an array if ($args && !is_array($args)) { $args = array($args); } // Over-rides default call method, adds signature check if (!$this->hasMethod($methodname)) { return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.'); } $method = $this->callbacks[$methodname]; $signature = $this->signatures[$methodname]; $returnType = array_shift($signature); // Check the number of arguments if (count($args) != count($signature)) { return new IXR_Error(-32602, 'server error. wrong number of method parameters'); } // Check the argument types $ok = true; $argsbackup = $args; for ($i = 0, $j = count($args); $i < $j; $i++) { $arg = array_shift($args); $type = array_shift($signature); switch ($type) { case 'int': case 'i4': if (is_array($arg) || !is_int($arg)) { $ok = false; } break; case 'base64': case 'string': if (!is_string($arg)) { $ok = false; } break; case 'boolean': if ($arg !== false && $arg !== true) { $ok = false; } break; case 'float': case 'double': if (!is_float($arg)) { $ok = false; } break; case 'date': case 'dateTime.iso8601': if (!is_a($arg, 'IXR_Date')) { $ok = false; } break; } if (!$ok) { return new IXR_Error(-32602, 'server error. invalid method parameters'); } } // It passed the test - run the "real" method call return parent::call($methodname, $argsbackup); } function methodSignature($method) { if (!$this->hasMethod($method)) { return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); } // We should be returning an array of types $types = $this->signatures[$method]; $return = array(); foreach ($types as $type) { switch ($type) { case 'string': $return[] = 'string'; break; case 'int': case 'i4': $return[] = 42; break; case 'double': $return[] = 3.1415; break; case 'dateTime.iso8601': $return[] = new IXR_Date(time()); break; case 'boolean': $return[] = true; break; case 'base64': $return[] = new IXR_Base64('base64'); break; case 'array': $return[] = array('array'); break; case 'struct': $return[] = array('struct' => 'struct'); break; } } return $return; } function methodHelp($method) { return $this->help[$method]; } } /** * IXR_ClientMulticall * * @package IXR * @since 1.5 */ class IXR_ClientMulticall extends IXR_Client { var $calls = array(); function IXR_ClientMulticall($server, $path = false, $port = 80) { parent::IXR_Client($server, $path, $port); $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)'; } function addCall() { $args = func_get_args(); $methodName = array_shift($args); $struct = array( 'methodName' => $methodName, 'params' => $args ); $this->calls[] = $struct; } function query() { // Prepare multicall, then call the parent::query() method return parent::query('system.multicall', $this->calls); } } ?> blogs/wp-includes/wp-db.php0000644000000000000000000006722411077645421014660 0ustar rootrootdb_connect(); return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); } /** * Connects to the database server and selects a database * * PHP5 style constructor for compatibility with PHP5. Does * the actual setting up of the class properties and connection * to the database. * * @since 2.0.8 * * @param string $dbuser MySQL database user * @param string $dbpassword MySQL database password * @param string $dbname MySQL database name * @param string $dbhost MySQL database host */ function __construct($dbuser, $dbpassword, $dbname, $dbhost) { register_shutdown_function(array(&$this, "__destruct")); if ( defined('WP_DEBUG') and WP_DEBUG == true ) $this->show_errors(); $this->charset = 'utf8'; if( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' ) { $this->collate = constant( 'DB_COLLATE' ); } else { $this->collate = 'utf8_general_ci'; } if ( defined('DB_CHARSET') ) $this->charset = DB_CHARSET; if ( defined('DB_COLLATE') ) $this->collate = DB_COLLATE; $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true); if (!$this->dbh) { $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at %s. This could mean your host's database server is down.

    • Are you sure you have the correct username and password?
    • Are you sure that you have typed the correct hostname?
    • Are you sure that the database server is running?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    "/*/WP_I18N_DB_CONN_ERROR*/, $dbhost)); return; } $this->ready = true; if ( $this->supports_collation() ) { $collation_query = ''; if ( !empty($this->charset) ) { $collation_query = "SET NAMES '{$this->charset}'"; if (!empty($this->collate) ) $collation_query .= " COLLATE '{$this->collate}'"; } if ( !empty($collation_query) ) $this->query($collation_query); } $this->select($dbname, $this->dbh); } /** * PHP5 style destructor and will run when database object is destroyed. * * @since 2.0.8 * * @return bool Always true */ function __destruct() { return true; } /** * Sets the table prefix for the WordPress tables. * * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to * override the WordPress users and usersmeta tables. * * @since 2.5.0 * * @param string $prefix Alphanumeric name for the new prefix. * @return string Old prefix */ function set_prefix($prefix) { if ( preg_match('|[^a-z0-9_]|i', $prefix) ) return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/); $old_prefix = $this->base_prefix; $this->base_prefix = $prefix; foreach ( $this->global_tables as $table ) $this->$table = $prefix . $table; if ( empty($this->blogid) ) return $old_prefix; $this->prefix = $this->base_prefix . $this->blogid . '_'; foreach ( $this->blog_tables as $table ) $this->$table = $this->prefix . $table; if ( defined('CUSTOM_USER_TABLE') ) $this->users = CUSTOM_USER_TABLE; if ( defined('CUSTOM_USER_META_TABLE') ) $this->usermeta = CUSTOM_USER_META_TABLE; return $old_prefix; } function set_blog_id($blog_id, $site_id = '') { if ( !empty($site_id) ) $this->siteid = $site_id; $old_blog_id = $this->blogid; $this->blogid = $blog_id; $this->prefix = $this->base_prefix . $this->blogid . '_'; foreach ( $this->blog_tables as $table ) $this->$table = $this->prefix . $table; return $old_blog_id; } /** * Selects a database using the current database connection. * * The database name will be changed based on the current database * connection. On failure, the execution will bail and display an DB error. * * @since 0.71 * * @param string $db MySQL database name * @return null Always null. */ function select($db, &$dbh) { if (!@mysql_select_db($db, $dbh)) { $this->ready = false; $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'

    Can’t select database

    We were able to connect to the database server (which means your username and password is okay) but not able to select the %1$s database.

    • Are you sure it exists?
    • Does the user %2$s have permission to use the %1$s database?
    • On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?

    If you don\'t know how to setup a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

    '/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER)); return; } } /** * Escapes content for insertion into the database, for security * * @since 0.71 * * @param string $string * @return string query safe string */ function escape($string) { return addslashes( $string ); // Disable rest for now, causing problems /* if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) return mysql_escape_string( $string ); else return mysql_real_escape_string( $string, $this->dbh ); */ } /** * Escapes content by reference for insertion into the database, for security * * @since 2.3.0 * * @param string $s */ function escape_by_ref(&$s) { $s = $this->escape($s); } /** * Prepares a SQL query for safe use, using sprintf() syntax. * * @link http://php.net/sprintf See for syntax to use for query string. * @since 2.3.0 * * @param null|string $args If string, first parameter must be query statement * @param mixed $args,... If additional parameters, they will be set inserted into the query. * @return null|string Sanitized query string */ function prepare($args=null) { if ( is_null( $args ) ) return; $args = func_get_args(); $query = array_shift($args); $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it $query = str_replace('"%s"', '%s', $query); // doublequote unquoting $query = str_replace('%s', "'%s'", $query); // quote the strings array_walk($args, array(&$this, 'escape_by_ref')); return @vsprintf($query, $args); } /** * Print SQL/DB error. * * @since 0.71 * @global array $EZSQL_ERROR Stores error information of query and error string * * @param string $str The error to display * @return bool False if the showing of errors is disabled. */ function print_error($str = '') { global $EZSQL_ERROR; if (!$str) $str = mysql_error($this->dbh); $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str); if ( $this->suppress_errors ) return false; if ( $caller = $this->get_caller() ) $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller); else $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query); $log_error = true; if ( ! function_exists('error_log') ) $log_error = false; $log_file = @ini_get('error_log'); if ( !empty($log_file) && ('syslog' != $log_file) && !is_writable($log_file) ) $log_error = false; if ( $log_error ) @error_log($error_str, 0); // Is error output turned on or not.. if ( !$this->show_errors ) return false; // If there is an error then take note of it $msg = "WordPress database error: [$str]\n{$this->query}\n"; if( defined( 'ERRORLOGFILE' ) ) error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) ); if( defined( 'DIEONDBERROR' ) ) die( $msg ); } /** * Enables showing of database errors. * * This function should be used only to enable showing of errors. * wpdb::hide_errors() should be used instead for hiding of errors. However, * this function can be used to enable and disable showing of database * errors. * * @since 0.71 * * @param bool $show Whether to show or hide errors * @return bool Old value for showing errors. */ function show_errors( $show = true ) { $errors = $this->show_errors; $this->show_errors = $show; return $errors; } /** * Disables showing of database errors. * * @since 0.71 * * @return bool Whether showing of errors was active or not */ function hide_errors() { $show = $this->show_errors; $this->show_errors = false; return $show; } /** * Whether to suppress database errors. * * @param unknown_type $suppress * @return unknown */ function suppress_errors( $suppress = true ) { $errors = $this->suppress_errors; $this->suppress_errors = $suppress; return $errors; } /** * Kill cached query results. * * @since 0.71 */ function flush() { $this->last_result = array(); $this->col_info = null; $this->last_query = null; } function db_connect( $query = "SELECT" ) { global $db_list, $global_db_list; if( is_array( $db_list ) == false ) return true; if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) { $action = 'global'; $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ]; $this->db_global = $details; } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) { $action = 'write'; $details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ]; $this->db_write = $details; } else { $action = ''; $details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ]; $this->db_read = $details; } $dbhname = "dbh" . $action; $this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] ); if (!$this->$dbhname ) { $this->bail("

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at $dbhost. This could mean your host's database server is down.

    • Are you sure you have the correct username and password?
    • Are you sure that you have typed the correct hostname?
    • Are you sure that the database server is running?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    "); } $this->select( $details[ 'db_name' ], $this->$dbhname ); } /** * Perform a MySQL database query, using current database connection. * * More information can be found on the codex page. * * @since 0.71 * * @param string $query * @return unknown */ function query($query) { if ( ! $this->ready ) return false; // filter the query, if filters are available // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method if ( function_exists('apply_filters') ) $query = apply_filters('query', $query); // initialise return $return_val = 0; $this->flush(); // Log how the function was called $this->func_call = "\$db->query(\"$query\")"; // Keep track of the last query for debug.. $this->last_query = $query; // Perform the query via std mysql_query function.. if ( defined('SAVEQUERIES') && SAVEQUERIES ) $this->timer_start(); // use $this->dbh for read ops, and $this->dbhwrite for write ops // use $this->dbhglobal for gloal table ops unset( $dbh ); if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) { if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) { if( false == isset( $this->dbhglobal ) ) { $this->db_connect( $query ); } $dbh =& $this->dbhglobal; $this->last_db_used = "global"; } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) { if( false == isset( $this->dbhwrite ) ) { $this->db_connect( $query ); } $dbh =& $this->dbhwrite; $this->last_db_used = "write"; } else { $dbh =& $this->dbh; $this->last_db_used = "read"; } } else { $dbh =& $this->dbh; $this->last_db_used = "other/read"; } $this->result = @mysql_query($query, $dbh); ++$this->num_queries; if ( defined('SAVEQUERIES') && SAVEQUERIES ) $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() ); // If there is an error then take note of it.. if( $dbh ) { if ( mysql_error( $dbh ) ) { $this->print_error( mysql_error( $dbh )); return false; } } if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) { $this->rows_affected = mysql_affected_rows($dbh); // Take note of the insert_id if ( preg_match("/^\\s*(insert|replace) /i",$query) ) { $this->insert_id = mysql_insert_id($dbh); } // Return number of rows affected $return_val = $this->rows_affected; } else { $i = 0; while ($i < @mysql_num_fields($this->result)) { $this->col_info[$i] = @mysql_fetch_field($this->result); $i++; } $num_rows = 0; while ( $row = @mysql_fetch_object($this->result) ) { $this->last_result[$num_rows] = $row; $num_rows++; } @mysql_free_result($this->result); // Log number of rows the query returned $this->num_rows = $num_rows; // Return number of rows selected $return_val = $this->num_rows; } return $return_val; } /** * Insert an array of data into a table. * * @since 2.5.0 * * @param string $table WARNING: not sanitized! * @param array $data Should not already be SQL-escaped * @return mixed Results of $this->query() */ function insert($table, $data) { $data = add_magic_quotes($data); $fields = array_keys($data); return $this->query("INSERT INTO $table (`" . implode('`,`',$fields) . "`) VALUES ('".implode("','",$data)."')"); } /** * Update a row in the table with an array of data. * * @since 2.5.0 * * @param string $table WARNING: not sanitized! * @param array $data Should not already be SQL-escaped * @param array $where A named array of WHERE column => value relationships. Multiple member pairs will be joined with ANDs. WARNING: the column names are not currently sanitized! * @return mixed Results of $this->query() */ function update($table, $data, $where){ $data = add_magic_quotes($data); $bits = $wheres = array(); foreach ( array_keys($data) as $k ) $bits[] = "`$k` = '$data[$k]'"; if ( is_array( $where ) ) foreach ( $where as $c => $v ) $wheres[] = "$c = '" . $this->escape( $v ) . "'"; else return false; return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) ); } /** * Retrieve one variable from the database. * * This combines the functionality of wpdb::get_row() and wpdb::get_col(), * so both the column and row can be picked. * * It is possible to use this function without executing more queries. If * you already made a query, you can set the $query to 'null' value and just * retrieve either the column and row of the last query result. * * @since 0.71 * * @param string $query Can be null as well, for caching * @param int $x Column num to return * @param int $y Row num to return * @return mixed Database query results */ function get_var($query=null, $x = 0, $y = 0) { $this->func_call = "\$db->get_var(\"$query\",$x,$y)"; if ( $query ) $this->query($query); // Extract var out of cached results based x,y vals if ( !empty( $this->last_result[$y] ) ) { $values = array_values(get_object_vars($this->last_result[$y])); } // If there is a value return it else return null return (isset($values[$x]) && $values[$x]!=='') ? $values[$x] : null; } /** * Retrieve one row from the database. * * @since 0.71 * * @param string $query SQL query * @param string $output ARRAY_A | ARRAY_N | OBJECT * @param int $y Row num to return * @return mixed Database query results */ function get_row($query = null, $output = OBJECT, $y = 0) { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; if ( $query ) $this->query($query); else return null; if ( !isset($this->last_result[$y]) ) return null; if ( $output == OBJECT ) { return $this->last_result[$y] ? $this->last_result[$y] : null; } elseif ( $output == ARRAY_A ) { return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null; } elseif ( $output == ARRAY_N ) { return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null; } else { $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/); } } /** * Retrieve one column from the database. * * @since 0.71 * * @param string $query Can be null as well, for caching * @param int $x Col num to return. Starts from 0. * @return array Column results */ function get_col($query = null , $x = 0) { if ( $query ) $this->query($query); $new_array = array(); // Extract the column values for ( $i=0; $i < count($this->last_result); $i++ ) { $new_array[$i] = $this->get_var(null, $x, $i); } return $new_array; } /** * Retrieve an entire result set from the database. * * @since 0.71 * * @param string|null $query Can also be null to pull from the cache * @param string $output ARRAY_A | ARRAY_N | OBJECT_K | OBJECT * @return mixed Database query results */ function get_results($query = null, $output = OBJECT) { $this->func_call = "\$db->get_results(\"$query\", $output)"; if ( $query ) $this->query($query); else return null; if ( $output == OBJECT ) { // Return an integer-keyed array of row objects return $this->last_result; } elseif ( $output == OBJECT_K ) { // Return an array of row objects with keys from column 1 // (Duplicates are discarded) foreach ( $this->last_result as $row ) { $key = array_shift( get_object_vars( $row ) ); if ( !isset( $new_array[ $key ] ) ) $new_array[ $key ] = $row; } return $new_array; } elseif ( $output == ARRAY_A || $output == ARRAY_N ) { // Return an integer-keyed array of... if ( $this->last_result ) { $i = 0; foreach( $this->last_result as $row ) { if ( $output == ARRAY_N ) { // ...integer-keyed row arrays $new_array[$i] = array_values( get_object_vars( $row ) ); } else { // ...column name-keyed row arrays $new_array[$i] = get_object_vars( $row ); } ++$i; } return $new_array; } } } /** * Retrieve column metadata from the last query. * * @since 0.71 * * @param string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill * @param int $col_offset 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type * @return mixed Column Results */ function get_col_info($info_type = 'name', $col_offset = -1) { if ( $this->col_info ) { if ( $col_offset == -1 ) { $i = 0; foreach($this->col_info as $col ) { $new_array[$i] = $col->{$info_type}; $i++; } return $new_array; } else { return $this->col_info[$col_offset]->{$info_type}; } } } /** * Starts the timer, for debugging purposes. * * @since 1.5.0 * * @return bool Always returns true */ function timer_start() { $mtime = microtime(); $mtime = explode(' ', $mtime); $this->time_start = $mtime[1] + $mtime[0]; return true; } /** * Stops the debugging timer. * * @since 1.5.0 * * @return int Total time spent on the query, in milliseconds */ function timer_stop() { $mtime = microtime(); $mtime = explode(' ', $mtime); $time_end = $mtime[1] + $mtime[0]; $time_total = $time_end - $this->time_start; return $time_total; } /** * Wraps fatal errors in a nice header and footer and dies. * * @since 1.5.0 * * @param string $message * @return unknown */ function bail($message) { if ( !$this->show_errors ) { if ( class_exists('WP_Error') ) $this->error = new WP_Error('500', $message); else $this->error = $message; return false; } wp_die($message); } /** * Whether or not MySQL database is minimal required version. * * @since 2.5.0 * @uses $wp_version * * @return WP_Error */ function check_database_version() { global $wp_version; // Make sure the server has MySQL 4.0 $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh)); if ( version_compare($mysql_version, '4.0.0', '<') ) return new WP_Error('database_version',sprintf(__('ERROR: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version)); } /** * Whether of not the database version supports collation. * * Called when WordPress is generating the table scheme. * * @since 2.5.0 * * @return bool True if collation is supported, false if version does not */ function supports_collation() { return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ); } /** * Retrieve the name of the function that called wpdb. * * Requires PHP 4.3 and searches up the list of functions until it reaches * the one that would most logically had called this method. * * @since 2.5.0 * * @return string The name of the calling function */ function get_caller() { // requires PHP 4.3+ if ( !is_callable('debug_backtrace') ) return ''; $bt = debug_backtrace(); $caller = ''; foreach ( $bt as $trace ) { if ( @$trace['class'] == __CLASS__ ) continue; elseif ( strtolower(@$trace['function']) == 'call_user_func_array' ) continue; elseif ( strtolower(@$trace['function']) == 'apply_filters' ) continue; elseif ( strtolower(@$trace['function']) == 'do_action' ) continue; $caller = $trace['function']; break; } return $caller; } } if ( ! isset($wpdb) ) { /** * WordPress Database Object, if it isn't set already in wp-content/wpdb.php * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database * @since 0.71 */ $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); } if ( ! isset($wpdbs11) ) { $wpdbs11 = new wpdb('moviem','907sines','custdat','s11.moviemail-online.co.uk'); } ?> blogs/wp-includes/class.wp-scripts.php0000644000000000000000000000516111077635520017055 0ustar rootrootdo_items( $handles ); } function print_scripts_l10n( $handle ) { if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) ) return false; $object_name = $this->registered[$handle]->extra['l10n'][0]; echo "\n"; return true; } function do_item( $handle ) { if ( !parent::do_item($handle) ) return false; $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; if ( isset($this->args[$handle]) ) $ver .= '&' . $this->args[$handle]; $src = $this->registered[$handle]->src; if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) { $src = $this->base_url . $src; } $src = add_query_arg('ver', $ver, $src); $src = clean_url(apply_filters( 'script_loader_src', $src, $handle )); $this->print_scripts_l10n( $handle ); echo "\n"; return true; } /** * Localizes a script * * Localizes only if script has already been added * * @param string handle Script name * @param string object_name Name of JS object to hold l10n info * @param array l10n Array of JS var name => localized string * @return bool Successful localization */ function localize( $handle, $object_name, $l10n ) { if ( !$object_name || !$l10n ) return false; return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) ); } function all_deps( $handles, $recursion = false ) { $r = parent::all_deps( $handles, $recursion ); if ( !$recursion ) $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); return $r; } } blogs/wp-includes/theme.php0000644000000000000000000004564211077635520014750 0ustar rootroottext_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") ) $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css"; else $stylesheet_uri = ''; return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri); } function get_template() { return apply_filters('template', get_option('template')); } function get_template_directory() { $template = get_template(); $template_dir = get_theme_root() . "/$template"; return apply_filters('template_directory', $template_dir, $template); } function get_template_directory_uri() { $template = get_template(); $template_dir_uri = get_theme_root_uri() . "/$template"; return apply_filters('template_directory_uri', $template_dir_uri, $template); } function get_theme_data( $theme_file ) { $themes_allowed_tags = array( 'a' => array( 'href' => array(),'title' => array() ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'em' => array(), 'strong' => array() ); $theme_data = implode( '', file( $theme_file ) ); $theme_data = str_replace ( '\r', '\n', $theme_data ); preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ); preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ); preg_match( '|Description:(.*)$|mi', $theme_data, $description ); if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) ) $author_uri = clean_url( trim( $author_uri[1]) ); else $author_uti = ''; if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) ) $template = wp_kses( trim( $template[1] ), $themes_allowed_tags ); else $template = ''; if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) ) $version = wp_kses( trim( $version[1] ), $themes_allowed_tags ); else $version = ''; if ( preg_match('|Status:(.*)|i', $theme_data, $status) ) $status = wp_kses( trim( $status[1] ), $themes_allowed_tags ); else $status = 'publish'; if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) ) $tags = array_map( 'trim', explode( ',', wp_kses( trim( $tags[1] ), array() ) ) ); else $tags = array(); $name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags ); $theme_uri = clean_url( trim( $theme_uri[1] ) ); $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) ); if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) { if ( empty( $author_uri ) ) { $author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags ); } else { $author = sprintf( '%3$s', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) ); } } else { $author = __('Anonymous'); } return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Status' => $status, 'Tags' => $tags ); } function get_themes() { global $wp_themes, $wp_broken_themes; if ( isset($wp_themes) ) return $wp_themes; $themes = array(); $wp_broken_themes = array(); $theme_loc = $theme_root = get_theme_root(); if ( '/' != WP_CONTENT_DIR ) // don't want to replace all forward slashes, see Trac #4541 $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root); // Files in wp-content/themes directory and one subdir down $themes_dir = @ opendir($theme_root); if ( !$themes_dir ) return false; while ( ($theme_dir = readdir($themes_dir)) !== false ) { if ( is_dir($theme_root . '/' . $theme_dir) && is_readable($theme_root . '/' . $theme_dir) ) { if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' ) continue; $stylish_dir = @ opendir($theme_root . '/' . $theme_dir); $found_stylesheet = false; while ( ($theme_file = readdir($stylish_dir)) !== false ) { if ( $theme_file == 'style.css' ) { $theme_files[] = $theme_dir . '/' . $theme_file; $found_stylesheet = true; break; } } @closedir($stylish_dir); if ( !$found_stylesheet ) { // look for themes in that dir $subdir = "$theme_root/$theme_dir"; $subdir_name = $theme_dir; $theme_subdir = @ opendir( $subdir ); while ( ($theme_dir = readdir($theme_subdir)) !== false ) { if ( is_dir( $subdir . '/' . $theme_dir) && is_readable($subdir . '/' . $theme_dir) ) { if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' ) continue; $stylish_dir = @ opendir($subdir . '/' . $theme_dir); $found_stylesheet = false; while ( ($theme_file = readdir($stylish_dir)) !== false ) { if ( $theme_file == 'style.css' ) { $theme_files[] = $subdir_name . '/' . $theme_dir . '/' . $theme_file; $found_stylesheet = true; break; } } @closedir($stylish_dir); } } @closedir($theme_subdir); $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.')); } } } if ( is_dir( $theme_dir ) ) @closedir( $theme_dir ); if ( !$themes_dir || !$theme_files ) return $themes; sort($theme_files); foreach ( (array) $theme_files as $theme_file ) { if ( !is_readable("$theme_root/$theme_file") ) { $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.')); continue; } $theme_data = get_theme_data("$theme_root/$theme_file"); $name = $theme_data['Name']; $title = $theme_data['Title']; $description = wptexturize($theme_data['Description']); $version = $theme_data['Version']; $author = $theme_data['Author']; $template = $theme_data['Template']; $stylesheet = dirname($theme_file); $screenshot = false; foreach ( array('png', 'gif', 'jpg', 'jpeg') as $ext ) { if (file_exists("$theme_root/$stylesheet/screenshot.$ext")) { $screenshot = "screenshot.$ext"; break; } } if ( empty($name) ) { $name = dirname($theme_file); $title = $name; } if ( empty($template) ) { if ( file_exists(dirname("$theme_root/$theme_file/index.php")) ) $template = dirname($theme_file); else continue; } $template = trim($template); if ( !file_exists("$theme_root/$template/index.php") ) { $parent_dir = dirname(dirname($theme_file)); if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) { $template = "$parent_dir/$template"; } else { $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.')); continue; } } $stylesheet_files = array(); $stylesheet_dir = @ dir("$theme_root/$stylesheet"); if ( $stylesheet_dir ) { while ( ($file = $stylesheet_dir->read()) !== false ) { if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) ) $stylesheet_files[] = "$theme_loc/$stylesheet/$file"; } } $template_files = array(); $template_dir = @ dir("$theme_root/$template"); if ( $template_dir ) { while(($file = $template_dir->read()) !== false) { if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) $template_files[] = "$theme_loc/$template/$file"; } } $template_dir = dirname($template_files[0]); $stylesheet_dir = dirname($stylesheet_files[0]); if ( empty($template_dir) ) $template_dir = '/'; if ( empty($stylesheet_dir) ) $stylesheet_dir = '/'; // Check for theme name collision. This occurs if a theme is copied to // a new theme directory and the theme header is not updated. Whichever // theme is first keeps the name. Subsequent themes get a suffix applied. // The Default and Classic themes always trump their pretenders. if ( isset($themes[$name]) ) { if ( ('WordPress Default' == $name || 'WordPress Classic' == $name) && ('default' == $stylesheet || 'classic' == $stylesheet) ) { // If another theme has claimed to be one of our default themes, move // them aside. $suffix = $themes[$name]['Stylesheet']; $new_name = "$name/$suffix"; $themes[$new_name] = $themes[$name]; $themes[$new_name]['Name'] = $new_name; } else { $name = "$name/$stylesheet"; } } $themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags']); } // Resolve theme dependencies. $theme_names = array_keys($themes); foreach ( (array) $theme_names as $theme_name ) { $themes[$theme_name]['Parent Theme'] = ''; if ( $themes[$theme_name]['Stylesheet'] != $themes[$theme_name]['Template'] ) { foreach ( (array) $theme_names as $parent_theme_name ) { if ( ($themes[$parent_theme_name]['Stylesheet'] == $themes[$parent_theme_name]['Template']) && ($themes[$parent_theme_name]['Template'] == $themes[$theme_name]['Template']) ) { $themes[$theme_name]['Parent Theme'] = $themes[$parent_theme_name]['Name']; break; } } } } $wp_themes = $themes; return $themes; } function get_theme($theme) { $themes = get_themes(); if ( array_key_exists($theme, $themes) ) return $themes[$theme]; return NULL; } function get_current_theme() { if ( $theme = get_option('current_theme') ) return $theme; $themes = get_themes(); $theme_names = array_keys($themes); $current_template = get_option('template'); $current_stylesheet = get_option('stylesheet'); $current_theme = 'WordPress Default'; if ( $themes ) { foreach ( (array) $theme_names as $theme_name ) { if ( $themes[$theme_name]['Stylesheet'] == $current_stylesheet && $themes[$theme_name]['Template'] == $current_template ) { $current_theme = $themes[$theme_name]['Name']; break; } } } update_option('current_theme', $current_theme); return $current_theme; } function get_theme_root() { return apply_filters('theme_root', WP_CONTENT_DIR . "/themes"); } function get_theme_root_uri() { return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl')); } function get_query_template($type) { $template = ''; $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); if ( file_exists(TEMPLATEPATH . "/{$type}.php") ) $template = TEMPLATEPATH . "/{$type}.php"; return apply_filters("{$type}_template", $template); } function get_404_template() { return get_query_template('404'); } function get_archive_template() { return get_query_template('archive'); } function get_author_template() { return get_query_template('author'); } function get_category_template() { $template = ''; if ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') ) $template = TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php'; elseif ( file_exists(TEMPLATEPATH . "/category.php") ) $template = TEMPLATEPATH . "/category.php"; return apply_filters('category_template', $template); } function get_tag_template() { $template = ''; if ( file_exists(TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php') ) $template = TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php'; elseif ( file_exists(TEMPLATEPATH . "/tag.php") ) $template = TEMPLATEPATH . "/tag.php"; return apply_filters('tag_template', $template); } function get_taxonomy_template() { $template = ''; $taxonomy = get_query_var('taxonomy'); $term = get_query_var('term'); if ( $taxonomy && $term && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php") ) $template = TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php"; elseif ( $taxonomy && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy.php") ) $template = TEMPLATEPATH . "/taxonomy-$taxonomy.php"; elseif ( file_exists(TEMPLATEPATH . "/taxonomy.php") ) $template = TEMPLATEPATH . "/taxonomy.php"; return apply_filters('taxonomy_template', $template); } function get_date_template() { return get_query_template('date'); } function get_home_template() { $template = ''; if ( file_exists(TEMPLATEPATH . "/home.php") ) $template = TEMPLATEPATH . "/home.php"; elseif ( file_exists(TEMPLATEPATH . "/index.php") ) $template = TEMPLATEPATH . "/index.php"; return apply_filters('home_template', $template); } function get_page_template() { global $wp_query; $id = (int) $wp_query->post->ID; $template = get_post_meta($id, '_wp_page_template', true); if ( 'default' == $template ) $template = ''; if ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") ) $template = TEMPLATEPATH . "/$template"; elseif ( file_exists(TEMPLATEPATH . "/page.php") ) $template = TEMPLATEPATH . "/page.php"; else $template = ''; return apply_filters('page_template', $template); } function get_paged_template() { return get_query_template('paged'); } function get_search_template() { return get_query_template('search'); } function get_single_template() { return get_query_template('single'); } function get_attachment_template() { global $posts; $type = explode('/', $posts[0]->post_mime_type); if ( $template = get_query_template($type[0]) ) return $template; elseif ( $template = get_query_template($type[1]) ) return $template; elseif ( $template = get_query_template("$type[0]_$type[1]") ) return $template; else return get_query_template('attachment'); } function get_comments_popup_template() { if ( file_exists( TEMPLATEPATH . '/comments-popup.php') ) $template = TEMPLATEPATH . '/comments-popup.php'; else $template = get_theme_root() . '/default/comments-popup.php'; return apply_filters('comments_popup_template', $template); } function load_template($_template_file) { global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; if ( is_array($wp_query->query_vars) ) extract($wp_query->query_vars, EXTR_SKIP); require_once($_template_file); } function locale_stylesheet() { $stylesheet = get_locale_stylesheet_uri(); if ( empty($stylesheet) ) return; echo ''; } function preview_theme() { if ( ! (isset($_GET['template']) && isset($_GET['preview'])) ) return; if ( !current_user_can( 'switch_themes' ) ) return; $_GET[template] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[template]); if ( validate_file($_GET[template]) ) return; add_filter('template', create_function('', "return '$_GET[template]';") ); if ( isset($_GET['stylesheet']) ) { $_GET[stylesheet] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[stylesheet]); if ( validate_file($_GET[stylesheet]) ) return; add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") ); } ob_start( 'preview_theme_ob_filter' ); } add_action('setup_theme', 'preview_theme'); function preview_theme_ob_filter( $content ) { return preg_replace_callback( "|()|", 'preview_theme_ob_filter_callback', $content ); } function preview_theme_ob_filter_callback( $matches ) { if ( ( false !== strpos($matches[3], '/wp-admin/') ) || ( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], get_option('home')) ) || ( false !== strpos($matches[3], '/feed/') ) || ( false !== strpos($matches[3], '/trackback/') ) ) return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4]; $link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] ); if ( 0 === strpos($link, 'preview=1') ) $link = "?$link"; return $matches[1] . attribute_escape( $link ) . $matches[4]; } function switch_theme($template, $stylesheet) { update_option('template', $template); update_option('stylesheet', $stylesheet); delete_option('current_theme'); $theme = get_current_theme(); do_action('switch_theme', $theme); } function validate_current_theme() { // Don't validate during an install/upgrade. if ( defined('WP_INSTALLING') ) return true; if ( get_template() != 'default' && !file_exists(get_template_directory() . '/index.php') ) { switch_theme('default', 'default'); return false; } if ( get_stylesheet() != 'default' && !file_exists(get_template_directory() . '/style.css') ) { switch_theme('default', 'default'); return false; } return true; } function get_theme_mod($name, $default = false) { $theme = get_current_theme(); $mods = get_option("mods_$theme"); if ( isset($mods[$name]) ) return apply_filters( "theme_mod_$name", $mods[$name] ); return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri()) ); } function set_theme_mod($name, $value) { $theme = get_current_theme(); $mods = get_option("mods_$theme"); $mods[$name] = $value; update_option("mods_$theme", $mods); wp_cache_delete("mods_$theme", 'options'); } function remove_theme_mod( $name ) { $theme = get_current_theme(); $mods = get_option("mods_$theme"); if ( !isset($mods[$name]) ) return; unset($mods[$name]); if ( empty($mods) ) return remove_theme_mods(); update_option("mods_$theme", $mods); wp_cache_delete("mods_$theme", 'options'); } function remove_theme_mods() { $theme = get_current_theme(); delete_option("mods_$theme"); } function get_header_textcolor() { return get_theme_mod('header_textcolor', HEADER_TEXTCOLOR); } function header_textcolor() { echo get_header_textcolor(); } function get_header_image() { return get_theme_mod('header_image', HEADER_IMAGE); } function header_image() { echo get_header_image(); } function add_custom_image_header($header_callback, $admin_header_callback) { if ( ! empty($header_callback) ) add_action('wp_head', $header_callback); if ( ! is_admin() ) return; require_once(ABSPATH . 'wp-admin/custom-header.php'); $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback); add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init')); } ?> blogs/wp-includes/images/0000755000000000000000000000000011046077143014364 5ustar rootrootblogs/wp-includes/images/text.png0000644000000000000000000000302711077635520016063 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<PLTEҰ000ͽϹ///Ş]]]ǣklkYYYЏM6*...ں--.D-&ДOKFRL6馦,,-```UUU}}}㴴ý111䓓g^T'#T@2XD5x-#,+*ba?›?C;73Ǜ|===h\Zͼ{pǾFB?2OQ2vndQQQKXn茶7:;MK?ؚ̂*&NH'Q ID0[VL񳰰࠺ף̾ﵑ}҄}gڛĆNSWt<嵗ѽ***m`YŭϚmm\3.$vypߑZUZHAɿcqr$$$~̿n6䤙dNk]~l osglUIRCŐ,,ź@E1PV?sj IDATxڄcpca${6im6Mm۶Vk۶m۶m۶53۝dfg<74\T;B, 1z^Vbߺ/ 07^tL{gڒR0_lJai^p SEmEw͖k sFrT;XY F`l9ѝv ^Ubip.8j `eWO&@`40XA*ѿGe6Nx (%/{$2` ʤ3kc+G\IMaBm_4@ :DtF!8O Ƥur9 ~y;N> ]]::;;~////e44i77\\倀jjNNKK2255BBffOOO]]zmmoo555l TTT99 MMBBpp페!!sjj}}:: qq++..}}yotnﶶMMM GGGGGGxx쉉FF(([[[˨NN oo@@@!!///%%==mmNN** ww!!NN{{""^^|??""&&OOӂ""FFɯ99Pa)IDATxb`6d̀ X9ŕd A'Y[[EG͝J37NML)Q+Vޗlj&Ɨ?yA J;V]sMQyxڗ|F8t^zz~E'nw.OЄEt\V`z3yx#Y !A jn_K4.~j9m ~%"VM2R?ZZ>k[,tV $%m\䄅\l$;;MO"Aj k̕**W)%%{f`/ 6|Tۮ)nj\LLW;899DP02AX!?8??!,ax U;;7H/&8@Q @5i0yvT\\\N8W580-x+a%U׋'qO X196qhP'}tcDh  aq$ $Q ` @jȕJIENDB`blogs/wp-includes/images/video.png0000644000000000000000000000112411077635520016201 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<`PLTETTT싌-6hqtw$Jx5PRUsb螵 IDATx|r E##c|wҞ4N~ވ_ `FWyN ƼPZiR RZVxC%$26x_yR S?s !SSyC b,M麧שT,ܹsO5u'f1"DDނ1T!ƨToIXށS'/꿆!rٗeP[dO?aVHGzDbi@h@=xV߇݂2{U|Mr`l#U1VXt[&Sh$`k-|D\gl$:Í/@P;~y*'?n @hxa!Lǣ\./B6P!oT-^y6֟7V؈\8YĎѐ$h Jht;pOТf\.H7f30m$hMߗD<뛪qLMgt:!d׻8lSϦbpz߅N|PHgaaj;E~4Af݂a Жv%i-! 3,TnJR 0@)`aV(WaAQU̍FCHIh%7``+ye.}r4`Ff7/t׻"*6  P\i6a* fUmwmNImv:<Vh zqCC͟FqPN6ovyi6N= ж)[03èSRb$5Gm%(j0⊞A жp[u~VMHá.eT(.z0{t/QI Eʑ};ȶ- J%O&[uhk{gS'c$LtKfL-VC R87hqc#h`0{D@[v'UgȠl'U["}Z%amrp8dݒ f4YوF$:Lm%B-f bA *if]j9dh|! ەVI8L nW?'WBY1ѧϬb%=-R\`T*,ޕi,ZV&)g<ܣ+IENDB`blogs/wp-includes/images/crystal/document.png0000644000000000000000000000440111077635520020373 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe<IDATxڼYokK.)ޒ(:X"v H!-Ї>?C p^Z-PqZʶJ6rЛ.]rCpf8},vZ>u4!8ncvs;Ƹj4Ϟ= dYxU¿iG* ?薄[ [<+lClpGy:4dcqD7fPNn@4^(o\S j| QeI^YYyj/WR!u.333[ZMx?}7@9 Omo?p4A%zi> 멪ȃrn?^ ޙ6J)[)Ucm>lVWW=&#ɓ'=*.\NcHf8VN)=j|JY_q{ciA<38y 3f::-Z1B)`@ǨdRRLƈe2kb$j0 br"* 0 ;$)wmUHf3`?%"@4CŁ:Ӑ&R2Ami$GxЌd! ^V B@ f J$t9^.̠ D0-Xj,"FjչQH1OSx)hS.APY 䊃ĉun P& Q1!ܼEˀNj4 ̰E.#:Љ !V_z[d2OGH _]ǍݫvzJ{ B9MHrSӑA)@X[q(H @6pT<_~tocE7K;߿KKaXa>ݣ?j&O "a rM[_Z|W͖XfZFRBQSqmww}ܾY0=+ MzGV7UO⯠b衭=,_0>K3 I(0ZQDd@?^Dɉ|Tl*nml{,ř-i6m}cTRi(Qdѭnl9- &v (6ppG(dBb my);9WxP{騥hB >r꥕Ko?}#l2V+g't!#9ny)E@.NAOW0n_`szh<~ھ`OWRq,q]/,y񒨺F1diBPio: 2<b1`7~LJwaf 6,]itLJIOѬ~ry)YwO n=,ZH4v̻}[=mwY IJyr?ށJRWHH 5iijS=1{f;Qo8- }Ņhm;rŒc1ň蚙0AKY@eR8I"߷!aK)߹U Vӿ^w A5?Wxro;Yy#j1BP!=;;;h ^a{!Eo||XB9H[ hMyB+qerrr0IIIwvAhFpŹK 7k5jV x/<|w*rppH[#9sf1& !9qAc_a{۷}Ux ≭}vS\r(o(ݣlvd IENDB`blogs/wp-includes/images/crystal/video.png0000644000000000000000000000450411077635520017667 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe<IDATxڴGhUKS313FžPDEc".Dl+EPB (.\b Ņ[Ĉ{/}޼-f?_LfUUջw2/YYY 6ϟ36fgg塯&?iРANNΏ?4id~sss ֮]ܻ͛wÇOJ/_|g^x88p Eˏ:իeijUZn}Abc({----,,qF$`z\v_~ ;.2rqq144U^۳gPJӦMyoԨS~;vA ܱcy#9qV"ؼ<{;+ŀƾ})هd;kĀƊAHpĈPUUU8FJti _xӦM4h:{,'Nx$_IX>.; DRj"]' ҞEDGPj[M)օl/,,^ƌC틋rnW]ʻiӦ͜9s LƺPo*++5N`hƒ&?App?WTTnMXte/S.++$̐D gCL( %Qi\--fcV6"_&>\j[[-M&5RJKK>*m(/Kh4aqŋ )z)-L\3$dܿK؎Cp*kZGJӼΓ՗FN45SJk ܹsnX2Y25:8t Y^^Np"^=l"մuHcaUdeЛ5^^NNez]Gaz2A[&x$fǔY^b9xFKMnVIM)i&Jg2qSIyd($Cq_/-4Rokc%">&"9{W(PƁycEEEŁ. Wh{49R-Z[}JIENDB`blogs/wp-includes/images/crystal/archive.png0000644000000000000000000000577211077635520020212 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe< IDATxڼZYok].)%ȖQd؆! s^Sb~$%5ݙ3Us.%v29>`{{[JIN9(ιx03 8DhcڕX9}EXcV;D\t+|ncsn4\e-%Z(l`e+]6A|kp {PVy^ݞѴG Spi; Mxe&ve4(򣣉ADA9͂Ѭ6iȕӼi mgD^PZkn{&+Ci>,Lh5d c!  .8e))ePA[Py) GAYI g0XXm` Q2؟i reeAi0\$ B!A>r̓^ɐ2P4 S )O2ʒV4@P7^V/~:|[NfRV <ɹ2!=1xI59Z,LeC$eN Y:P(wBƁcgFS[|y2}y"MyBc9JJ|u$ "dȇ3X@h &F)c$AԀAP"@GV4`|*Z2fhKvՅ`)@Fuhto/,HYź3ZJp}h N1A Rl xTa@Dl|TF2(0bvr8}7&k=MlbVc-jl-^Bf÷ŭm"jN[4@>చPelti[%|:/RԓfFĒ֦և/ |3Zق~WbC[l~7>ۻIҬ>K)@c>:Nj1Dc 'gņ@:fٰ(?q Sk+AU@foPZKtBA5EYH+.A0Ys6( :DҠ]%5?Ö/SVrőޖ In gBhoZ'Mx8gƺPQk:d.+z02H>52 rˠU1/fw )m` | ?g- ӫiDC*C &H C2e@^Pr&R Xæ[Bb7ynJ YYŊvUn._y2'>l=%de¨Y7" r.0"߸vi+oT }=3(z}-ߖo?~|~q1,q +y%mCk(97oWUQty~՝k]xn6+k']m.4ꕋ?S>ǟ`w11@P#LY#+ͫ~\zl5TOwkbrPc:_X`Ҫ@/]|wǓ_u'I1S ({o޽;副.猹RHąGw`a؅śqq^孫nݼscݗ3FK- ֍ v;gu[)CS2RXoz,߾%X[Q I%!0Vk A5$Ds}X)OVz6WIveK9n|nyEkѴ+HOu秮ϛ9n5<4DmDO4@Be6DF6=HK8TV"P58A`q HGG. ~]dXl@݇¤^ ԊHW}Ye6X'x$o .|pۇwCtM:Wu1O[ZbK!xPfiddx܃K[[ޖJ⤓qYJڝ\SABDS#zKЯ셸3&F!uJU٨عh4Is :N0BJI3↥{8{C! IENDB`blogs/wp-includes/images/crystal/code.png0000644000000000000000000000412511077635520017472 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe<IDATxڼSI# OXLj'_tč$FFQ38@5==ݷϽ3uo޼FO\uuuOj~o˥4돏'l\.{ׯ_kBEay = .:ĸ.}rjfꚭQP9F~o֘qdhʣ{ O)S?5л;DkUc=FLfk``a-:22xtS텅裿?CsaV jll-h/_&'\[[Ӵۛ8;;c Yrff9ӧOOTZ]]x܃HCass VeB!Q&e@ss3655簬f{{;FkSn73Q ( ʯ~C4ikk8ӓ  fvYI8kfN_`ޘ̽I3,kmS~l" F'6IX``K`[Ϟ ÈX,}sO22f`0Nn?sr9|zhdnhh NtOe=kQ~l #]A 5[c |NHÇ)Xggd>XǫW8Ng)RI'BZ PN,MJ%y"qhh{lA5x>Lq܄)$d/'ѷoq#m`Ƒt I<\G{Z,ea/ iԬ(404ഁ^]]}\DZY[d&`dNs9Fs0 hR.F=99)AH qAeXZ|К_+LZmPD@YRp.29>Kfz _'cC$B/eC\޽47˗/ijXRu27dF$&q³_QI}} "^\\?~$IF(5 I"$Od(cD7}|Cq6TFPg{-e9aڅNe韊_̓n<$ڣA?:p Bݐo`F$BM"h0zt|qJ,!LPġji⪥b4Mold1kع'Eu"|'N @fOwRNq *,KlEU *gX[,̬*'W;f@8$hv|\o ɚLDĢz/N?vTק9"~lk?;;^/Z¥xHXfuuM:U{7\ygHIe B0(mdLXN6zEU_(f!كWmXP(8lu+5-L{3=x~1bEC,F# $<}n_8,k(䬓fkjx{`N. bJ{IkOtW>.¿0=mNMZMZ~ߨWKgO[6ߺ$zn }!yďXG6)EٓIENDB`blogs/wp-includes/images/crystal/interactive.png0000644000000000000000000000537011077635520021100 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe< IDATxڼY[lW>śMb7nn4@@"*G; D/-RM< !< U 4} B +TUi4Mbw̹d]n33|ϟjs1F݌1lFl2)ѣG]zְWJyw9p*=c7CnFfKjMvf2p&sȈg͠q4vCr=5hPF}d~ X4ۀ8MĆ\|MFdFSr{hr~Y"[=N٧(=滣~Q;~!Rk8M\ B ad.5 }JMaڃ!8pR1wrrary3?3w*ųeă+.E+\[MOpiNb7w:Гtɻt|nnN#(YW -z8HIkMpk\\n6a1#^cKD@ = (͕ \9ym9c_8f/fz|ϮjZUwēJR |V[Z}uyFkzcjkCONjq\&A ֳs0TЖEM:y ]de:k5ROSD?A1J-}: A08OB(c{ј+9o?3%5ܢATg `j}5yܟ-!B8įF.;ᔷ[.SdV&줼P6`?r(rH4{GtSy@$ؽR.ȸ0FWQcm׿թ~l}$Wf*D;ZI a5R_~ Ob.\IuEH{8~o(2SVvUwPzZ\{vրi4%\4K+)haϞ}@&Y-.[j zlhf BT%JE1֑mT6 5ljt$YncahpGՎn#~ijD nRS1[yyի `=Svu@Ȩt8 -2Z/{Q+`Q`,T+>X! 'dwḻː<&bi+7vPrRYX?~kk ?pIWD efd}ǏbP ۪uڎFZ[sg.h*$ %0ŊP#}!mAUP3J Æyf.{ o,䅛l~㾗x:6ޞl?4r]@6nD-"m4[ǽ 9h36^6ȈwG֩X{t#۟W}_2xhK#ocw[2|h,?E4XIENDB`blogs/wp-includes/images/crystal/audio.png0000644000000000000000000000512711077635520017664 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe< IDATxYklGξ4i$NlEIphJC _@E| HR!*>Q!$CHR5-%H-ZJwmڸ/w{ݻnwώXݙt̙l6is!V8i_1v<ϲ,o (gϞe&!M0I0@y<,z fu1Pc9N0M`WI&@И&Vh_Ds E:!Ӛ5 QMF-|{;AG@ Ю3 qX``e,te@Xs Ď} r-Sio3Ɩ1ØwA#R-DXCll.Dϭ )zCiFZ/KrR)JCmJ5_(FvNw+=\p|W^yRjJ]AoJ@E8Dt4@T x}p}W߻>7iUi(7_<pD^ ˃@8 p3i(Z^Zs UdY!_c@#J|Z/6^xYNex,C!PY,uS3RՕRt{6i`t'  SCкl&J%bHXCLp Ѵ&T5 QWܼj_@رM@ ɸVA((SIg[s--~Y0 uOLX60O+~5M݉G=)IpKJ>:\Zk'B4q 2hwYNvTy&4"O~73Y֙;J'WVdn' ޷ Yr,S@=3ɲW4$@@$IT]w0m ԋ+CınKȨ{YĴKa<iU~j bIkLwVs!(z;u Piņaz)*Ppʓ@bX\"]؛ʕD<tjT,/9;覍ӟ{t0y3?䎭/Oo|uG*3> IjY]_(>Tzo=}a0/|Ƿsw^_ۋ$|jEѭEa)ts~~Ccuo}G N`zbJ҅;奲,ɪ=sX c |PO읢9W[_GC"_^"hjYXXO/:ejRUkdy]&]o..6ebɉ7xv|7"YBPW@bT\S}o4YbhP'>>ՕuYUs9x1" \bM|*=vxV_0:6"bKu+ǎo\vuM)(N^px+H#DOȒ](J(2ǥөթs[WѤҏ}hPɁj:A S,v5\EhY=1m^%׏/|Ut›L!AvHs{MӠ I` x]bV_SU`'khU!dw6;Wj&]@F MknOisQePG\X5TnqYV7oF= j2 GM=COvxiV=wgQR9Y%Ffۧ}F1L*dG=^Abỳ;xFCWy%LGMF€hxANGC0@o:9cV%lp,*`) 1y/@ɇDȱEF$G[g [KKWh:\DAֱ7x-}BJ.YzZ81pv X%#O9vmAMR$E~199_:~NIENDB`blogs/wp-includes/images/crystal/default.png0000644000000000000000000000117611077635520020207 0ustar rootrootPNG  IHDR.<tEXtSoftwareAdobe ImageReadyqe< IDATxęQ E+:ggt]CW৶ZޣCHE4F)8(-bu3zS0 nyj_MTL `ڑx7ȃL+9GSiL04zCa9rh\'u OPit~4̕Ә4R@)Iq:-ةf(霋9yP2x̕ 4^ÊYoL3RSJ:XH!/PpUVjHj:3|EX P&&&)m\m}`^'g %R>qԢHhw 1PUZ"^-4(t=HHᰨ(A[*wf A]Tk e4?RUPt=\ssρg< Dc<}`o»wv{ B& #!JP5֯_ m|yfC\a{$:T|#?gRA) I~8"(fRcCr3PU~/D[a=B$eあmvn!_s-~յ T$xg\0vCУq$WӚ׳s7FOlNyy*l]T7,߻w͟bQ-&V>(3'yyǖ%2w2oz̴2<g{ D٣TQ49 >8Zt{Op=K5fnε%^nF ׭[{M]===d);w*<"&С_|Wx(`j*0\t p,((qS G`n;Zi h Kda+o($~O?՗D B_[X˸{EP F, 5-(>\e;R }dUDa/ߕ/OW;Ӻx^3riu(T4wf_--hqT<Egnjs9L^Mv$zWx{֐W#7Y!bm" --ɤq8\.RSD" bDt>'sjԜD8#nCypp-t0*zd' W0ZMGBnܗkɞOEۛ7ޔہ)DaTqHt $.[Kٵ`µpDQȬHU HB!W) Q %؂j;v4pS'4FwTsȫ/ E=vl{Xqq\Z:T8W"IL=egrkYΡ7_W(Ayo>6lltۗݶ/s뵩^\QF$%8絇Kڄu{{7݈-3|a̙3#ŶwH0";%|>9dPpGUQuUS}N+8)z.TG,I夕ie՞WV 3 -ve{g|YlD)}$sr୧ZGV7W^Ebq<Ï@)jIrIENDB`blogs/wp-includes/images/doc.png0000644000000000000000000000277711077635520015657 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<PLTEb۵5V 4ͥSY人ܤXYa.񵵵ޯPTDeQ옙9i䦼R#;ŃHֶiiiݳM✪ 4棾M2־9kɠYssrלuX栺eMVhҼ`n@rVؼңxbbbÌRO抱| IDATxb`R**@, 4:`g_?\6OCAFo_{;<5#<#qϛ+s\SS–b@Uh^34T]]FX(q>O_<7Cfa;£txeDdM)9; '>ފd5.A^9rA閖vv"]\;/41 _чOC$7O4g6a/aCN\K:ΨJXu\%!؈P s\ωn;W )`fӗ zu?FP$X'BImjO MXp3)=@XN9 yؖK^J>H Ĺst2QDQ*'/`" @OGEm{lHR3~DMaaΣb`@6k^]fTс<<%K8WǍj}uEm~\ X854 54$"KkPDV,b]rC")e, Xr&T9 q=@SU X&dGb pB IOIENDB`blogs/wp-includes/images/swf.png0000644000000000000000000000300611077635520015673 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<PLTE<<<999󵵵;;;FScpppIVf===nnn·νђN^pjjjVg{^ivP\jGUe[mJXjtzq>>>YjasSdwlSbv\fsCQ`hr~ˡgzewۚݠXj~dnzP_rv:::|LXgoi}YdriqznmyɫʼnQbu{{{cccXh{MZh^pճr̹X_iWWWxK[njy~{y}stttk~̈Wcq۹󯳷btcvVh{]oضXcq]]]bjtRbu ~gggXfx󣭺xQauk액x#IDATxb`ɟz@`iizςP cq\8 FV `08V..E+Fp Fn0b +oR\,QhlÄUO*LJNJ ɥռT4D޸dMf0* / &Ff M^QQ/Tc+БX\r9cc \:UϿцP ")qՙf}:>!19LB o t}t31ݐ}ARx@ueez? TdecC(VoRzyjg06>#Z U b'sr")^WۃNjsoAr[a @Ij7hJ`QP5͹ 5)YVP2cDH X{b攞`Mcy"RdH_rXeT3~O;'i$B,r>yVRXNa~$\BB,ޛ/fer4;QQ&Ovo77;d(͏.& ubi=a.???0&kwh,]ΎE + &Q :ŐQyqff\t IENDB`blogs/wp-includes/images/smilies/0000755000000000000000000000000011046077143016031 5ustar rootrootblogs/wp-includes/images/smilies/icon_eek.gif0000644000000000000000000000025211077635520020276 0ustar rootrootGIF89a EEE! ,WI9jŔ"I"c0@6r +ﱫۮ00P6 F IEy,(i%`'pa6g1܀}g4$;blogs/wp-includes/images/smilies/icon_evil.gif0000644000000000000000000000035411077635520020474 0ustar rootrootGIF89aEEE*m!,i @h$*2FC5@NG @ ꚱ- h>h)@T]ᰥ"ij,cIwdGk+:G(F()Z#&(!;blogs/wp-includes/images/smilies/icon_neutral.gif0000644000000000000000000000025311077635520021205 0ustar rootrootGIF89a EEE! ,XIjՕpCLA' vpj A88r9ʊ)\ԓbd`a -e&kQ@73,Km;blogs/wp-includes/images/smilies/icon_question.gif0000644000000000000000000000037011077635520021402 0ustar rootrootGIF89aEEEuϾ/+_W߰of!,u&@YVNq' @k,TAIPgK@L`$[CJgMh%x \Szb Q[0$VF<2])<&G#!;blogs/wp-includes/images/smilies/icon_twisted.gif0000644000000000000000000000035611077635520021222 0ustar rootrootGIF89aEEE*333m!,k DhɘВ$*>DE5@NG @ ꚱ- h> h)8T]°ij,c pّJ<G(F1|FZ(%Z#&(!;blogs/wp-includes/images/smilies/icon_redface.gif0000644000000000000000000000121211077635520021120 0ustar rootrootGIF89al[hhu҇isJEEE˃__H6{! NETSCAPE2.0!,f'MYWND'ڰьM@NnA`8]#c<P*ȈW[d|.8w @ mxD qj:<2ylR)<&D#!! , Q'~D8]0kHN.O\[͐ x H  ̓TAfPIxEhJTE!!2, H'NAJc3]j+WOT-$ERBgJ-ˑ%-3|nQu- ! , P'Ac:uX~n"A6;Fhl4C1`xf"05u0e|< PTADhJE!;blogs/wp-includes/images/smilies/icon_cool.gif0000644000000000000000000000025411077635520020470 0ustar rootrootGIF89a EEE! ,YIjUpCLAgpj k+;vECp4xevE+mAPiN X:o(`e6;blogs/wp-includes/images/smilies/icon_mad.gif0000644000000000000000000000025611077635520020277 0ustar rootrootGIF89a EEE! ,[IjեpLA'a'j *`pP9ĞAf-+`W A& ;`mXk\ 0ò&;blogs/wp-includes/images/smilies/icon_arrow.gif0000644000000000000000000000025211077635520020664 0ustar rootrootGIF89a EEE! ,WIjՕpELAgpj BUvsC; `"fs2([Lhբa~fX$;blogs/wp-includes/images/smilies/icon_mrgreen.gif0000644000000000000000000000053511077635520021175 0ustar rootrootGIF89aܱگخ֬ҩΦʢȡƟĞ}|yroli~e|dx`!',zP(Sqi( G$@s40t6EcQlx }8 %`$P!F E" E#E%t$\J&EFD%#"! QIJIA;blogs/wp-includes/images/smilies/icon_surprised.gif0000644000000000000000000000025611077635520021556 0ustar rootrootGIF89a EEE! ,[IjU"pILA''𦫆qj *pƂ ":=+`,@VvaA6XT0ò&;blogs/wp-includes/images/smilies/icon_smile.gif0000644000000000000000000000025611077635520020647 0ustar rootrootGIF89aEEE333!,[IjUpLA''vqj ?*pƂ!Ӣ X<+kYAb<v5Xj\ 0ò&;blogs/wp-includes/images/smilies/icon_cry.gif0000644000000000000000000000076211077635520020335 0ustar rootrootGIF89aEEE؁^^^! NETSCAPE2.0!,\ $AY(T.q 'CA+@An:AJaC" &8tp: 7tgUYj0x !N2Q)<&D#!!, $@HdҜM0lB! ,`@! , @&!! , @HdBI! , `dhB!! ,`@! , @&!! , @Hh "&i;blogs/wp-includes/images/smilies/icon_sad.gif0000644000000000000000000000025311077635520020302 0ustar rootrootGIF89a EEE! ,XIjՕpCLA'1%&p'*pnCk3 'pe= ߧN3 U&ݳL@7 3, m;blogs/wp-includes/images/smilies/icon_razz.gif0000644000000000000000000000026011077635520020517 0ustar rootrootGIF89aEEE333!,]IjեRpLA''𦫖qj *pƂJ" `<+kYa<v *~20̰,5;blogs/wp-includes/images/smilies/icon_lol.gif0000644000000000000000000000052011077635520020316 0ustar rootrootGIF89a EEE! NETSCAPE2.0! ,ZI jեR",AyhTr 1r)\aɎC%<DiJ-A v; Y-4jQ҅xn x1cd"! , I$[8ͫa4 D! ,PH9j! ,0H)j! ,PH9j! ,0H)j;blogs/wp-includes/images/smilies/icon_wink.gif0000644000000000000000000000025211077635520020502 0ustar rootrootGIF89a EEE! ,WIjՕpCLA'00%&p/*p`C%+fP4OpUł:`kLhբanfX$;blogs/wp-includes/images/smilies/icon_confused.gif0000644000000000000000000000025311077635520021341 0ustar rootrootGIF89a EEE! ,XIjՕpCLA''vqj ?*pƂ!\ 'pd/N3(^0-U&kQ@7 3,Km;blogs/wp-includes/images/smilies/icon_exclaim.gif0000644000000000000000000000035411077635520021157 0ustar rootrootGIF89aEEEuŵ///qoWrpXJG)mkSSO&!,i`'AYhW6q'܂Ak' NG:@!n;"/` tZ(v 8θ,n RپIFr9;})%U)<&#!;blogs/wp-includes/images/smilies/icon_idea.gif0000644000000000000000000000026011077635520020433 0ustar rootrootGIF89a EEE! ,]I jUR"pL@g 0R;~C%q2d|>ORԌݶ(¢VhB 3 ̰,p;blogs/wp-includes/images/smilies/icon_rolleyes.gif0000644000000000000000000000074511077635520021377 0ustar rootrootGIF89a EEE! NETSCAPE2.0! ,^I jUpL@'g𦫆E:%\PtdPA^;( 0=c2yO J>`c`@ia(fX5! , YVؠg! , F嬳Ԧ.!2 , P$-'! ,  "! , Fe+0ZE! , I!2T]U*B)@LMZXYr! , I%[8WA'&1^! , I!8K[BhPH(F;blogs/wp-includes/images/smilies/icon_biggrin.gif0000644000000000000000000000025411077635520021155 0ustar rootrootGIF89a EEE! ,YI jե"pIL@gpj)wjʛ pJQl:`J PJ4ZNB oYbe6;blogs/wp-includes/images/html.png0000644000000000000000000000103111077635520016034 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<`PLTEeeeɐԦشzzz2 OIDATxl۶E aCk-,,t0egeSe- RjNa<JS["/L}&ۛ+h۶HTg@a`7PZp)eO`p%+yiE/OήƓ)IENDB`blogs/wp-includes/images/bullet_arrow_down.gif0000644000000000000000000000026011046077143020601 0ustar rootrootGIF89a![̮"^ [$`#\‹|~V!,-&dihlfU@&:pCjhtJ5;blogs/wp-includes/images/js.png0000644000000000000000000000100511077635520015505 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<`PLTEeeeæΐ洴zzz\u;IDATxlY @QGBDH $x,X36Wk+Z0-DZྰf5FδkA۶9"ω/ƵڭQ(G_`\}io?@[)'Q!bBem=wM@۶91'Z_D~@N 躮X}E $f$`RoBH<MO zD8eRsMI `g3\< Q~҃SqÆsATPJU8{wj?pO].gȃt$,_şyIENDB`blogs/wp-includes/images/css.png0000644000000000000000000000102511077635520015663 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<`PLTEeeeꦦؐ洴zzz9KIDATxlْ @Qqa1_N}:EC*YTv], cfmbT Ť5}8QHZ3VN)zԑ'h0/f|Kr4Ǻ3;bRcVW}o.LQb|Z 9UUQRжmQ+ f17cD8鿄 M)\aeߊI fBȱ1h K6S0x0໑S>u4l(=Wk.;8զm(.~}ot'\`ūIENDB`blogs/wp-includes/images/default.png0000644000000000000000000000073711077635520016530 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<`PLTEeeeꦦ洴zzz] IDATxl aRƐ 8E>ϊl *I?P:0h!PR,bk9$`̍0"Ak-#Q$d̉A ŽZqFQNg >@])g b] pΗe F@]:XkDbB=c?ؑ92m:4 ! 1@67& 7(%GMsK 4xҧ,"]@~>[2, Q;IENDB`blogs/wp-includes/images/wlw/0000755000000000000000000000000011046077143015175 5ustar rootrootblogs/wp-includes/images/wlw/wp-comments.png0000644000000000000000000000264211077635520020163 0ustar rootrootPNG  IHDRw=gAMA7tEXtSoftwareAdobe ImageReadyqe<4IDATxڴVoEfw~q[N$5}p(RD%+\s? J VV"RhpMC";ib;~kwgff=N@pif'~cC<σo P#pyT#B\uyg"Hcۆȫo-(H\zRi<)Qg" ҵܣ_:ub>QΔ ;:(lv6wugG>A,H$MqնjCтZN8d25hR"'O|rCOLAzO u4UEK2 Bimֵ^s˦ /T ҭ"iJ2`dn WbEB~jDTPO|&X\eޚ-8yVLѭ!<"tZ'VGJΈ&k6ujgJ )ULE/!yRs^zq{Ǐw-mϥ;]'6]B%/ƲUz4a V6?&72ў_Myy-jЭJe x9uwpًg#ҢPV7b22:'F"إ{oqCLT ku[!\X\E65={iT|8Bf`7 t44pz.2DцDm7!3M]J6T-U:qnR)kҥK:i_\Ḫ*ٵMv:T~c4Mv0t9ױ)vm˲ ʍRd_vnrG&ti (\GF2qs4@0N_pG6MgAJ؟"r9/ 6heY:99hY$LMMؓ_wu(0IENDB`blogs/wp-includes/images/wlw/wp-icon.png0000644000000000000000000000141311077635520017261 0ustar rootrootPNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxlSkQ~5ulh56RSmKZ6ui?~zPXB1_|GlSAp–oSf6teEs?Ϲs;<C^?,}R,X|xdtDݷtj4E@pnT]8ߡh0OR a|¢sbE}xv|Sݭ4#ΐD&17$N#O4MI]N:7z=ep=`;0CgccPYSSSCCC,j5%+1g+@"DL@P(0++++S$u<1|`$r X@ L&J]]F,ccZJ_s/ RXH#[3{kk_ =.Jsxhu9 ޷h#R!fss=~@T]})(.$x4#C H[j*Op8oA2`:|d<bi\Krc,:nk4-?  `J%LϘc73)EDQvy1]1/,1jyv~U4 #4m/bIENDB`blogs/wp-includes/images/wlw/wp-watermark.png0000644000000000000000000002013011077635520020323 0ustar rootrootPNG  IHDRTTkgAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxdUL]P$AE+HT"P cB2Hň J̢bV]g,ZRWսo~'ܷCk]kIk joqH555Uu:hT ,&''nWm?ˇ]s[o馛osíVgٙ~w&&&:nig-yЃ` 3… +1?Q{f|hghh|VZo&v̢!Uw ǂ~{?w>{o _hЎ }sjmyۏzԣ b۹͆> k[L ܃63\8pW_=tmBVwݪ>e=Q=(K2?~OSl2nmf|+>@y1ON{^erY $}CԸя~4zW^ve[nPMCxD[=_釅I}@ >ַgՏFs^s{ъ[W%qR˘]gu݈}_ёOxw߽|C@8rٲe }K_l nN˶!8RPTJ_e3{-Z4a#nK29v;j(8rؒ%Ka\J޻UOzғ w jAN7\ƷӞy? 3l(wSz_n]wmvaScܐ AEsLNaLg]mF>ώ ?O:*qF ϲKV?Oo7YXڨ6pB-آ|ͫГju-ch}C9St-gOo_3Xj9{y{yJ<B7Y~pSNixWO`1_]qgs3qQ{]-^zcS/ni`b.HT9$c^1?Wr u]]zׂ}k w\[UXcXx/6{=.Հ"/7ٞg(e_׫c9 '{챓xdjLEP@\"! 뱣ͫjG9_jmӟCѣ^xaO|V$!dǑ\ߘ̄;1H Yt_uY_C=tro'\~Abe &D "-Eի^"vp#` Yr|O#\&3߽ګz_\ԁ*de_+T26nQ! GA'N/}K7ӆwT_~yuq?cSS]gSM\ aC) O}S[(k]pvvUQ]ᏈsݔbךG=裏.FA=j+Zxe oc]󽺘wu*fN(u,[ 2@Ù[ouA p fb8tk m4A!Bb-Dg".ox  ~z!/a~moJJQBu/p즛nZp 2C҈ xnvP >t9qAvs$/8#Py2a:E߼oN<D2C2s+@3KL%b7v}CRWmmnꤓN*;pX0T{pm9u(:Ew"E/ZhqugegA|y9Sr,!Fk4̪ɱFp";΂B (\3̀X|S>2X&P5fOi12|)tE~$&21p|ݯcpG?2ˀX.ãAQιe2F@Lt<|+^Q10Rq'p82R׷j3b$FP &Ehh 171h)%XHz;%up=^W.%߈72x&ր{=v[Dz $(`;7~y獱[Xtĝ{83Wo}sܯkG:[t]V%d8r}n%0p)oak_n,ոi䫎Rn{c% sALp'<+s ~/!|.n^cgFc-* ԍEvznBD/yKscrKCU(S,C\sXX& ΀(A6۬&ڲ $d7h"R \^|, ڰ` 7F{r&v{0>ťEHJ3ozMg.땯|eկ~OI nfȯDPX@X%K}tA1 _qLh#ϐv!}x%xA;K[ǷVW*5"H0̼믿"lybX,ja//46llŭmE}L ܰ$PІ}Dd.ab:T:2X]vY RFw€ԍ@DP֪Pof=i3 q珊J S?( &Ȼ0U7a7 wQ KgAB/UoqPq`?8L؄pg&o&lP 4s2. R94n!GEpo}-t I69 j-5z%4錀-:K%lOjy7?yY8S- 2Ҳ;鈴sLރcY maxmϲ FaQGuI~{x} j 6+@0&O~pbd6s l+X\Ȍ%4U8&䰝vکY:d'SN)*B.gW g +pFD2 ڍM6ひ}hp$mvZu饗bGDfzr>9'Gme\TjH.{˦`< 1IK7}<kU eܼkЏt 6/rX/֘$-QrP${-4lM3.f~~1PE=(3u@>W }K_*gPϡ930(#@ Q&a]~Q 2=}Sҳ.</9?M@Pu^V97UHبft]Zpt/ke3ꪑU +-e>#n d q9(rT/{*N8~A E&Em;+_J4-qjgĄOAzN;qeRٹ"/ VOā!JѦ97|0!t`y1 beqeTO7#ϻ|Xӊ}8Tq0.ͱ~g#k A 4Jq@zDH1p8(lYN&0VME d&hsեZt-z}xH__H 2JR:XÚa[{' 61YG>Y + @\MsT$9|3Y'3LzPHIZΪyHfݯIM'iE~o6M>g[%9uԍ#:VM @݆*9T"ZT/MB0~]@ A3tHBI,z  q\4t >WtFzS2-+^^FƜuZ#Li]X=CYh6){F+gDśxEnƛ}:4e=DoCE MaLY^Wl(ꙶ5b_Ίhc mژ ]hrMFUR-Ct6#Fe''&E4\iѣ ͆Iš3MJ`C%HI1 ;>]i#@H=meCM91 7M_XkD4J|ŝ%ȡz3rKֽd^I1_tXZ!W^yeQp;(ʮ \utHd #cxNnNj@*"@W)]Dÿ-t`,nN3V[λ  5v6DBr O}S˿!gQ4W5z,\#cMHUلn^L4sYZ4v@`.ssGu`āVLH,$M![zU0΀D0q$BĜ2Lgg &S0?)Ky qMaG$(g'1|W(k8WI^s5e t 3p{u="-X_.3丁Xz_iR1`H Y,˭WD>t@.t@~rXHD_8g-[ab@w1ٴ# FCbG\ӚF!/y_ ssbPtDhWCS|T/zZ2?2Y&[`D46Lp8T[)RʹY:<q0'6Rw|`]! ^#2cpv\)Q.l1`ADX"q,Iٍ@AEAuUB f9K8^n&u ̬E>l6CFЊ Mi l[9‚px _FA([\B d0Gi4/qG _ }A{E RPFI6J$$ ZO%ϷiCE\|ŅMV@Vntq DhxV`/maLTNEyˌ#A_zau/kL1d,I2zTO iYm1v̳]"ϢcBC9ET-$ E3$\r%=aȰuKe3BI`C|"vʭ n-Tg>󙽊\Y:rg=[Oϳ^b{W+8 [߃_*k8Ν>${rV wX\LFsH`9bhe,̼t7=œ @"Z0}L!b g}.[\tD 7\óp'Ffrk>aJQ!3KWpm}^ؔ-fdpj}mi@v8 K?9.@%op\d4|U` )oz_gab|;)*mP: "Saɒ%%[!#imz xCdFCu{]P"PX*ۜ:[G;}MɐNv8*!>e[Y4\`E{e,Gq ݜ=dʥgL6WgK]dBU8T[gL!:!U}xHB@[KEPPt \=`4mU}oݤk^!3Q_C;>sKd$,w>'4̴euYfG{XWqU"4xn ́eY膞9餓VxG믰i:#>-5 vEr5TL˛\9ʳV:R#GA.CgB`u< ;׭k\pf[mYg5QkQn9Dgl!!,`qX8^):'7x㎜uEPv ڡs|-$T:>$Bhtኢ BDA22?l\&8tUCgÁl6i]zx!E~Vzi%.sc(nV"qh_ A)܁0$E,ua.њFrn]*7Rk^s侞e9ҿe9fBc';3A!>4 yxh?,uQғμ^o =*B S_}p*^aldv\k7}K_W Apgwy"&ˉz",Dʉxn" D<3nDXr/&BeLN˳|b{W/A /|\x̉{b&¥/:tXiܤINs}VY㾍 Nt8KCgeXNIDIp kZD6Dp'o[{g+كC9.CPP-ea馛 W\18yQ8~,5p3~6LB}p3z.Z>tVN ?ye{Fs|xNf믿ɉ~cEs%nZEAi)o&|qh~)d߿Wd&[y` G7B6o/Icv]SwBegw `X08~[=עkkZ%]?:,vzIENDB`blogs/wp-includes/images/rss.png0000644000000000000000000000641511077635520015712 0ustar rootrootPNG  IHDRH- pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-gAMA|Q cHRMz%u0`:o_F(IDATxڌOHTQ&^4H(0"Th-ZԢ]mpT $E-29X:{B,ߏw$maX6FMkhw, 4T:(1o %JK&{19X T!v+b *(hr@:Z81szRvH57v@cѻ~ 5`+`| VXʮG.&<Ї5lu-5=%|@{'RwQz߇-.n"&:*^]+ Bŧ+O7tQŧ#x~v6f᝼B(7Ju}a4-cCIh 1U0Qi'^BAq#6pmةE$OWjBZ# ʫJtCN dSgh7}ZJL%qqa.'Qh&\@ ,)CyH#~ӝ&Oc@GIENDB`blogs/wp-includes/images/tar.png0000644000000000000000000000240011077635520015657 0ustar rootrootPNG  IHDR DtEXtSoftwareAdobe ImageReadyqe<PLTEmmm$$$+++WWWyyyࢢձ◗bbb;;;Ϛل111KKKəႂ{{{999ooo!!!ď򣣣-0-̆___qqq䬬...ccc;;9rrrQQQtttaaa|||---[[[ppp赵lllkkkTTT:::<<<&&&///≉F+zIDATxtus@-[qO\ݽWﹻ 4s;o^О\`ъgIsɘmm[T׮RGHhoL}VN|]^hJOyNx3T+ѳD> c91 y㛶{n55^[F8QiA2m汁&,czWtCS:x ,A ݙ`ggå;LJpNݗITw/2_rQsᤏ|لH߯QZ$o(s~|3yP,@E$|_s]d,G}gMPĺwWGhBsQMGKL2)X:sGeɏA[<<#YAE+f3N,˳G 09S ,t8S^@=8Rܫ`'9BN($qPSQs&=n^s<}p  <[n AX*փXϲ k?b*RVL2¬ſYM<jSm8YEtH-^?@HRTN 80ẃ̓{*߯?`j^IENDB`blogs/wp-includes/images/wordpress-mu.png0000644000000000000000000000576711077635520017563 0ustar rootrootPNG  IHDRM@՜gAMA7tEXtSoftwareAdobe ImageReadyqe<]PLTEDDDDiAf"N3\ֻ䙙"""w333UwwwwfffUUU3tRNSv IDATxbd@EnbdA" C64h$(rh MY8 @'4 03H    }È@9 B $ـS %4A G$,):8C )YAL <(rrrh0JJr `Nr1*^>l9|tZNfc< BSp0w`C >0 䠮{0M6p!f @ HŤ,'$*TH084E1BS[x'@A Լ޴)ǂ%r) .4L!칖_f~>'24 e'` Mb@I5 vaA$24 ` M9SkV. BIlhC`+9)HaX.6P dYhr%BŰ7*4嘱 0 { z W @'@1V8,rXI,X Z2,4Dǖ Ѻ(#x, K V򊳰Xe%;4aO~iffƓx sD,\@)Z#2QBBaaBmSqÈ |FJfhKy<"`={,%(cS"$u LV|K,H8@ęx Z`e@H MaX-;l V݋lR%v;;0j pcBˢЁ$!La>Ԫ|ddE-|?XLڹ&+/# 2ipc%!DXS!42#H{P C+;:B Ї 8bAÊԛ/d`<R"24E P! ȁ LĂȽ{PoA*H Mb@m` XTO#bbB, aV80Y1G&dR8H 9~`(pKueGζl K Ā9A# A04KqDžz#7Ax\uGh J=&*k  MpfG"--#$&@1`A.da&x@ XBDXFz@71B #GX9IY)d45l)Hp@YA"DH Mb-u 2<'J&?4eI Ma)6 i66v-4EZOX?y1τ]04-RhW`N(c Āi2zMB+<4K0@H Mb&F9|*u ,':<5CQiԦn B @ ؛i:}k!M>V=6W`nh2=t H Mp&+4Oz62/6F~_zj$sО B @΄C q$1/Lulc$Nj&?YbnfpF4pJMb'Bct|8vXQ,Ξ%zDŻP~58% @aq&l\8FRt`y0s2R34 37ДF7Av|ř N|Xao󢬴-, UC:, I~tI@f偻W 8kf^ZPw(Y82L 0Q!!`+<2ʎjEKO9,$!+@"]{ǪVDwc^s.J⃹Wbp] Iᨑe٠ ZGMlp8%`cd:Fpၖt\,-4yAliHŇR!LXL=4p¦D`[';L;l>Ҡ:ʈ0?p)p4@;F@a-Xy$>p*XF-)Q1DCv8z)A]WBT]$JpbGa/@)rR~8$ 4Ȅ{i6'-\uHelzxS-!AɊ2@xV [A34DmBcFa' !x`hؖfkj!M@bB<\p-db_connect(); return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); } /** * Connects to the database server and selects a database * * PHP5 style constructor for compatibility with PHP5. Does * the actual setting up of the class properties and connection * to the database. * * @since 2.0.8 * * @param string $dbuser MySQL database user * @param string $dbpassword MySQL database password * @param string $dbname MySQL database name * @param string $dbhost MySQL database host */ function __construct($dbuser, $dbpassword, $dbname, $dbhost) { register_shutdown_function(array(&$this, "__destruct")); if ( defined('WP_DEBUG') and WP_DEBUG == true ) $this->show_errors(); $this->charset = 'utf8'; if( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' ) { $this->collate = constant( 'DB_COLLATE' ); } else { $this->collate = 'utf8_general_ci'; } if ( defined('DB_CHARSET') ) $this->charset = DB_CHARSET; if ( defined('DB_COLLATE') ) $this->collate = DB_COLLATE; $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true); if (!$this->dbh) { $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at %s. This could mean your host's database server is down.

    • Are you sure you have the correct username and password?
    • Are you sure that you have typed the correct hostname?
    • Are you sure that the database server is running?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    "/*/WP_I18N_DB_CONN_ERROR*/, $dbhost)); return; } $this->ready = true; if ( $this->supports_collation() ) { $collation_query = ''; if ( !empty($this->charset) ) { $collation_query = "SET NAMES '{$this->charset}'"; if (!empty($this->collate) ) $collation_query .= " COLLATE '{$this->collate}'"; } if ( !empty($collation_query) ) $this->query($collation_query); } $this->select($dbname, $this->dbh); } /** * PHP5 style destructor and will run when database object is destroyed. * * @since 2.0.8 * * @return bool Always true */ function __destruct() { return true; } /** * Sets the table prefix for the WordPress tables. * * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to * override the WordPress users and usersmeta tables. * * @since 2.5.0 * * @param string $prefix Alphanumeric name for the new prefix. * @return string Old prefix */ function set_prefix($prefix) { if ( preg_match('|[^a-z0-9_]|i', $prefix) ) return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/); $old_prefix = $this->base_prefix; $this->base_prefix = $prefix; foreach ( $this->global_tables as $table ) $this->$table = $prefix . $table; if ( empty($this->blogid) ) return $old_prefix; $this->prefix = $this->base_prefix . $this->blogid . '_'; foreach ( $this->blog_tables as $table ) $this->$table = $this->prefix . $table; if ( defined('CUSTOM_USER_TABLE') ) $this->users = CUSTOM_USER_TABLE; if ( defined('CUSTOM_USER_META_TABLE') ) $this->usermeta = CUSTOM_USER_META_TABLE; return $old_prefix; } function set_blog_id($blog_id, $site_id = '') { if ( !empty($site_id) ) $this->siteid = $site_id; $old_blog_id = $this->blogid; $this->blogid = $blog_id; $this->prefix = $this->base_prefix . $this->blogid . '_'; foreach ( $this->blog_tables as $table ) $this->$table = $this->prefix . $table; return $old_blog_id; } /** * Selects a database using the current database connection. * * The database name will be changed based on the current database * connection. On failure, the execution will bail and display an DB error. * * @since 0.71 * * @param string $db MySQL database name * @return null Always null. */ function select($db, &$dbh) { if (!@mysql_select_db($db, $dbh)) { $this->ready = false; $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'

    Can’t select database

    We were able to connect to the database server (which means your username and password is okay) but not able to select the %1$s database.

    • Are you sure it exists?
    • Does the user %2$s have permission to use the %1$s database?
    • On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?

    If you don\'t know how to setup a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

    '/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER)); return; } } /** * Escapes content for insertion into the database, for security * * @since 0.71 * * @param string $string * @return string query safe string */ function escape($string) { return addslashes( $string ); // Disable rest for now, causing problems /* if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) return mysql_escape_string( $string ); else return mysql_real_escape_string( $string, $this->dbh ); */ } /** * Escapes content by reference for insertion into the database, for security * * @since 2.3.0 * * @param string $s */ function escape_by_ref(&$s) { $s = $this->escape($s); } /** * Prepares a SQL query for safe use, using sprintf() syntax. * * @link http://php.net/sprintf See for syntax to use for query string. * @since 2.3.0 * * @param null|string $args If string, first parameter must be query statement * @param mixed $args,... If additional parameters, they will be set inserted into the query. * @return null|string Sanitized query string */ function prepare($args=null) { if ( is_null( $args ) ) return; $args = func_get_args(); $query = array_shift($args); $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it $query = str_replace('"%s"', '%s', $query); // doublequote unquoting $query = str_replace('%s', "'%s'", $query); // quote the strings array_walk($args, array(&$this, 'escape_by_ref')); return @vsprintf($query, $args); } /** * Print SQL/DB error. * * @since 0.71 * @global array $EZSQL_ERROR Stores error information of query and error string * * @param string $str The error to display * @return bool False if the showing of errors is disabled. */ function print_error($str = '') { global $EZSQL_ERROR; if (!$str) $str = mysql_error($this->dbh); $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str); if ( $this->suppress_errors ) return false; if ( $caller = $this->get_caller() ) $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller); else $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query); $log_error = true; if ( ! function_exists('error_log') ) $log_error = false; $log_file = @ini_get('error_log'); if ( !empty($log_file) && ('syslog' != $log_file) && !is_writable($log_file) ) $log_error = false; if ( $log_error ) @error_log($error_str, 0); // Is error output turned on or not.. if ( !$this->show_errors ) return false; // If there is an error then take note of it $msg = "WordPress database error: [$str]\n{$this->query}\n"; if( defined( 'ERRORLOGFILE' ) ) error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) ); if( defined( 'DIEONDBERROR' ) ) die( $msg ); } /** * Enables showing of database errors. * * This function should be used only to enable showing of errors. * wpdb::hide_errors() should be used instead for hiding of errors. However, * this function can be used to enable and disable showing of database * errors. * * @since 0.71 * * @param bool $show Whether to show or hide errors * @return bool Old value for showing errors. */ function show_errors( $show = true ) { $errors = $this->show_errors; $this->show_errors = $show; return $errors; } /** * Disables showing of database errors. * * @since 0.71 * * @return bool Whether showing of errors was active or not */ function hide_errors() { $show = $this->show_errors; $this->show_errors = false; return $show; } /** * Whether to suppress database errors. * * @param unknown_type $suppress * @return unknown */ function suppress_errors( $suppress = true ) { $errors = $this->suppress_errors; $this->suppress_errors = $suppress; return $errors; } /** * Kill cached query results. * * @since 0.71 */ function flush() { $this->last_result = array(); $this->col_info = null; $this->last_query = null; } function db_connect( $query = "SELECT" ) { global $db_list, $global_db_list; if( is_array( $db_list ) == false ) return true; if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) { $action = 'global'; $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ]; $this->db_global = $details; } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) { $action = 'write'; $details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ]; $this->db_write = $details; } else { $action = ''; $details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ]; $this->db_read = $details; } $dbhname = "dbh" . $action; $this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] ); if (!$this->$dbhname ) { $this->bail("

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at $dbhost. This could mean your host's database server is down.

    • Are you sure you have the correct username and password?
    • Are you sure that you have typed the correct hostname?
    • Are you sure that the database server is running?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    "); } $this->select( $details[ 'db_name' ], $this->$dbhname ); } /** * Perform a MySQL database query, using current database connection. * * More information can be found on the codex page. * * @since 0.71 * * @param string $query * @return unknown */ function query($query) { if ( ! $this->ready ) return false; // filter the query, if filters are available // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method if ( function_exists('apply_filters') ) $query = apply_filters('query', $query); // initialise return $return_val = 0; $this->flush(); // Log how the function was called $this->func_call = "\$db->query(\"$query\")"; // Keep track of the last query for debug.. $this->last_query = $query; // Perform the query via std mysql_query function.. if ( defined('SAVEQUERIES') && SAVEQUERIES ) $this->timer_start(); // use $this->dbh for read ops, and $this->dbhwrite for write ops // use $this->dbhglobal for gloal table ops unset( $dbh ); if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) { if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) { if( false == isset( $this->dbhglobal ) ) { $this->db_connect( $query ); } $dbh =& $this->dbhglobal; $this->last_db_used = "global"; } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) { if( false == isset( $this->dbhwrite ) ) { $this->db_connect( $query ); } $dbh =& $this->dbhwrite; $this->last_db_used = "write"; } else { $dbh =& $this->dbh; $this->last_db_used = "read"; } } else { $dbh =& $this->dbh; $this->last_db_used = "other/read"; } $this->result = @mysql_query($query, $dbh); ++$this->num_queries; if ( defined('SAVEQUERIES') && SAVEQUERIES ) $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() ); // If there is an error then take note of it.. if( $dbh ) { if ( mysql_error( $dbh ) ) { $this->print_error( mysql_error( $dbh )); return false; } } if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) { $this->rows_affected = mysql_affected_rows($dbh); // Take note of the insert_id if ( preg_match("/^\\s*(insert|replace) /i",$query) ) { $this->insert_id = mysql_insert_id($dbh); } // Return number of rows affected $return_val = $this->rows_affected; } else { $i = 0; while ($i < @mysql_num_fields($this->result)) { $this->col_info[$i] = @mysql_fetch_field($this->result); $i++; } $num_rows = 0; while ( $row = @mysql_fetch_object($this->result) ) { $this->last_result[$num_rows] = $row; $num_rows++; } @mysql_free_result($this->result); // Log number of rows the query returned $this->num_rows = $num_rows; // Return number of rows selected $return_val = $this->num_rows; } return $return_val; } /** * Insert an array of data into a table. * * @since 2.5.0 * * @param string $table WARNING: not sanitized! * @param array $data Should not already be SQL-escaped * @return mixed Results of $this->query() */ function insert($table, $data) { $data = add_magic_quotes($data); $fields = array_keys($data); return $this->query("INSERT INTO $table (`" . implode('`,`',$fields) . "`) VALUES ('".implode("','",$data)."')"); } /** * Update a row in the table with an array of data. * * @since 2.5.0 * * @param string $table WARNING: not sanitized! * @param array $data Should not already be SQL-escaped * @param array $where A named array of WHERE column => value relationships. Multiple member pairs will be joined with ANDs. WARNING: the column names are not currently sanitized! * @return mixed Results of $this->query() */ function update($table, $data, $where){ $data = add_magic_quotes($data); $bits = $wheres = array(); foreach ( array_keys($data) as $k ) $bits[] = "`$k` = '$data[$k]'"; if ( is_array( $where ) ) foreach ( $where as $c => $v ) $wheres[] = "$c = '" . $this->escape( $v ) . "'"; else return false; return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) ); } /** * Retrieve one variable from the database. * * This combines the functionality of wpdb::get_row() and wpdb::get_col(), * so both the column and row can be picked. * * It is possible to use this function without executing more queries. If * you already made a query, you can set the $query to 'null' value and just * retrieve either the column and row of the last query result. * * @since 0.71 * * @param string $query Can be null as well, for caching * @param int $x Column num to return * @param int $y Row num to return * @return mixed Database query results */ function get_var($query=null, $x = 0, $y = 0) { $this->func_call = "\$db->get_var(\"$query\",$x,$y)"; if ( $query ) $this->query($query); // Extract var out of cached results based x,y vals if ( !empty( $this->last_result[$y] ) ) { $values = array_values(get_object_vars($this->last_result[$y])); } // If there is a value return it else return null return (isset($values[$x]) && $values[$x]!=='') ? $values[$x] : null; } /** * Retrieve one row from the database. * * @since 0.71 * * @param string $query SQL query * @param string $output ARRAY_A | ARRAY_N | OBJECT * @param int $y Row num to return * @return mixed Database query results */ function get_row($query = null, $output = OBJECT, $y = 0) { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; if ( $query ) $this->query($query); else return null; if ( !isset($this->last_result[$y]) ) return null; if ( $output == OBJECT ) { return $this->last_result[$y] ? $this->last_result[$y] : null; } elseif ( $output == ARRAY_A ) { return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null; } elseif ( $output == ARRAY_N ) { return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null; } else { $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/); } } /** * Retrieve one column from the database. * * @since 0.71 * * @param string $query Can be null as well, for caching * @param int $x Col num to return. Starts from 0. * @return array Column results */ function get_col($query = null , $x = 0) { if ( $query ) $this->query($query); $new_array = array(); // Extract the column values for ( $i=0; $i < count($this->last_result); $i++ ) { $new_array[$i] = $this->get_var(null, $x, $i); } return $new_array; } /** * Retrieve an entire result set from the database. * * @since 0.71 * * @param string|null $query Can also be null to pull from the cache * @param string $output ARRAY_A | ARRAY_N | OBJECT_K | OBJECT * @return mixed Database query results */ function get_results($query = null, $output = OBJECT) { $this->func_call = "\$db->get_results(\"$query\", $output)"; if ( $query ) $this->query($query); else return null; if ( $output == OBJECT ) { // Return an integer-keyed array of row objects return $this->last_result; } elseif ( $output == OBJECT_K ) { // Return an array of row objects with keys from column 1 // (Duplicates are discarded) foreach ( $this->last_result as $row ) { $key = array_shift( get_object_vars( $row ) ); if ( !isset( $new_array[ $key ] ) ) $new_array[ $key ] = $row; } return $new_array; } elseif ( $output == ARRAY_A || $output == ARRAY_N ) { // Return an integer-keyed array of... if ( $this->last_result ) { $i = 0; foreach( $this->last_result as $row ) { if ( $output == ARRAY_N ) { // ...integer-keyed row arrays $new_array[$i] = array_values( get_object_vars( $row ) ); } else { // ...column name-keyed row arrays $new_array[$i] = get_object_vars( $row ); } ++$i; } return $new_array; } } } /** * Retrieve column metadata from the last query. * * @since 0.71 * * @param string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill * @param int $col_offset 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type * @return mixed Column Results */ function get_col_info($info_type = 'name', $col_offset = -1) { if ( $this->col_info ) { if ( $col_offset == -1 ) { $i = 0; foreach($this->col_info as $col ) { $new_array[$i] = $col->{$info_type}; $i++; } return $new_array; } else { return $this->col_info[$col_offset]->{$info_type}; } } } /** * Starts the timer, for debugging purposes. * * @since 1.5.0 * * @return bool Always returns true */ function timer_start() { $mtime = microtime(); $mtime = explode(' ', $mtime); $this->time_start = $mtime[1] + $mtime[0]; return true; } /** * Stops the debugging timer. * * @since 1.5.0 * * @return int Total time spent on the query, in milliseconds */ function timer_stop() { $mtime = microtime(); $mtime = explode(' ', $mtime); $time_end = $mtime[1] + $mtime[0]; $time_total = $time_end - $this->time_start; return $time_total; } /** * Wraps fatal errors in a nice header and footer and dies. * * @since 1.5.0 * * @param string $message * @return unknown */ function bail($message) { if ( !$this->show_errors ) { if ( class_exists('WP_Error') ) $this->error = new WP_Error('500', $message); else $this->error = $message; return false; } wp_die($message); } /** * Whether or not MySQL database is minimal required version. * * @since 2.5.0 * @uses $wp_version * * @return WP_Error */ function check_database_version() { global $wp_version; // Make sure the server has MySQL 4.0 $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh)); if ( version_compare($mysql_version, '4.0.0', '<') ) return new WP_Error('database_version',sprintf(__('ERROR: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version)); } /** * Whether of not the database version supports collation. * * Called when WordPress is generating the table scheme. * * @since 2.5.0 * * @return bool True if collation is supported, false if version does not */ function supports_collation() { return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ); } /** * Retrieve the name of the function that called wpdb. * * Requires PHP 4.3 and searches up the list of functions until it reaches * the one that would most logically had called this method. * * @since 2.5.0 * * @return string The name of the calling function */ function get_caller() { // requires PHP 4.3+ if ( !is_callable('debug_backtrace') ) return ''; $bt = debug_backtrace(); $caller = ''; foreach ( $bt as $trace ) { if ( @$trace['class'] == __CLASS__ ) continue; elseif ( strtolower(@$trace['function']) == 'call_user_func_array' ) continue; elseif ( strtolower(@$trace['function']) == 'apply_filters' ) continue; elseif ( strtolower(@$trace['function']) == 'do_action' ) continue; $caller = $trace['function']; break; } return $caller; } } if ( ! isset($wpdb) ) { /** * WordPress Database Object, if it isn't set already in wp-content/wpdb.php * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database * @since 0.71 */ $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); } if ( ! isset($wpdbs11) ) { $wpdbs11 = new wpdb('moviem','907sines','custdat','s11.moviemail-online.co.uk'); } ?> blogs/wp-includes/js/0000755000000000000000000000000011046077143013533 5ustar rootrootblogs/wp-includes/js/wp-lists.js0000644000000000000000000002663411077635520015671 0ustar rootroot(function($) { var currentFormEl = false; var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}; var wpList = { settings: { url: wpListL10n.url, type: 'POST', response: 'ajax-response', what: '', alt: 'alternate', altOffset: 0, addColor: null, delColor: null, dimAddColor: null, dimDelColor: null, confirm: null, addBefore: null, addAfter: null, delBefore: null, delAfter: null, dimBefore: null, dimAfter: null }, nonce: function(e,s) { var url = wpAjax.unserialize(e.attr('href')); return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0; }, parseClass: function(e,t) { var c = [], cl; try { cl = $(e).attr('class') || ''; cl = cl.match(new RegExp(t+':[A-Za-z0-9:_=-]+')); if ( cl ) { c = cl[0].split(':'); } } catch(r) {} return c; }, pre: function(e,s,a) { var bg; var r; s = $.extend( {}, this.wpList.settings, { element: null, nonce: 0, target: e.get(0) }, s || {} ); if ( $.isFunction( s.confirm ) ) { if ( 'add' != a ) { bg = $('#' + s.element).css('backgroundColor'); $('#' + s.element).css('backgroundColor', '#FF9966'); } r = s.confirm.call(this,e,s,a,bg); if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); } if ( !r ) { return false; } } return s; }, ajaxAdd: function( e, s ) { var list = this; e = $(e); s = s || {}; var cls = wpList.parseClass(e,'add'); s = wpList.pre.call( list, e, s, 'add' ); s.element = cls[2] || e.attr( 'id' ) || s.element || null; if ( cls[3] ) { s.addColor = '#' + cls[3]; } else { s.addColor = s.addColor || '#FFFF33'; } if ( !s ) { return false; } if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); } if ( !s.element ) { return true; } s.action = 'add-' + s.what; s.nonce = wpList.nonce(e,s); var es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]'); var valid = wpAjax.validateForm( '#' + s.element ); if ( !valid ) { return false; } s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) ); var formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize(); if ( formData ) { s.data += '&' + formData; } if ( $.isFunction(s.addBefore) ) { s = s.addBefore( s ); if ( !s ) { return true; } } if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; } s.success = function(r) { var res = wpAjax.parseAjaxResponse(r, s.response, s.element); if ( !res || res.errors ) { return false; } if ( true === res ) { return true; } jQuery.each( res.responses, function() { wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue pos: this.position || 0, id: this.id || 0, oldId: this.oldId || null } ) ); } ); if ( $.isFunction(s.addAfter) ) { var o = this.complete; this.complete = function(x,st) { var _s = $.extend( { xml: x, status: st, parsed: res }, s ); s.addAfter( r, _s ); if ( $.isFunction(o) ) { o(x,st); } }; } list.wpList.recolor(); wpList.clear.call(list,'#' + s.element); }; $.ajax( s ); return false; }, ajaxDel: function( e, s ) { var list = this; e = $(e); s = s || {}; var cls = wpList.parseClass(e,'delete'); s = wpList.pre.call( list, e, s, 'delete' ); s.element = cls[2] || s.element || null; if ( cls[3] ) { s.delColor = '#' + cls[3]; } else { s.delColor = s.delColor || '#FF3333'; } if ( !s || !s.element ) { return false; } s.action = 'delete-' + s.what; s.nonce = wpList.nonce(e,s); s.data = $.extend( { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce }, wpAjax.unserialize( cls[4] || '' ) ); if ( $.isFunction(s.delBefore) ) { s = s.delBefore( s ); if ( !s ) { return true; } } if ( !s.data._ajax_nonce ) { return true; } var element = $('#' + s.element); if ( 'none' != s.delColor ) { var anim = 'slideUp'; if ( element.css( 'display' ).match(/table/) ) anim = 'fadeOut'; // Can't slideup table rows and other table elements. Known jQuery bug element .animate( { backgroundColor: s.delColor }, 'fast' )[anim]( 'fast' ) .queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); } else { list.wpList.recolor(); } s.success = function(r) { var res = wpAjax.parseAjaxResponse(r, s.response, s.element); if ( !res || res.errors ) { element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); return false; } if ( $.isFunction(s.delAfter) ) { var o = this.complete; this.complete = function(x,st) { element.queue( function() { var _s = $.extend( { xml: x, status: st, parsed: res }, s ); s.delAfter( r, _s ); if ( $.isFunction(o) ) { o(x,st); } } ).dequeue(); }; } }; $.ajax( s ); return false; }, ajaxDim: function( e, s ) { var list = this; e = $(e); s = s || {}; var cls = wpList.parseClass(e,'dim'); s = wpList.pre.call( list, e, s, 'dim' ); s.element = cls[2] || s.element || null; s.dimClass = cls[3] || s.dimClass || null; if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; } else { s.dimAddColor = s.dimAddColor || '#FFFF33'; } if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; } else { s.dimDelColor = s.dimDelColor || '#FF3333'; } if ( !s || !s.element || !s.dimClass ) { return true; } s.action = 'dim-' + s.what; s.nonce = wpList.nonce(e,s); s.data = $.extend( { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce }, wpAjax.unserialize( cls[6] || '' ) ); if ( $.isFunction(s.dimBefore) ) { s = s.dimBefore( s ); if ( !s ) { return true; } } var element = $('#' + s.element); var isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass); var color = wpList.getColor( element ); element.toggleClass( s.dimClass ) var dimColor = isClass ? s.dimAddColor : s.dimDelColor; if ( 'none' != dimColor ) { element .animate( { backgroundColor: dimColor }, 'fast' ) .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } ) .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); } if ( !s.data._ajax_nonce ) { return true; } s.success = function(r) { var res = wpAjax.parseAjaxResponse(r, s.response, s.element); if ( !res || res.errors ) { element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); return false; } if ( $.isFunction(s.dimAfter) ) { var o = this.complete; this.complete = function(x,st) { element.queue( function() { var _s = $.extend( { xml: x, status: st, parsed: res }, s ); s.dimAfter( r, _s ); if ( $.isFunction(o) ) { o(x,st); } } ).dequeue(); }; } }; $.ajax( s ); return false; }, // From jquery.color.js: jQuery Color Animation by John Resig getColor: function( el ) { if ( el.constructor == Object ) el = el.get(0); var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" ); do { color = jQuery.curCSS(elem, 'backgroundColor'); if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") ) break; } while ( elem = elem.parentNode ); return color || '#ffffff'; }, add: function( e, s ) { var list = $(this); e = $(e); var old = false; var _s = { pos: 0, id: 0, oldId: null }; if ( 'string' == typeof s ) { s = { what: s }; } s = $.extend(_s, this.wpList.settings, s); if ( !e.size() || !s.what ) { return false; } if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); } if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); } if ( old && old.size() ) { old.replaceWith(e); } else if ( isNaN(s.pos) ) { var ba = 'after'; if ( '-' == s.pos.substr(0,1) ) { s.pos = s.pos.substr(1); ba = 'before'; } var ref = list.find( '#' + s.pos ); if ( 1 === ref.size() ) { ref[ba](e); } else { list.append(e); } } else if ( s.pos < 0 ) { list.prepend(e); } else { list.append(e); } if ( s.alt ) { if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); } else { e.addClass( s.alt ); } } if ( 'none' != s.addColor ) { var color = wpList.getColor( e ); e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); } list.each( function() { this.wpList.process( e ); } ); return e; }, clear: function(e) { var list = this; e = $(e); if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; } e.find(':input').each( function() { if ( $(this).parents('.form-no-clear').size() ) return; var t = this.type.toLowerCase(); var tag = this.tagName.toLowerCase(); if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; } else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; } else if ( 'select' == tag ) { this.selectedIndex = null; } }); }, process: function(el) { var list = this; $("[class^=add:" + list.id + ":]", el || null) .filter('form').submit( function() { return list.wpList.add(this); } ).end() .not('form').click( function() { return list.wpList.add(this); } ).each( function() { var addEl = this; var c = wpList.parseClass(this,'add')[2] || addEl.id; if ( !c ) { return; } var forms = []; var ins = []; // this is all really inefficient $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() { ins.push(this); var f = $(this).parents('form:first').get(0); if ( $.inArray(f,forms) < 0 ) { forms.push(f); } } ); $(forms).submit( function() { if ( 0 <= $.inArray(currentFormEl,ins) ) { $(addEl).trigger( 'click' ); $(currentFormEl).focus(); return false; } } ); } ); $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } ); $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } ); }, recolor: function() { var list = this; if ( !list.wpList.settings.alt ) { return; } var items = $('.list-item:visible', list); if ( !items.size() ) { items = $(list).children(':visible'); } var eo = [':even',':odd']; if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); } items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt); }, init: function() { var lists = this; lists.wpList.process = function(a) { lists.each( function() { this.wpList.process(a); } ); }; lists.wpList.recolor = function() { lists.each( function() { this.wpList.recolor(); } ); }; } }; $.fn.wpList = function( settings ) { this.each( function() { var _this = this; this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) }; $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } ); } ); wpList.init.call(this); this.wpList.process(); return this; }; })(jQuery); blogs/wp-includes/js/list-manipulation.js0000644000000000000000000002216011046077143017543 0ustar rootrootaddLoadEvent( function() { if ( 'undefined' != typeof listManL10n ) Object.extend(listMan.prototype, listManL10n); theList = new listMan(); } ); function deleteSomething( what, id, message, obj ) { if ( !obj ) obj=theList; if ( !message ) message = obj.delText.replace(/%thing%/g, what); if( confirm(message) ) return obj.ajaxDelete( what, id ); else return false; } function dimSomething( what, id, dimClass, obj ) { if ( !obj ) obj = theList; return obj.ajaxDimmer(what,id,dimClass); } var listMan = Class.create(); Object.extend(listMan.prototype, { ajaxRespEl: 'ajax-response', ajaxHandler: false, inputData: '', clearInputs: [], showLink: true, topAdder: false, alt: 'alternate', altOffset: 0, addComplete: null, delComplete: null, dimComplete: null, dataStore: null, formStore: null, jumpText: '', // We get these from listManL10n delText: '', initialize: function(theListId) { this.theList = $(theListId ? theListId : 'the-list'); if ( !this.theList ) return false; Element.cleanWhitespace(this.theList); }, // sends add-what and fields contained in where // recieves html with top element having an id like what-# ajaxAdder: function( what, where, update ) { // Do NOT wrap TR in TABLE TBODY var ajaxAdd = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); if ( ajaxAdd.notInitialized() ) return true; var action = ( update ? 'update-' : 'add-' ) + what; ajaxAdd.options.parameters = $H(ajaxAdd.options.parameters).merge({action: action}).merge(this.inputData.toQueryParams()).merge(this.grabInputs( where, ajaxAdd ).toQueryParams()); var tempObj=this; ajaxAdd.addOnComplete( function(transport) { var newItems = $A(transport.responseXML.getElementsByTagName(what)); if ( newItems ) { var showLinkMessage = ''; var m = ''; newItems.each( function(i) { var id = i.getAttribute('id'); var exists = $(what+'-'+id); if ( exists ) tempObj.replaceListItem( exists, getNodeValue(i,'response_data'), update ); else tempObj.addListItem( getNodeValue(i, 'response_data') ); m = getNodeValue(i, 'show-link'); showLinkMessage += showLinkMessage ? "
    \n" : ''; if ( m ) showLinkMessage += m; else showLinkMessage += "" + tempObj.jumpText + ""; }); if ( tempObj.showLink && showLinkMessage ) Element.update(ajaxAdd.myResponseElement,""); } if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' ) tempObj.addComplete( what, where, update, transport ); tempObj.recolorList(); ajaxAdd.restoreInputs = null; }); if ( !update ) ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); }); ajaxAdd.request(ajaxAdd.url); if ( !update ) this.clear(); return false; }, // sends update-what and fields contained in where // recieves html with top element having an id like what-# ajaxUpdater: function( what, where ) { return this.ajaxAdder( what, where, true ); }, // sends delete-what and id# ajaxDelete: function( what, id ) { var ajaxDel = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); if( ajaxDel.notInitialized() ) return true; var tempObj = this; var action = 'delete-' + what; var actionId = action + '&id=' + id; var idName = what.replace('-as-spam','') + '-' + id; ajaxDel.addOnComplete( function(transport) { Element.update(ajaxDel.myResponseElement,''); tempObj.destore(actionId); if( tempObj.delComplete && typeof tempObj.delComplete == 'function' ) tempObj.delComplete( what, id, transport ); }); ajaxDel.addOnWPError( function(transport) { tempObj.restore(actionId, true); }); ajaxDel.options.parameters = $H(ajaxDel.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams()); ajaxDel.request(ajaxDel.url); this.store(actionId, idName); tempObj.removeListItem( idName ); return false; }, // Toggles class nomes // sends dim-what and id# ajaxDimmer: function( what, id, dimClass ) { ajaxDim = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); if ( ajaxDim.notInitialized() ) return true; var tempObj = this; var action = 'dim-' + what; var actionId = action + '&id=' + id; var idName = what + '-' + id; ajaxDim.addOnComplete( function(transport) { Element.update(ajaxDim.myResponseElement,''); tempObj.destore(actionId); if ( tempObj.dimComplete && typeof tempObj.dimComplete == 'function' ) tempObj.dimComplete( what, id, dimClass, transport ); }); ajaxDim.addOnWPError( function(transport) { tempObj.restore(actionId, true); }); ajaxDim.options.parameters = $H(ajaxDim.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams()); ajaxDim.request(ajaxDim.url); this.store(actionId, idName); this.dimItem( idName, dimClass ); return false; }, addListItem: function( h ) { new Insertion[this.topAdder ? 'Top' : 'Bottom'](this.theList,h); Element.cleanWhitespace(this.theList); var id = this.topAdder ? this.theList.firstChild.id : this.theList.lastChild.id; if ( this.alt ) if ( ( this.theList.childNodes.length + this.altOffset ) % 2 ) Element.addClassName($(id),this.alt); Fat.fade_element(id); }, // only hides the element sa it can be put back again if necessary removeListItem: function( id, noFade ) { id = $(id); if ( !noFade ) { Fat.fade_element(id.id,null,700,'#FF3333'); var tempObj = this; var func = function() { id.hide(); tempObj.recolorList(); } setTimeout(func, 705); } else { id.hide(); this.recolorList(); } }, replaceListItem: function( id, h, update ) { id = $(id); if ( !update ) { Element.remove(id); this.addListItem( h ); return; } id.replace(h); Fat.fade_element(id.id); }, // toggles class dimItem: function( id, dimClass, noFade ) { id = $(id); if ( Element.hasClassName(id,dimClass) ) { if ( !noFade ) Fat.fade_element(id.id,null,700,null); Element.removeClassName(id,dimClass); } else { if ( !noFade ) Fat.fade_element(id.id,null,700,'#FF3333'); Element.addClassName(id,dimClass); } }, // store an element in case we need it later store: function(action, id) { if ( !this.dataStore ) this.dataStore = $H(); this.dataStore[action] = $(id).cloneNode(true); }, // delete from store destore: function(action) { delete(this.dataStore[action]); }, // restore element from store into existing (possibly hidden) element of same id restore: function(action, error) { var id = this.dataStore[action].id; this.theList.replaceChild(this.dataStore[action], $(id)); delete(this.dataStore[action]); if ( error ) { func = function() { Element.setStyle($(id),{backgroundColor:'#FF3333'}); } func(); setTimeout(func, 705); // Hit it twice in case it's still fading. } }, // Like Form.serialize, but excludes action and sets up clearInputs grabInputs: function( where, ajaxObj ) { if ( ajaxObj ) ajaxObj.restoreInputs = []; var elements = Form.getElements($(where)); var queryComponents = new Array(); for (var i = 0; i < elements.length; i++) { if ( 'action' == elements[i].name ) continue; if ( 'hidden' != elements[i].type && 'submit' != elements[i].type && 'button' != elements[i].type ) { this.clearInputs.push(elements[i]); if ( ajaxObj ) ajaxObj.restoreInputs.push([elements[i], elements[i].value]); } var queryComponent = Form.Element.serialize(elements[i]); if (queryComponent) { queryComponents.push(queryComponent); } } return queryComponents.join('&'); }, // form.reset() can only do whole forms. This can do subsections. clear: function() { this.clearInputs.each( function(i) { i = $(i); if ( 'textarea' == i.tagName.toLowerCase() ) i.value = ''; else switch ( i.type.toLowerCase() ) { case 'password': case 'text': i.value = ''; break; case 'checkbox': case 'radio': i.checked = false; break; case 'select': case 'select-one': i.selectedIndex = null; break; case 'select-multiple': for (var o = 0; o < i.length; o++) i.options[o].selected = false; break; } }); this.clearInputs = []; }, restoreForm: function(elements) { elements.each( function(i) { i[0].value = i[1]; }); }, recolorList: function() { if ( !this.alt ) return; var alt = this.alt; var offset = this.altOffset; var listItems = $A(this.theList.childNodes).findAll( function(i) { return Element.visible(i) } ); listItems.each( function(i,n) { if ( ( n + offset ) % 2 ) Element.removeClassName(i,alt); else Element.addClassName(i,alt); }); } }); //No submit unless code returns true. function killSubmit ( code, e ) { e = e ? e : window.event; if ( !e ) return; var t = e.target ? e.target : e.srcElement; if ( ( 'text' == t.type && e.keyCode == 13 ) || ( 'submit' == t.type && 'click' == e.type ) ) { if ( ( 'string' == typeof code && !eval(code) ) || ( 'function' == typeof code && !code() ) ) { e.returnValue = false; e.cancelBubble = true; return false; } } } //Generic but lame JS closure function encloseFunc(f){var a=arguments[1];return function(){return f(a);}} blogs/wp-includes/js/thickbox/0000755000000000000000000000000011077323063015345 5ustar rootrootblogs/wp-includes/js/thickbox/thickbox.css0000644000000000000000000000701511077635520017701 0ustar rootroot /* ----------------------------------------------------------------------------------------------------------------*/ /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ /* ----------------------------------------------------------------------------------------------------------------*/ #TB_window { font: 12px Arial, Helvetica, sans-serif; color: #333333; } #TB_secondLine { font: 10px Arial, Helvetica, sans-serif; color:#666666; } #TB_window a:link {color: #666666;} #TB_window a:visited {color: #666666;} #TB_window a:hover {color: #000;} #TB_window a:active {color: #666666;} #TB_window a:focus{color: #666666;} /* ----------------------------------------------------------------------------------------------------------------*/ /* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ /* ----------------------------------------------------------------------------------------------------------------*/ #TB_overlay { position: fixed; z-index:100; top: 0px; left: 0px; height:100%; width:100%; } .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} .TB_overlayBG { background-color:#000; filter:alpha(opacity=75); -moz-opacity: 0.75; opacity: 0.75; } * html #TB_overlay { /* ie6 hack */ position: absolute; height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); } #TB_window { position: fixed; background: #ffffff; z-index: 102; color:#000000; display:none; border: 4px solid #525252; text-align:left; top:50%; left:50%; } * html #TB_window { /* ie6 hack */ position: absolute; margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); } #TB_window img#TB_Image { display:block; margin: 15px 0 0 15px; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; border-top: 1px solid #666; border-left: 1px solid #666; } #TB_caption{ height:25px; padding:7px 30px 10px 25px; float:left; } #TB_closeWindow{ height:25px; padding:11px 25px 10px 0; float:right; } #TB_closeAjaxWindow{ padding:6px 10px 0; text-align:right; float:right; } #TB_ajaxWindowTitle{ float:left; padding:6px 10px 0; } #TB_title{ background-color:#e8e8e8; height:27px; } #TB_ajaxContent{ clear:both; padding:2px 15px 15px 15px; overflow:auto; text-align:left; line-height:1.4em; } #TB_ajaxContent.TB_modal{ padding:15px; } #TB_ajaxContent p{ padding:5px 0px 5px 0px; } #TB_load{ position: fixed; display:none; z-index:103; top: 50%; left: 50%; background-color: #E8E8E8; border: 4px solid #525252; margin: -45px 0pt 0pt -125px; padding: 40px 15px 15px; } * html #TB_load { /* ie6 hack */ position: absolute; margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); } #TB_HideSelect{ z-index:99; position:fixed; top: 0; left: 0; background-color:#fff; border:none; filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0; height:100%; width:100%; } * html #TB_HideSelect { /* ie6 hack */ position: absolute; height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); } #TB_iframeContent{ clear:both; border:none; margin-bottom:-1px; _margin-bottom:1px; } blogs/wp-includes/js/thickbox/macFFBgHack.png0000644000000000000000000000031711077635520020074 0ustar rootrootPNG  IHDRcsBIT|d pHYs  ~tEXtSoftwareAdobe Fireworks CS3FtEXtCreation Time7/16/07Z (IDATHA0!U[ GϱJJJJJJJJJYIENDB`blogs/wp-includes/js/thickbox/loadingAnimation.gif0000644000000000000000000001337611077635520021327 0ustar rootrootGIF89a ! NETSCAPE2.0! ,  @Rihlp,tm#6N+rrD4h@FCjz]Lj]﹬R3-H$wPy |KI\K Q\]PI ~$ ~ J %:`@ XP@AO 2|(D**HE}lF=$Ƌ@\9L J()? ``C=4RO@>}5TDU^=UQH~Xe֫:|AoG4Q]V;ޙ  jUzҧ]$jQM ʆķ7721@ܒDH;܋%ЅqۛXMgNάgMWz!`dѥ]uja}a ݸ6;5լDzTh,5~z~@y[:3M7gG]q=@c5 4u흃5__9_AMtB\K ⵘ}" @lDiQu+baq&{#'LHjz"$& $B! ,  EI@*PR*;ò[Ll7DҎ%GI0)mIԲ`I}>ă}-RwFu}y|O(p*"rt{RA>( ^( "4 333..Чɞ v.*o 3u zz( D.z Ha рP*6=%8A%ϤH]JQ&2Lz녆Aɔ>50j( ]T.s *I@m:nTx^7}v(Hy!8/ 4^ֹGi`zA"?l8]'STҧX*3@XMS<@蜮-./Ay5|Uv۬ϰVr4<A:\4bmdvi{˿ӛW'7naq{"8V_u_^2_[koTpbp :M skx_"Vؓ! ,  %R4 yԬԢ\K٩l'#QZ0ՠVTyïe]U4f!Pc0zkW+_ ^ў`v"Ŋa@x:@O,ȬtK5zsRtH5y3ʥ>yz=3[/Z|&x @7nGdn B^|{ZCN3Z&$p{f;^C}Co %! ,  %$5,%:k.]#> B"ZRp]2Shk9E-e<ͩkGj6-twsz|mOQtix41 ) U"  BQ B)# B+u  )ێ #" pg߿=QǍPa Q*֑Xb<88l$Q,? y2=0յT#rΗ5 9`jLmgTJ2MWy6jukիKy0iP0JCg&(`oq]혗']u}C*  ^\sxaGtKpeÈa@jvlgVDz$ͣQ>mb16}4 @l`ѪzvsGt 2y֐/V+SNJ=^"+Y  09ڛ>0}Lj`abqO '8^Xd|5 [ahWY7֑W6!i!qHX&(@3&B! ,  Q$@RS" k; S]3X'+ζS tUik `m0c]wldt$v}k~zq,lryux?)B ; 00;+ ­G 0-g+ .z%$z +l(jx9hNt<; 8O7yxH#|bH$ѼLipȅѐ 2"-A(P$tj@{s(W$( =!u5(jmn wmĸoA@w/d1+:'l1f#|,z20Hg@1}թٯ[3S+|7Uǃ.{ P卵0ʶc=+PL03:~p'v{On<~)@uP6 k (àK'vK V`I9(ZLG!! ,  PeRN*',Ԣv*o<bKs M3k>oR sAE1fm):kvvM{wl rtqPm|uF~?W a3& A66 - 3- .,6o 3/h-o 'dzz&(CGo߉Oa9ќD= kOOEuj(ǑLʏTIR&K.H= ttI£B0E:qjԪPhY‰ ʾBFdÎT0@ܝK!Aݽ_aw9hP(!Ѣ,fʓmZ,rƝ[|.1鑣wZh%.:^mRi綽7V޿}c\u;o>oüu+],Ebd]/\.*h3;߯~ |HoXg6] !! ,  E9$#%5(,Ԓr(i0.݊`lXtD%ydJ6H^.pl[k=.˿(>Sx~gypv}lNtjx{e> ( ~~ -- ,-(Ĺ ' e -/p(u '" u GN šL1:I<9uG '9cɕ-Q$L'lD7UTTׄ tѦBU@%JJŪ)W?LSY bZvmމБ]xF0I{VXg|-BfE#|.@4OP4u8S g ֥_n;Ө՞(բQ)wǮ<.(ʳ2?eG|LՅ"x/-/y+,p=E1 dQٷ~2Kꔛ$r `m*YsC zFn ak}nnI#Q! ,  %R4Ԝ"CA,(~ں8׼دDA֐2hs݌+p]ˤObKw8^>uz`H~htkv"xm|1Z, -#51"1''[#, ,}, ' p#h1 w a"w #p"b1V-akcB)P@;]XqČ#N-A"߲SyrL4eMʚph\@eq/o D2(𯘳q s:gu@Fu+QAUӯZ#xbR4vG1 Mɻ;8FP`B۩3he11O~ ˟>z(C3A=\Z-ڇAa-qiSRYmG(1;Ž=dtqB[! ,  %dihlp,40T:Ԕn琘9␄\< P)JZ+^f(-N Ǥ4ant#o~$z|u#Svx@"'% #m# S%  $%§ #ְͽ$& A"%  $#H݃'/9BH EdOC)Lq#Fo gBbDIʤC'CRg̙G 4^M=F\dd3 X堙Kl٣̊@@T?}IVUT+ol|gr TeluӭޒvG]l<ݑsg_D )4EQ_i)Pi#!h Da %.@qMOQ `pnyHWC"$s* ]hp$V 8
    "); jQuery("#TB_overlay").click(tb_remove); } }else{//all others if(document.getElementById("TB_overlay") === null){ jQuery("body").append("
    "); jQuery("#TB_overlay").click(tb_remove); } } if(tb_detectMacXFF()){ jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash }else{ jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity } if(caption===null){caption="";} jQuery("body").append("
    ");//add loader to the page jQuery('#TB_load').show();//show loader var baseURL; if(url.indexOf("?")!==-1){ //ff there is a query string involved baseURL = url.substr(0, url.indexOf("?")); }else{ baseURL = url; } var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; var urlType = baseURL.toLowerCase().match(urlString); if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images TB_PrevCaption = ""; TB_PrevURL = ""; TB_PrevHTML = ""; TB_NextCaption = ""; TB_NextURL = ""; TB_NextHTML = ""; TB_imageCount = ""; TB_FoundURL = false; if(imageGroup){ TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get(); for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); if (!(TB_TempArray[TB_Counter].href == url)) { if (TB_FoundURL) { TB_NextCaption = TB_TempArray[TB_Counter].title; TB_NextURL = TB_TempArray[TB_Counter].href; TB_NextHTML = "  Next >"; } else { TB_PrevCaption = TB_TempArray[TB_Counter].title; TB_PrevURL = TB_TempArray[TB_Counter].href; TB_PrevHTML = "  < Prev"; } } else { TB_FoundURL = true; TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); } } } imgPreloader = new Image(); imgPreloader.onload = function(){ imgPreloader.onload = null; // Resizing large images - orginal by Christian Montoya edited by me. var pagesize = tb_getPageSize(); var x = pagesize[0] - 150; var y = pagesize[1] - 150; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; } } else if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; } } // End Resizing TB_WIDTH = imageWidth + 30; TB_HEIGHT = imageHeight + 60; jQuery("#TB_window").append(""+caption+"" + "
    "+caption+"
    " + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
    "); jQuery("#TB_closeWindowButton").click(tb_remove); if (!(TB_PrevHTML === "")) { function goPrev(){ if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} jQuery("#TB_window").remove(); jQuery("body").append("
    "); tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); return false; } jQuery("#TB_prev").click(goPrev); } if (!(TB_NextHTML === "")) { function goNext(){ jQuery("#TB_window").remove(); jQuery("body").append("
    "); tb_show(TB_NextCaption, TB_NextURL, imageGroup); return false; } jQuery("#TB_next").click(goNext); } document.onkeydown = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close tb_remove(); } else if(keycode == 190){ // display previous image if(!(TB_NextHTML == "")){ document.onkeydown = ""; goNext(); } } else if(keycode == 188){ // display next image if(!(TB_PrevHTML == "")){ document.onkeydown = ""; goPrev(); } } }; tb_position(); jQuery("#TB_load").remove(); jQuery("#TB_ImageOff").click(tb_remove); jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show }; imgPreloader.src = url; }else{//code to show html var queryString = url.replace(/^[^\?]+\??/,''); var params = tb_parseQuery( queryString ); TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL ajaxContentW = TB_WIDTH - 30; ajaxContentH = TB_HEIGHT - 45; if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window urlNoQuery = url.split('TB_'); jQuery("#TB_iframeContent").remove(); if(params['modal'] != "true"){//iframe no modal jQuery("#TB_window").append("
    "+caption+"
    "); }else{//iframe modal jQuery("#TB_overlay").unbind(); jQuery("#TB_window").append(""); } }else{// not an iframe, ajax if(jQuery("#TB_window").css("display") != "block"){ if(params['modal'] != "true"){//ajax no modal jQuery("#TB_window").append("
    "+caption+"
    "); }else{//ajax modal jQuery("#TB_overlay").unbind(); jQuery("#TB_window").append("
    "); } }else{//this means the window is already up, we are just loading new content via ajax jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; jQuery("#TB_ajaxContent")[0].scrollTop = 0; jQuery("#TB_ajaxWindowTitle").html(caption); } } jQuery("#TB_closeWindowButton").click(tb_remove); if(url.indexOf('TB_inline') != -1){ jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); jQuery("#TB_window").unload(function () { jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished }); tb_position(); jQuery("#TB_load").remove(); jQuery("#TB_window").css({display:"block"}); }else if(url.indexOf('TB_iframe') != -1){ tb_position(); if($.browser.safari){//safari needs help because it will not fire iframe onload jQuery("#TB_load").remove(); jQuery("#TB_window").css({display:"block"}); } }else{ jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method tb_position(); jQuery("#TB_load").remove(); tb_init("#TB_ajaxContent a.thickbox"); jQuery("#TB_window").css({display:"block"}); }); } } if(!params['modal']){ document.onkeyup = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close tb_remove(); } }; } } catch(e) { //nothing here } } //helper functions below function tb_showIframe(){ jQuery("#TB_load").remove(); jQuery("#TB_window").css({display:"block"}); } function tb_remove() { jQuery("#TB_imageOff").unbind("click"); jQuery("#TB_closeWindowButton").unbind("click"); jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); jQuery("#TB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 jQuery("body","html").css({height: "auto", width: "auto"}); jQuery("html").css("overflow",""); } document.onkeydown = ""; document.onkeyup = ""; return false; } function tb_position() { jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); } } function tb_parseQuery ( query ) { var Params = {}; if ( ! query ) {return Params;}// return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) {continue;} var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function tb_getPageSize(){ var de = document.documentElement; var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; arrayPageSize = [w,h]; return arrayPageSize; } function tb_detectMacXFF() { var userAgent = navigator.userAgent.toLowerCase(); if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { return true; } } blogs/wp-includes/js/thickbox/tb-close.png0000644000000000000000000000077211077635520017575 0ustar rootrootPNG  IHDR pHYs  IDAT(uRKn"Q f ˬ΀$ǚRYg (g͒jre[\9jHK1f^,OV5MfVI(;N炈ݯZN$"DZ 3 _)Dsdf zh0`01n6^:NWn*NDbyÃF,<!ʲtx0&&this.options.minHeight>0){ this.options.ratioDim.x=this.options.minWidth; this.options.ratioDim.y=this.options.minHeight; } this.img=$(_7); this.clickCoords={x:0,y:0}; this.dragging=false; this.resizing=false; this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent); this.isIE=/MSIE/.test(navigator.userAgent); this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent); this.ratioX=0; this.ratioY=0; this.attached=false; $A(document.getElementsByTagName("script")).each(function(s){ if(s.src.match(/cropper\.js/)){ var _a=s.src.replace(/cropper\.js(.*)?/,""); var _b=document.createElement("link"); _b.rel="stylesheet"; _b.type="text/css"; _b.href=_a+"cropper.css"; _b.media="screen"; document.getElementsByTagName("head")[0].appendChild(_b); } }); if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){ var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y); this.ratioX=this.options.ratioDim.x/_c; this.ratioY=this.options.ratioDim.y/_c; } this.subInitialize(); if(this.img.complete||this.isWebKit){ this.onLoad(); }else{ Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this)); } },getGCD:function(a,b){return 1; if(b==0){ return a; } return this.getGCD(b,a%b); },onLoad:function(){ var _f="imgCrop_"; var _10=this.img.parentNode; var _11=""; if(this.isOpera8){ _11=" opera8"; } this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11}); if(this.isIE){ this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]); this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]); this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]); this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]); var _12=[this.north,this.east,this.south,this.west]; }else{ this.overlay=Builder.node("div",{"class":_f+"overlay"}); var _12=[this.overlay]; } this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12); this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"}); this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"}); this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"}); this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"}); this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"}); this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"}); this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"}); this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"}); this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]); Element.setStyle($(this.selArea),{backgroundColor:"transparent",backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}); this.imgWrap.appendChild(this.img); this.imgWrap.appendChild(this.dragArea); this.dragArea.appendChild(this.selArea); this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"})); _10.appendChild(this.imgWrap); Event.observe(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this)); Event.observe(document,"mousemove",this.onDrag.bindAsEventListener(this)); Event.observe(document,"mouseup",this.endCrop.bindAsEventListener(this)); var _13=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW]; for(var i=0;i<_13.length;i++){ Event.observe(_13[i],"mousedown",this.startResize.bindAsEventListener(this)); } if(this.options.captureKeys){ Event.observe(document,"keydown",this.handleKeys.bindAsEventListener(this)); } new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)}); this.setParams(); },setParams:function(){ this.imgW=this.img.width; this.imgH=this.img.height; if(!this.isIE){ Element.setStyle($(this.overlay),{width:this.imgW+"px",height:this.imgH+"px"}); Element.hide($(this.overlay)); Element.setStyle($(this.selArea),{backgroundImage:"url("+this.img.src+")"}); }else{ Element.setStyle($(this.north),{height:0}); Element.setStyle($(this.east),{width:0,height:0}); Element.setStyle($(this.south),{height:0}); Element.setStyle($(this.west),{width:0,height:0}); } Element.setStyle($(this.imgWrap),{"width":this.imgW+"px","height":this.imgH+"px"}); Element.hide($(this.selArea)); var _15=Position.positionedOffset(this.imgWrap); this.wrapOffsets={"top":_15[1],"left":_15[0]}; var _16={x1:0,y1:0,x2:0,y2:0}; this.setAreaCoords(_16); if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0&&this.options.displayOnInit){ _16.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2); _16.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2); _16.x2=_16.x1+this.options.ratioDim.x; _16.y2=_16.y1+this.options.ratioDim.y; Element.show(this.selArea); this.drawArea(); this.endCrop(); } this.attached=true; },remove:function(){ this.attached=false; this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap); this.imgWrap.parentNode.removeChild(this.imgWrap); Event.stopObserving(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this)); Event.stopObserving(document,"mousemove",this.onDrag.bindAsEventListener(this)); Event.stopObserving(document,"mouseup",this.endCrop.bindAsEventListener(this)); var _17=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW]; for(var i=0;i<_17.length;i++){ Event.stopObserving(_17[i],"mousedown",this.startResize.bindAsEventListener(this)); } if(this.options.captureKeys){ Event.stopObserving(document,"keydown",this.handleKeys.bindAsEventListener(this)); } },reset:function(){ if(!this.attached){ this.onLoad(); }else{ this.setParams(); } this.endCrop(); },handleKeys:function(e){ var dir={x:0,y:0}; if(!this.dragging){ switch(e.keyCode){ case (37): dir.x=-1; break; case (38): dir.y=-1; break; case (39): dir.x=1; break; case (40): dir.y=1; break; } if(dir.x!=0||dir.y!=0){ if(e.shiftKey){ dir.x*=10; dir.y*=10; } this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]); Event.stop(e); } } },calcW:function(){ return (this.areaCoords.x2-this.areaCoords.x1); },calcH:function(){ return (this.areaCoords.y2-this.areaCoords.y1); },moveArea:function(_1b){ this.setAreaCoords({x1:_1b[0],y1:_1b[1],x2:_1b[0]+this.calcW(),y2:_1b[1]+this.calcH()},true); this.drawArea(); },cloneCoords:function(_1c){ return {x1:_1c.x1,y1:_1c.y1,x2:_1c.x2,y2:_1c.y2}; },setAreaCoords:function(_1d,_1e,_1f,_20,_21){ var _22=typeof _1e!="undefined"?_1e:false; var _23=typeof _1f!="undefined"?_1f:false; if(_1e){ var _24=_1d.x2-_1d.x1; var _25=_1d.y2-_1d.y1; if(_1d.x1<0){ _1d.x1=0; _1d.x2=_24; } if(_1d.y1<0){ _1d.y1=0; _1d.y2=_25; } if(_1d.x2>this.imgW){ _1d.x2=this.imgW; _1d.x1=this.imgW-_24; } if(_1d.y2>this.imgH){ _1d.y2=this.imgH; _1d.y1=this.imgH-_25; } }else{ if(_1d.x1<0){ _1d.x1=0; } if(_1d.y1<0){ _1d.y1=0; } if(_1d.x2>this.imgW){ _1d.x2=this.imgW; } if(_1d.y2>this.imgH){ _1d.y2=this.imgH; } if(typeof (_20)!="undefined"){ if(this.ratioX>0){ this.applyRatio(_1d,{x:this.ratioX,y:this.ratioY},_20,_21); }else{ if(_23){ this.applyRatio(_1d,{x:1,y:1},_20,_21); } } var _26={a1:_1d.x1,a2:_1d.x2}; var _27={a1:_1d.y1,a2:_1d.y2}; var _28=this.options.minWidth; var _29=this.options.minHeight; if((_28==0||_29==0)&&_23){ if(_28>0){ _29=_28; }else{ if(_29>0){ _28=_29; } } } this.applyMinDimension(_26,_28,_20.x,{min:0,max:this.imgW}); this.applyMinDimension(_27,_29,_20.y,{min:0,max:this.imgH}); _1d={x1:_26.a1,y1:_27.a1,x2:_26.a2,y2:_27.a2}; } } this.areaCoords=_1d; },applyMinDimension:function(_2a,_2b,_2c,_2d){ if((_2a.a2-_2a.a1)<_2b){ if(_2c==1){ _2a.a2=_2a.a1+_2b; }else{ _2a.a1=_2a.a2-_2b; } if(_2a.a1<_2d.min){ _2a.a1=_2d.min; _2a.a2=_2b; }else{ if(_2a.a2>_2d.max){ _2a.a1=_2d.max-_2b; _2a.a2=_2d.max; } } } },applyRatio:function(_2e,_2f,_30,_31){ var _32; if(_31=="N"||_31=="S"){ _32=this.applyRatioToAxis({a1:_2e.y1,b1:_2e.x1,a2:_2e.y2,b2:_2e.x2},{a:_2f.y,b:_2f.x},{a:_30.y,b:_30.x},{min:0,max:this.imgW}); _2e.x1=_32.b1; _2e.y1=_32.a1; _2e.x2=_32.b2; _2e.y2=_32.a2; }else{ _32=this.applyRatioToAxis({a1:_2e.x1,b1:_2e.y1,a2:_2e.x2,b2:_2e.y2},{a:_2f.x,b:_2f.y},{a:_30.x,b:_30.y},{min:0,max:this.imgH}); _2e.x1=_32.a1; _2e.y1=_32.b1; _2e.x2=_32.a2; _2e.y2=_32.b2; } },applyRatioToAxis:function(_33,_34,_35,_36){ var _37=Object.extend(_33,{}); var _38=_37.a2-_37.a1; var _3a=Math.floor(_38*_34.b/_34.a); var _3b; var _3c; var _3d=null; if(_35.b==1){ _3b=_37.b1+_3a; if(_3b>_36.max){ _3b=_36.max; _3d=_3b-_37.b1; } _37.b2=_3b; }else{ _3b=_37.b2-_3a; if(_3b<_36.min){ _3b=_36.min; _3d=_3b+_37.b2; } _37.b1=_3b; } if(_3d!=null){ _3c=Math.floor(_3d*_34.a/_34.b); if(_35.a==1){ _37.a2=_37.a1+_3c; }else{ _37.a1=_37.a1=_37.a2-_3c; } } return _37; },drawArea:function(){ if(!this.isIE){ Element.show($(this.overlay)); } var _3e=this.calcW(); var _3f=this.calcH(); var _40=this.areaCoords.x2; var _41=this.areaCoords.y2; var _42=this.selArea.style; _42.left=this.areaCoords.x1+"px"; _42.top=this.areaCoords.y1+"px"; _42.width=_3e+"px"; _42.height=_3f+"px"; var _43=Math.ceil((_3e-6)/2)+"px"; var _44=Math.ceil((_3f-6)/2)+"px"; this.handleN.style.left=_43; this.handleE.style.top=_44; this.handleS.style.left=_43; this.handleW.style.top=_44; if(this.isIE){ this.north.style.height=this.areaCoords.y1+"px"; var _45=this.east.style; _45.top=this.areaCoords.y1+"px"; _45.height=_3f+"px"; _45.left=_40+"px"; _45.width=(this.img.width-_40)+"px"; var _46=this.south.style; _46.top=_41+"px"; _46.height=(this.img.height-_41)+"px"; var _47=this.west.style; _47.top=this.areaCoords.y1+"px"; _47.height=_3f+"px"; _47.width=this.areaCoords.x1+"px"; }else{ _42.backgroundPosition="-"+this.areaCoords.x1+"px "+"-"+this.areaCoords.y1+"px"; } this.subDrawArea(); this.forceReRender(); },forceReRender:function(){ if(this.isIE||this.isWebKit){ var n=document.createTextNode(" "); var d,el,fixEL,i; if(this.isIE){ fixEl=this.selArea; }else{ if(this.isWebKit){ fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0]; d=Builder.node("div",""); d.style.visibility="hidden"; var _4a=["SE","S","SW"]; for(i=0;i<_4a.length;i++){ el=document.getElementsByClassName("imgCrop_handle"+_4a[i],this.selArea)[0]; if(el.childNodes.length){ el.removeChild(el.childNodes[0]); } el.appendChild(d); } } } fixEl.appendChild(n); fixEl.removeChild(n); } },startResize:function(e){ this.startCoords=this.cloneCoords(this.areaCoords); this.resizing=true; this.resizeHandle=Element.classNames(Event.element(e)).toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,""); Event.stop(e); },startDrag:function(e){ Element.show(this.selArea); this.clickCoords=this.getCurPos(e); this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y}); this.dragging=true; this.onDrag(e); Event.stop(e); },getCurPos:function(e){ return curPos={x:Event.pointerX(e)-this.wrapOffsets.left,y:Event.pointerY(e)-this.wrapOffsets.top}; },onDrag:function(e){ var _4f=null; if(this.dragging||this.resizing){ var _50=this.getCurPos(e); var _51=this.cloneCoords(this.areaCoords); var _52={x:1,y:1}; } if(this.dragging){ if(_50.x0&&this.options.minHeight>0){ this.previewWrap=$(this.options.previewWrap); this.previewImg=this.img.cloneNode(false); this.options.displayOnInit=true; this.hasPreviewImg=true; Element.addClassName(this.previewWrap,"imgCrop_previewWrap"); Element.setStyle(this.previewWrap,{width:this.options.minWidth+"px",height:this.options.minHeight+"px"}); this.previewWrap.appendChild(this.previewImg); } },subDrawArea:function(){ if(this.hasPreviewImg){ var _58=this.calcW(); var _59=this.calcH(); var _5a={x:this.imgW/_58,y:this.imgH/_59}; var _5b={x:_58/this.options.minWidth,y:_59/this.options.minHeight}; var _5c={w:Math.ceil(this.options.minWidth*_5a.x)+"px",h:Math.ceil(this.options.minHeight*_5a.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_5b.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_5b.y)+"px"}; var _5d=this.previewImg.style; _5d.width=_5c.w; _5d.height=_5c.h; _5d.left=_5c.x; _5d.top=_5c.y; } }}); blogs/wp-includes/js/jquery/0000755000000000000000000000000011046077143015052 5ustar rootrootblogs/wp-includes/js/jquery/ui.sortable.js0000644000000000000000000002414211077635520017645 0ustar rootrooteval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[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}('(b(B){b A(E,D){9 C=B.2U.3W&&B.2U.3V<3U;5(E.2T&&!C){d E.2T(D)}5(E.2S){d!!(E.2S(D)&16)}1R(D=D.1g){5(D==E){d U}}d w}B.3T("m.q",B.2h(B.m.3S,{3R:b(){9 C=4.8;4.P={};4.g.27("m-q");4.2L();4.13=4.c.z?(/6|25/).18(4.c[0].u.f("3Q")):w;5(!(/(2R|1t|3P)/).18(4.g.f("W"))){4.g.f("W","2R")}4.a=4.g.a();4.3O()},3N:{},m:b(C){d{k:(C||4)["k"],r:(C||4)["r"]||B([]),W:(C||4)["W"],3M:(C||4)["1c"],8:4.8,g:4.g,u:(C||4)["i"],3L:C?C.g:O}},v:b(F,E,C,D){B.m.1m.15(4,F,[E,4.m(C)]);5(!D){4.g.3K(F=="1C"?F:"1C"+F,[E,4.m(C)],4.8[F])}},2g:b(E){9 C=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 D=[];E=E||{};C.1y(b(){9 F=(B(4).2O(E.3J||"2N")||"").3I(E.2P||(/(.+)[-=3H](.+)/));5(F){D.1z((E.2Q||F[1])+"[]="+(E.2Q&&E.2P?F[1]:F[2]))}});d D.3G("&")},2f:b(C){9 D=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 E=[];D.1y(b(){E.1z(B(4).2O(C||"2N"))});d E},2G:b(J){9 E=4.1c.6,D=E+4.s.n,I=4.1c.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1p=="2M"||(4.8.1p=="1V"&&4.s[4.13?"n":"o"]>J[4.13?"n":"o"])){d(I+4.a.p.7>K&&I+4.a.p.7F&&E+4.a.p.6J[4.13?"n":"o"])){5(!(I+4.a.p.7>K&&I+4.a.p.7F&&E+4.a.p.6F&&E+4.a.p.6F+J.n/2&&E+4.a.p.6K&&I+4.a.p.7K+J.o/2&&I+4.a.p.7F&&EC){d 1}}Z{5(H>K&&IG){d 2}}}d w},2L:b(){4.28();4.1I()},28:b(){4.c=[];4.e=[4];9 D=4.c;9 C=4;9 F=[[B.1O(4.8.c)?4.8.c.15(4.g,O,{8:4.8,u:4.i}):B(4.8.c,4.g),4]];5(4.8.2a){Q(9 G=4.8.2a.z-1;G>=0;G--){9 I=B(4.8.2a[G]);Q(9 E=I.z-1;E>=0;E--){9 H=B.1f(I[E],"q");5(H&&!H.8.29){F.1z([B.1O(H.8.c)?H.8.c.15(H.g):B(H.8.c,H.g),H]);4.e.1z(H)}}}}Q(9 G=F.z-1;G>=0;G--){F[G][0].1y(b(){B.1f(4,"q-u",F[G][1]);D.1z({u:B(4),2K:F[G][1],n:0,o:0,6:0,7:0})})}},1I:b(D){5(4.t){9 C=4.t.a();4.a.l={7:C.7+4.1w.7,6:C.6+4.1w.6}}Q(9 F=4.c.z-1;F>=0;F--){5(4.c[F].2K!=4.1x&&4.1x&&4.c[F].u[0]!=4.i[0]){1L}9 E=4.8.2J?B(4.8.2J,4.c[F].u):4.c[F].u;5(!D){4.c[F].n=E.1v();4.c[F].o=E.1u()}9 G=E.a();4.c[F].6=G.6;4.c[F].7=G.7}Q(9 F=4.e.z-1;F>=0;F--){9 G=4.e[F].g.a();4.e[F].P.6=G.6;4.e[F].P.7=G.7;4.e[F].P.n=4.e[F].g.1v();4.e[F].P.o=4.e[F].g.1u()}},3F:b(){4.g.3E("m-q m-q-29").2I("q").3D(".q");4.3C();Q(9 C=4.c.z-1;C>=0;C--){4.c[C].u.2I("q-u")}},26:b(E){9 C=E||4,F=C.8;5(F.r.3B==3A){9 D=F.r;F.r={g:b(){d B("<2H>").27(D)[0]},1q:b(G,H){H.f(G.a()).f({n:G.1v(),o:G.1u()})}}}C.r=B(F.r.g.15(C.g,C.i)).1o("T").f({W:"1t"});F.r.1q.15(C.g,C.i,C.r)},2s:b(F){Q(9 D=4.e.z-1;D>=0;D--){5(4.2G(4.e[D].P)){5(!4.e[D].P.1b){5(4.1x!=4.e[D]){9 I=3z;9 H=O;9 E=4.1c[4.e[D].13?"6":"7"];Q(9 C=4.c.z-1;C>=0;C--){5(!A(4.e[D].g[0],4.c[C].u[0])){1L}9 G=4.c[C][4.e[D].13?"6":"7"];5(1k.2F(G-E)=0;E--){4.e[E].v("3m",H,4)}}5(B.m.14){B.m.14.3l=4}5(B.m.14&&!J.2n){B.m.14.3k(4,H)}4.2j=U;4.2w(H);d U},2v:b(D,E){5(!E){E=4.W}9 C=D=="1t"?1:-1;d{7:(E.7+4.a.l.7*C-(4.t[0]==h.T?0:4.t[0].N)*C+4.V.7*C),6:(E.6+4.a.l.6*C-(4.t[0]==h.T?0:4.t[0].M)*C+4.V.6*C)}},22:b(F){9 G=4.8;9 C={7:(F.1e-4.a.p.7-4.a.l.7+(4.t[0]==h.T?0:4.t[0].N)),6:(F.1d-4.a.p.6-4.a.l.6+(4.t[0]==h.T?0:4.t[0].M))};5(!4.1j){d C}5(4.j){5(C.6<4.j[0]){C.6=4.j[0]}5(C.7<4.j[1]){C.7=4.j[1]}5(C.6>4.j[2]){C.6=4.j[2]}5(C.7>4.j[3]){C.7=4.j[3]}}5(G.11){9 E=4.1j.7+1k.2x((C.7-4.1j.7)/G.11[1])*G.11[1];C.7=4.j?(!(E<4.j[1]||E>4.j[3])?E:(!(E<4.j[1])?E-G.11[1]:E+G.11[1])):E;9 D=4.1j.6+1k.2x((C.6-4.1j.6)/G.11[0])*G.11[0];C.6=4.j?(!(D<4.j[0]||D>4.j[2])?D:(!(D<4.j[0])?D-G.11[0]:D+G.11[0])):D}d C},2w:b(D){4.W=4.22(D);4.1c=4.2v("1t");Q(9 C=4.c.z-1;C>=0;C--){9 E=4.2u(4.c[C]);5(!E){1L}5(4.c[C].u[0]!=4.i[0]&&4.i[E==1?"3j":"1r"]()[0]!=4.c[C].u[0]&&!A(4.i[0],4.c[C].u[0])&&(4.8.2t=="3i-3h"?!A(4.g[0],4.c[C].u[0]):U)){4.2p=E==1?"2o":"3g";4.1J(D,4.c[C]);4.v("21",D);3f}}4.2s(D);4.v("1C",D);5(!4.8.1K||4.8.1K=="x"){4.k[0].2r.6=4.W.6+"2q"}5(!4.8.1K||4.8.1K=="y"){4.k[0].2r.7=4.W.7+"2q"}5(B.m.14){B.m.14.3e(4,D)}d w},1J:b(H,G,D,F){D?D.3d(4.i):G.u[4.2p=="2o"?"3c":"3b"](4.i);4.1s=4.1s?++4.1s:1;9 E=4,C=4.1s;17.3a(b(){5(C==E.1s){E.1I(!F)}},0);5(4.8.r){4.8.r.1q.15(4.g,4.i,4.r)}},39:b(E,D){5(B.m.14&&!4.8.2n){B.m.14.38(4,E)}5(4.8.1Z){9 C=4;9 F=C.i.a();5(C.r){C.r.2m({19:"37"},(L(4.8.1Z,10)||2l)-36)}B(4.k).2m({6:F.6-4.a.l.6-C.V.6+(4.t[0]==h.T?0:4.t[0].M),7:F.7-4.a.l.7-C.V.7+(4.t[0]==h.T?0:4.t[0].N)},L(4.8.1Z,10)||2l,b(){C.1H(E)})}Z{4.1H(E,D)}d w},1H:b(E,D){5(4.1X.1r!=4.i.1r().1Y(".m-q-k")[0]||4.1X.l!=4.i.l()[0]){4.v("1q",E,O,D)}5(!A(4.g[0],4.i[0])){4.v("1G",E,O,D);Q(9 C=4.e.z-1;C>=0;C--){5(A(4.e[C].g[0],4.i[0])){4.e[C].v("1q",E,4,D);4.e[C].v("35",E,4,D)}}}Q(9 C=4.e.z-1;C>=0;C--){4.e[C].v("34",E,4,D);5(4.e[C].P.1b){4.e[C].v("2k",E,4);4.e[C].P.1b=0}}4.2j=w;5(4.33){4.v("1n",E,O,D);d w}B(4.i).f("2i","");5(4.r){4.r.1G()}4.k.1G();4.k=O;4.v("1n",E,O,D);d U}}));B.2h(B.m.q,{32:"2g 2f",31:{k:"1W",1p:"1V",30:1,2Z:0,1h:U,Y:20,X:20,2Y:":2X",c:"> *",1a:2W,2e:U,1o:"l"}});B.m.1m.1F("q","1i",{1l:b(E,D){9 C=B("T");5(C.f("1i")){D.8.1U=C.f("1i")}C.f("1i",D.8.1i)},1n:b(D,C){5(C.8.1U){B("T").f("1i",C.8.1U)}}});B.m.1m.1F("q","1a",{1l:b(E,D){9 C=D.k;5(C.f("1a")){D.8.1T=C.f("1a")}C.f("1a",D.8.1a)},1n:b(D,C){5(C.8.1T){B(C.k).f("1a",C.8.1T)}}});B.m.1m.1F("q","19",{1l:b(E,D){9 C=D.k;5(C.f("19")){D.8.1S=C.f("19")}C.f("19",D.8.19)},1n:b(D,C){5(C.8.1S){B(C.k).f("19",C.8.1S)}}});B.m.1m.1F("q","1h",{1l:b(E,D){9 F=D.8;9 C=B(4).1f("q");C.S=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-y"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);C.R=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-x"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);5(C.S[0]!=h&&C.S[0].1B!="1A"){C.1Q=C.S.a()}5(C.R[0]!=h&&C.R[0].1B!="1A"){C.1P=C.R.a()}},1C:b(E,D){9 F=D.8;9 C=B(4).1f("q");5(C.S[0]!=h&&C.S[0].1B!="1A"){5((C.1Q.7+C.S[0].2c)-E.1e35?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}('A.cP={2l:C(c){G B.1y(C(){if(!c.8Y||!c.8P)G;F b=B;b.2a={9M:c.9M||bz,8Y:c.8Y,8P:c.8P,7R:c.7R||\'du\',9c:c.9c||\'du\',2K:c.2K&&28 c.2K==\'C\'?c.2K:H,2V:c.2K&&28 c.2V==\'C\'?c.2V:H,6D:c.6D&&28 c.6D==\'C\'?c.6D:H,8A:A(c.8Y,B),8a:A(c.8P,B),1l:c.1l||7n,5w:c.5w||0};b.2a.8a.2x().E(\'S\',\'9e\').eq(0).E({S:b.2a.9M+\'Q\',11:\'2v\'}).3m();b.2a.8A.1y(C(a){B.6L=a}).ht(C(){A(B).2H(b.2a.9c)},C(){A(B).3S(b.2a.9c)}).1C(\'4U\',C(e){if(b.2a.5w==B.6L)G;b.2a.8A.eq(b.2a.5w).3S(b.2a.7R).3m().eq(B.6L).2H(b.2a.7R).3m();b.2a.8a.eq(b.2a.5w).4S({S:0},b.2a.1l,C(){B.Y.11=\'1k\';if(b.2a.2V){b.2a.2V.1x(b,[B])}}).3m().eq(B.6L).1S().4S({S:b.2a.9M},b.2a.1l,C(){B.Y.11=\'2v\';if(b.2a.2K){b.2a.2K.1x(b,[B])}}).3m();if(b.2a.6D){b.2a.6D.1x(b,[B,b.2a.8a.I(B.6L),b.2a.8A.I(b.2a.5w),b.2a.8a.I(b.2a.5w)])}b.2a.5w=B.6L}).eq(0).2H(b.2a.7R).3m();A(B).E(\'S\',A(B).E(\'S\')).E(\'2N\',\'2B\')})}};A.fn.fe=A.cP.2l;A.8p={2l:C(h){G B.1y(C(){F c=B;F d=2*Z.2F/eD;F f=2*Z.2F;if(A(c).E(\'T\')!=\'2i\'&&A(c).E(\'T\')!=\'1J\'){A(c).E(\'T\',\'2i\')}c.1i={1M:A(h.1M,B),2y:h.2y,61:h.61,9l:h.9l,iu:f,1N:A.12.2f(B),T:A.12.3a(B),2b:Z.2F/2,b4:h.b4,7K:h.5U,5U:[],93:H,7G:2*Z.2F/eD};c.1i.d8=(c.1i.1N.w-c.1i.2y)/2;c.1i.6Y=(c.1i.1N.h-c.1i.61-c.1i.61*c.1i.7K)/2;c.1i.3f=2*Z.2F/c.1i.1M.1N();c.1i.aS=c.1i.1N.w/2;c.1i.aR=c.1i.1N.h/2-c.1i.61*c.1i.7K;F g=1c.3x(\'1W\');A(g).E({T:\'1J\',3j:1,O:0,M:0});A(c).1L(g);c.1i.1M.1y(C(a){8G=A(\'3O\',B).I(0);S=R(c.1i.61*c.1i.7K);if(A.2R.46){3u=1c.3x(\'3O\');A(3u).E(\'T\',\'1J\');3u.2E=8G.2E;3u.Y.4X=\'fu 9x:9C.9E.a6(1E=60, Y=1, fc=0, f9=0, f5=0, f3=0)\'}L{3u=1c.3x(\'3u\');if(3u.bZ){4j=3u.bZ("2d");3u.Y.T=\'1J\';3u.Y.S=S+\'Q\';3u.Y.V=c.1i.2y+\'Q\';3u.S=S;3u.V=c.1i.2y;4j.eR();4j.eM(0,S);4j.eJ(1,-1);4j.jm(8G,0,0,c.1i.2y,S);4j.bL();4j.jl="jh-3U";F b=4j.jf(0,0,0,S);b.es(1,"eg(1O, 1O, 1O, 1)");b.es(0,"eg(1O, 1O, 1O, 0.6)");4j.j9=b;if(j7.j5.3o(\'iX\')!=-1){4j.iV()}L{4j.iS(0,0,c.1i.2y,S)}}}c.1i.5U[a]=3u;A(g).1L(3u)}).1C(\'9r\',C(e){c.1i.93=14;c.1i.1l=c.1i.7G*0.1*c.1i.1l/Z.3B(c.1i.1l);G H}).1C(\'86\',C(e){c.1i.93=H;G H});A.8p.6z(c);c.1i.1l=c.1i.7G*0.2;c.1i.it=1P.5Y(C(){c.1i.2b+=c.1i.1l;if(c.1i.2b>f)c.1i.2b=0;A.8p.6z(c)},20);A(c).1C(\'86\',C(){c.1i.1l=c.1i.7G*0.2*c.1i.1l/Z.3B(c.1i.1l)}).1C(\'3t\',C(e){if(c.1i.93==H){1A=A.12.3W(e);dr=c.1i.1N.w-1A.x+c.1i.T.x;c.1i.1l=c.1i.b4*c.1i.7G*(c.1i.1N.w/2-dr)/(c.1i.1N.w/2)}})})},6z:C(b){b.1i.1M.1y(C(a){b8=b.1i.2b+a*b.1i.3f;x=b.1i.d8*Z.51(b8);y=b.1i.6Y*Z.7L(b8);do=R(1Y*(b.1i.6Y+y)/(2*b.1i.6Y));dm=(b.1i.6Y+y)/(2*b.1i.6Y);V=R((b.1i.2y-b.1i.9l)*dm+b.1i.9l);S=R(V*b.1i.61/b.1i.2y);B.Y.O=b.1i.aR+y-S/2+"Q";B.Y.M=b.1i.aS+x-V/2+"Q";B.Y.V=V+"Q";B.Y.S=S+"Q";B.Y.3j=do;b.1i.5U[a].Y.O=R(b.1i.aR+y+S-1-S/2)+"Q";b.1i.5U[a].Y.M=R(b.1i.aS+x-V/2)+"Q";b.1i.5U[a].Y.V=V+"Q";b.1i.5U[a].Y.S=R(S*b.1i.7K)+"Q"})}};A.fn.hL=A.8p.2l;A.1U({1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a},ho:C(p,n,a,b,c){G b*(n/=c)*n*n+a},d2:C(p,n,a,b,c){G-b*((n=n/c-1)*n*n*n-1)+a},hh:C(p,n,a,b,c){if((n/=c/2)<1)G b/2*n*n*n*n+a;G-b/2*((n-=2)*n*n*n-2)+a},7D:C(p,n,a,b,c){if((n/=c)<(1/2.75)){G b*(7.8W*n*n)+a}L if(n<(2/2.75)){G b*(7.8W*(n-=(1.5/2.75))*n+.75)+a}L if(n<(2.5/2.75)){G b*(7.8W*(n-=(2.25/2.75))*n+.gV)+a}L{G b*(7.8W*(n-=(2.gR/2.75))*n+.gN)+a}},aQ:C(p,n,a,b,c){if(A.1e.7D)G b-A.1e.7D(p,c-n,0,b,c)+a;G a+b},gE:C(p,n,a,b,c){if(A.1e.aQ&&A.1e.7D)if(ng.1z.6q?g.1z.6q:3J;3J=g.1z.6q-3J;bc=g.1z.5R*3J/g.1z.6q;B.Y.V=g.1z.2y+bc+\'Q\';B.Y.M=g.1z.2y*a+c+\'Q\';c+=bc});A.5K.8F(g,c)})})},8F:C(a,b){if(a.1z.4I)if(a.1z.4I==\'az\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())/2-b/2+\'Q\';L if(a.1z.4I==\'M\')a.1z.2q.I(0).Y.M=-b/a.1z.1M.1N()+\'Q\';L if(a.1z.4I==\'2D\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())-b/2+\'Q\';a.1z.2q.I(0).Y.V=a.1z.2y*a.1z.1M.1N()+b+\'Q\'},6z:C(b){b.1z.1M.1y(C(a){B.Y.V=b.1z.2y+\'Q\';B.Y.M=b.1z.2y*a+\'Q\'})}};A.fn.fz=A.5K.2l;A.K={18:P,7W:P,3q:P,2A:P,4b:P,af:P,2r:P,2h:P,1M:P,58:C(){A.K.7W.58();if(A.K.3q){A.K.3q.2x()}},4i:C(){A.K.1M=P;A.K.2h=P;A.K.4b=A.K.2r.2m;if(A.K.18.E(\'11\')==\'2v\'){if(A.K.2r.1a.fx){2X(A.K.2r.1a.fx.1K){19\'a4\':A.K.18.6d(A.K.2r.1a.fx.1H,A.K.58);1n;19\'1u\':A.K.18.c6(A.K.2r.1a.fx.1H,A.K.58);1n;19\'8o\':A.K.18.c3(A.K.2r.1a.fx.1H,A.K.58);1n}}L{A.K.18.2x()}if(A.K.2r.1a.2V)A.K.2r.1a.2V.1x(A.K.2r,[A.K.18,A.K.3q])}L{A.K.58()}1P.a2(A.K.2A)},c1:C(){F e=A.K.2r;F f=A.K.8C(e);if(e&&f.3w!=A.K.4b&&f.3w.1b>=e.1a.8N){A.K.4b=f.3w;A.K.af=f.3w;9V={bR:A(e).1m(\'eS\')||\'bR\',2m:f.3w};A.eQ({1K:\'eN\',9V:A.eL(9V),eK:C(b){e.1a.3X=A(\'3w\',b);1N=e.1a.3X.1N();if(1N>0){F c=\'\';e.1a.3X.1y(C(a){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'\'});if(e.1a.9K){F d=A(\'2m\',e.1a.3X.I(0)).3D();e.2m=f.30+d+e.1a.3y+f.5m;A.K.64(e,f.3w.1b!=d.1b?(f.30.1b+f.3w.1b):d.1b,f.3w.1b!=d.1b?(f.30.1b+d.1b):d.1b)}if(1N>0){A.K.aU(e,c)}L{A.K.4i()}}L{A.K.4i()}},5v:e.1a.96})}},aU:C(a,b){A.K.7W.3i(b);A.K.1M=A(\'7b\',A.K.7W.I(0));A.K.1M.9r(A.K.en).1C(\'4U\',A.K.ed);F c=A.12.3a(a);F d=A.12.2f(a);A.K.18.E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').2H(a.1a.9D);if(A.K.3q){A.K.3q.E(\'11\',\'2v\').E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').E(\'V\',A.K.18.E(\'V\')).E(\'S\',A.K.18.E(\'S\'))}A.K.2h=0;A.K.1M.I(0).2Z=a.1a.72;A.K.7I(a,a.1a.3X.I(0),\'6H\');if(A.K.18.E(\'11\')==\'1k\'){if(a.1a.bv){F e=A.12.9y(a,14);F f=A.12.6b(a,14);A.K.18.E(\'V\',a.3P-(A.e0?(e.l+e.r+f.l+f.r):0)+\'Q\')}if(a.1a.fx){2X(a.1a.fx.1K){19\'a4\':A.K.18.6U(a.1a.fx.1H);1n;19\'1u\':A.K.18.dR(a.1a.fx.1H);1n;19\'8o\':A.K.18.dP(a.1a.fx.1H);1n}}L{A.K.18.1S()}if(A.K.2r.1a.2K)A.K.2r.1a.2K.1x(A.K.2r,[A.K.18,A.K.3q])}},dM:C(){F b=B;if(b.1a.3X){A.K.4b=b.2m;A.K.af=b.2m;F c=\'\';b.1a.3X.1y(C(a){2m=A(\'2m\',B).3D().5u();dH=b.2m.5u();if(2m.3o(dH)==0){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'\'}});if(c!=\'\'){A.K.aU(b,c);B.1a.9s=14;G}}b.1a.3X=P;B.1a.9s=H},64:C(a,b,c){if(a.9q){F d=a.9q();d.iJ(14);d.dC("bh",b);d.iE("bh",-c+b);d.7Q()}L if(a.9m){a.9m(b,c)}L{if(a.88){a.88=b;a.dA=c}}a.6a()},dw:C(a){if(a.88)G a.88;L if(a.9q){F b=1c.64.dv();F c=b.il();G 0-c.dC(\'bh\',-ij)}},8C:C(a){F b={2m:a.2m,30:\'\',5m:\'\',3w:\'\'};if(a.1a.9k){F c=H;F d=A.K.dw(a)||0;F e=b.2m.6W(a.1a.3y);1V(F i=0;i=d||d==0)&&!c){if(b.30.1b<=d)b.3w=e[i];L b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\');c=14}L if(c){b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\')}if(!c){b.30+=e[i]+(e.1b>1?a.1a.3y:\'\')}}}L{b.3w=b.2m}G b},b9:C(e){1P.a2(A.K.2A);F a=A.K.8C(B);F b=e.6S||e.6R||-1;if(/13|27|35|36|38|40|9/.3M(b)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';L A.K.2h=-1;2X(b){19 9:19 13:if(A.K.2h==-1)A.K.2h=0;F c=A.K.1M.I(A.K.2h||0);F d=c.4Z(\'4o\');B.2m=a.30+d+B.1a.3y+a.5m;A.K.4b=a.3w;A.K.64(B,a.30.1b+d.1b+B.1a.3y.1b,a.30.1b+d.1b+B.1a.3y.1b);A.K.4i();if(B.1a.5p){4E=R(c.4Z(\'8h\'))||0;A.K.7I(B,B.1a.3X.I(4E),\'5p\')}if(B.6O)B.6O(H);G b!=13;1n;19 27:B.2m=a.30+A.K.4b+B.1a.3y+a.5m;B.1a.3X=P;A.K.4i();if(B.6O)B.6O(H);G H;1n;19 35:A.K.2h=A.K.1M.1N()-1;1n;19 36:A.K.2h=0;1n;19 38:A.K.2h--;if(A.K.2h<0)A.K.2h=A.K.1M.1N()-1;1n;19 40:A.K.2h++;if(A.K.2h==A.K.1M.1N())A.K.2h=0;1n}A.K.7I(B,B.1a.3X.I(A.K.2h||0),\'6H\');A.K.1M.I(A.K.2h||0).2Z=B.1a.72;if(A.K.1M.I(A.K.2h||0).6O)A.K.1M.I(A.K.2h||0).6O(H);if(B.1a.9K){F f=A.K.1M.I(A.K.2h||0).4Z(\'4o\');B.2m=a.30+f+B.1a.3y+a.5m;if(A.K.4b.1b!=f.1b)A.K.64(B,a.30.1b+A.K.4b.1b,a.30.1b+f.1b)}G H}A.K.dM.1x(B);if(B.1a.9s==H){if(a.3w!=A.K.4b&&a.3w.1b>=B.1a.8N)A.K.2A=1P.97(A.K.c1,B.1a.4w);if(A.K.1M){A.K.4i()}}G 14},7I:C(a,b,c){if(a.1a[c]){F d={};94=b.dj(\'*\');1V(i=0;i<94.1b;i++){d[94[i].4D]=94[i].6M.hG}a.1a[c].1x(a,[d])}},en:C(e){if(A.K.1M){if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.2h=R(B.4Z(\'8h\'))||0;A.K.1M.I(A.K.2h||0).2Z=A.K.2r.1a.72}},ed:C(a){1P.a2(A.K.2A);a=a||A.3N.hD(1P.3N);a.9b();a.99();F b=A.K.8C(A.K.2r);F c=B.4Z(\'4o\');A.K.2r.2m=b.30+c+A.K.2r.1a.3y+b.5m;A.K.4b=B.4Z(\'4o\');A.K.64(A.K.2r,b.30.1b+c.1b+A.K.2r.1a.3y.1b,b.30.1b+c.1b+A.K.2r.1a.3y.1b);A.K.4i();if(A.K.2r.1a.5p){4E=R(B.4Z(\'8h\'))||0;A.K.7I(A.K.2r,A.K.2r.1a.3X.I(4E),\'5p\')}G H},dh:C(e){6K=e.6S||e.6R||-1;if(/13|27|35|36|38|40/.3M(6K)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}G H}},2l:C(a){if(!a.96||!A.12){G}if(!A.K.18){if(A.2R.46){A(\'23\',1c).1L(\'<3q Y="11:1k;T:1J;4X:9x:9C.9E.a6(1E=0);" id="df" 2E="dc:H;" da="0" d7="b0">\');A.K.3q=A(\'#df\')}A(\'23\',1c).1L(\'<1W id="d4" Y="T: 1J; O: 0; M: 0; z-aY: hj; 11: 1k;"><90 Y="5X: 0;7E: 0; h9-Y: 1k; z-aY: h8;">&6G;\');A.K.18=A(\'#d4\');A.K.7W=A(\'90\',A.K.18)}G B.1y(C(){if(B.4D!=\'aV\'&&B.4Z(\'1K\')!=\'3D\')G;B.1a={};B.1a.96=a.96;B.1a.8N=Z.3B(R(a.8N)||1);B.1a.9D=a.9D?a.9D:\'\';B.1a.72=a.72?a.72:\'\';B.1a.5p=a.5p&&a.5p.1F==2w?a.5p:P;B.1a.2K=a.2K&&a.2K.1F==2w?a.2K:P;B.1a.2V=a.2V&&a.2V.1F==2w?a.2V:P;B.1a.6H=a.6H&&a.6H.1F==2w?a.6H:P;B.1a.bv=a.bv||H;B.1a.9k=a.9k||H;B.1a.3y=B.1a.9k?(a.3y||\', \'):\'\';B.1a.9K=a.9K?14:H;B.1a.4w=Z.3B(R(a.4w)||8V);if(a.fx&&a.fx.1F==6E){if(!a.fx.1K||!/a4|1u|8o/.3M(a.fx.1K)){a.fx.1K=\'1u\'}if(a.fx.1K==\'1u\'&&!A.fx.1u)G;if(a.fx.1K==\'8o\'&&!A.fx.5l)G;a.fx.1H=Z.3B(R(a.fx.1H)||7n);if(a.fx.1H>B.1a.4w){a.fx.1H=B.1a.4w-1Y}B.1a.fx=a.fx}B.1a.3X=P;B.1a.9s=H;A(B).1m(\'b9\',\'cW\').6a(C(){A.K.2r=B;A.K.4b=B.2m}).cV(A.K.dh).5Q(A.K.b9).4W(C(){A.K.2A=1P.97(A.K.4i,gM)})})}};A.fn.gJ=A.K.2l;A.1t={2A:P,4k:P,1X:P,3f:10,2b:C(a,b,c,d){A.1t.4k=a;A.1t.1X=b;A.1t.3f=R(c)||10;A.1t.2A=1P.5Y(A.1t.cR,R(d)||40)},cR:C(){1V(i=0;i0&&A.1t.1X[i].2J.y+A.1t.1X[i].2J.t>5a.y){A.1t.1X[i].2T-=A.1t.3f}L if(A.1t.1X[i].2J.t<=A.1t.1X[i].2J.h&&A.1t.1X[i].2J.t+A.1t.1X[i].2J.hb<5a.y+5a.hb){A.1t.1X[i].2T+=A.1t.3f}if(A.1t.1X[i].2J.l>0&&A.1t.1X[i].2J.x+A.1t.1X[i].2J.l>5a.x){A.1t.1X[i].2P-=A.1t.3f}L if(A.1t.1X[i].2J.l<=A.1t.1X[i].2J.gf&&A.1t.1X[i].2J.l+A.1t.1X[i].2J.1D<5a.x+5a.1D){A.1t.1X[i].2P+=A.1t.3f}}},7w:C(){1P.5h(A.1t.2A);A.1t.4k=P;A.1t.1X=P;1V(i in A.1t.1X){A.1t.1X[i].2J=P}}};A.X={18:P,1g:P,4v:C(){G B.1y(C(){if(B.8L){B.D.cM.3h(\'4R\',A.X.aM);B.D=P;B.8L=H;if(A.2R.46){B.aI="cW"}L{B.Y.g0=\'\';B.Y.cJ=\'\';B.Y.cH=\'\'}}})},aM:C(e){if(A.X.1g!=P){A.X.8I(e);G H}F a=B.3H;A(1c).1C(\'3t\',A.X.aE).1C(\'5n\',A.X.8I);a.D.1A=A.12.3W(e);a.D.4d=a.D.1A;a.D.6g=H;a.D.fY=B!=B.3H;A.X.1g=a;if(a.D.4P&&B!=B.3H){aC=A.12.3a(a.2S);aZ=A.12.2f(a);ay={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};dx=a.D.4d.x-aC.x-aZ.1D/2-ay.x;dy=a.D.4d.y-aC.y-aZ.hb/2-ay.y;A.2Q.4s(a,[dx,dy])}G A.6J||H},cD:C(e){F a=A.X.1g;a.D.6g=14;F b=a.Y;a.D.6o=A.E(a,\'11\');a.D.49=A.E(a,\'T\');if(!a.D.av)a.D.av=a.D.49;a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.8z=0;a.D.8y=0;if(A.2R.46){F c=A.12.6b(a,14);a.D.8z=c.l||0;a.D.8y=c.t||0}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){b.T=\'2i\'}A.X.18.58();F d=A(a).cA(14).I(0);A(d).E({11:\'2v\',M:\'2G\',O:\'2G\'});d.Y.4M=\'0\';d.Y.53=\'0\';d.Y.4L=\'0\';d.Y.4K=\'0\';A.X.18.1L(d);F f=A.X.18.I(0).Y;if(a.D.ar){f.V=\'8x\';f.S=\'8x\'}L{f.S=a.D.1w.hb+\'Q\';f.V=a.D.1w.1D+\'Q\'}f.11=\'2v\';f.4M=\'2G\';f.53=\'2G\';f.4L=\'2G\';f.4K=\'2G\';A.1U(a.D.1w,A.12.2f(d));if(a.D.2M){if(a.D.2M.M){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.2M.M;a.D.1w.x=a.D.1A.x-a.D.2M.M}if(a.D.2M.O){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.2M.O;a.D.1w.y=a.D.1A.y-a.D.2M.O}if(a.D.2M.2D){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.1w.hb+a.D.2M.2D;a.D.1w.x=a.D.1A.x-a.D.1w.1D+a.D.2M.2D}if(a.D.2M.4e){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.1w.hb+a.D.2M.4e;a.D.1w.y=a.D.1A.y-a.D.1w.hb+a.D.2M.4e}}a.D.2n=a.D.22.x;a.D.2j=a.D.22.y;if(a.D.7V||a.D.2e==\'7X\'){7Z=A.12.6b(a.2S,14);a.D.1w.x=a.7Y+(A.2R.46?0:A.2R.6l?-7Z.l:7Z.l);a.D.1w.y=a.7t+(A.2R.46?0:A.2R.6l?-7Z.t:7Z.t);A(a.2S).1L(A.X.18.I(0))}if(a.D.2e){A.X.ah(a);a.D.4V.2e=A.X.ae}if(a.D.4P){A.2Q.ad(a)}f.M=a.D.1w.x-a.D.8z+\'Q\';f.O=a.D.1w.y-a.D.8y+\'Q\';f.V=a.D.1w.1D+\'Q\';f.S=a.D.1w.hb+\'Q\';A.X.1g.D.8w=H;if(a.D.gx){a.D.4V.5y=A.X.a9}if(a.D.3j!=H){A.X.18.E(\'3j\',a.D.3j)}if(a.D.1E){A.X.18.E(\'1E\',a.D.1E);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=\'+a.D.1E*1Y+\')\')}}if(a.D.6i){A.X.18.2H(a.D.6i);A.X.18.I(0).6M.Y.11=\'1k\'}if(a.D.4c)a.D.4c.1x(a,[d,a.D.22.x,a.D.22.y]);if(A.1s&&A.1s.7p>0){A.1s.ck(a)}if(a.D.3L==H){b.11=\'1k\'}G H},ah:C(a){if(a.D.2e.1F==8t){if(a.D.2e==\'7X\'){a.D.1Z=A.1U({x:0,y:0},A.12.2f(a.2S));F b=A.12.6b(a.2S,14);a.D.1Z.w=a.D.1Z.1D-b.l-b.r;a.D.1Z.h=a.D.1Z.hb-b.t-b.b}L if(a.D.2e==\'1c\'){F c=A.12.a5();a.D.1Z={x:0,y:0,w:c.w,h:c.h}}}L if(a.D.2e.1F==6h){a.D.1Z={x:R(a.D.2e[0])||0,y:R(a.D.2e[1])||0,w:R(a.D.2e[2])||0,h:R(a.D.2e[3])||0}}a.D.1Z.dx=a.D.1Z.x-a.D.1w.x;a.D.1Z.dy=a.D.1Z.y-a.D.1w.y},8r:C(a){if(a.D.7V||a.D.2e==\'7X\'){A(\'23\',1c).1L(A.X.18.I(0))}A.X.18.58().2x().E(\'1E\',1);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=1Y)\')}},8I:C(e){A(1c).3h(\'3t\',A.X.aE).3h(\'5n\',A.X.8I);if(A.X.1g==P){G}F a=A.X.1g;A.X.1g=P;if(a.D.6g==H){G H}if(a.D.3I==14){A(a).E(\'T\',a.D.49)}F b=a.Y;if(a.4P){A.X.18.E(\'7z\',\'7g\')}if(a.D.6i){A.X.18.3S(a.D.6i)}if(a.D.5B==H){if(a.D.fx>0){if(!a.D.2g||a.D.2g==\'3Z\'){F x=W A.fx(a,{1H:a.D.fx},\'M\');x.1G(a.D.22.x,a.D.7i)}if(!a.D.2g||a.D.2g==\'3K\'){F y=W A.fx(a,{1H:a.D.fx},\'O\');y.1G(a.D.22.y,a.D.7k)}}L{if(!a.D.2g||a.D.2g==\'3Z\')a.Y.M=a.D.7i+\'Q\';if(!a.D.2g||a.D.2g==\'3K\')a.Y.O=a.D.7k+\'Q\'}A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}L if(a.D.fx>0){a.D.8w=14;F c=H;if(A.1s&&A.1p&&a.D.3I){c=A.12.3a(A.1p.18.I(0))}A.X.18.4S({M:c?c.x:a.D.1w.x,O:c?c.y:a.D.1w.y},a.D.fx,C(){a.D.8w=H;if(a.D.3L==H){a.Y.11=a.D.6o}A.X.8r(a)})}L{A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}if(A.1s&&A.1s.7p>0){A.1s.c8(a)}if(A.1p&&a.D.3I){A.1p.c7(a)}if(a.D.2I&&(a.D.7i!=a.D.22.x||a.D.7k!=a.D.22.y)){a.D.2I.1x(a,a.D.aa||[0,0,a.D.7i,a.D.7k])}if(a.D.3C)a.D.3C.1x(a);G H},a9:C(x,y,a,b){if(a!=0)a=R((a+(B.D.gx*a/Z.3B(a))/2)/B.D.gx)*B.D.gx;if(b!=0)b=R((b+(B.D.gy*b/Z.3B(b))/2)/B.D.gy)*B.D.gy;G{dx:a,dy:b,x:0,y:0}},ae:C(x,y,a,b){a=Z.3k(Z.3g(a,B.D.1Z.dx),B.D.1Z.w+B.D.1Z.dx-B.D.1w.1D);b=Z.3k(Z.3g(b,B.D.1Z.dy),B.D.1Z.h+B.D.1Z.dy-B.D.1w.hb);G{dx:a,dy:b,x:0,y:0}},aE:C(e){if(A.X.1g==P||A.X.1g.D.8w==14){G}F a=A.X.1g;a.D.4d=A.12.3W(e);if(a.D.6g==H){3J=Z.cB(Z.5j(a.D.1A.x-a.D.4d.x,2)+Z.5j(a.D.1A.y-a.D.4d.y,2));if(3J0){A.1s.8n(a)}G H},2l:C(o){if(!A.X.18){A(\'23\',1c).1L(\'<1W id="bX">\');A.X.18=A(\'#bX\');F c=A.X.18.I(0);F d=c.Y;d.T=\'1J\';d.11=\'1k\';d.7z=\'7g\';d.bV=\'1k\';d.2N=\'2B\';if(1P.6j){c.aI="bU"}L{d.eZ=\'1k\';d.cH=\'1k\';d.cJ=\'1k\'}}if(!o){o={}}G B.1y(C(){if(B.8L||!A.12)G;if(1P.6j){B.eX=C(){G H};B.eW=C(){G H}}F a=B;F b=o.3c?A(B).eV(o.3c):A(B);if(A.2R.46){b.1y(C(){B.aI="bU"})}L{b.E(\'-eU-6f-7Q\',\'1k\');b.E(\'6f-7Q\',\'1k\');b.E(\'-eT-6f-7Q\',\'1k\')}B.D={cM:b,5B:o.5B?14:H,3L:o.3L?14:H,3I:o.3I?o.3I:H,4P:o.4P?o.4P:H,7V:o.7V?o.7V:H,3j:o.3j?R(o.3j)||0:H,1E:o.1E?2c(o.1E):H,fx:R(o.fx)||P,5z:o.5z?o.5z:H,4V:{},1A:{},4c:o.4c&&o.4c.1F==2w?o.4c:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2I:o.2I&&o.2I.1F==2w?o.2I:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:0,2M:o.2M?o.2M:H,ar:o.ar?14:H,6i:o.6i||H};if(o.4V&&o.4V.1F==2w)B.D.4V.6f=o.4V;if(o.4h&&o.4h.1F==2w)B.D.4h=o.4h;if(o.2e&&((o.2e.1F==8t&&(o.2e==\'7X\'||o.2e==\'1c\'))||(o.2e.1F==6h&&o.2e.1b==4))){B.D.2e=o.2e}if(o.2C){B.D.2C=o.2C}if(o.5y){if(28 o.5y==\'eO\'){B.D.gx=R(o.5y)||1;B.D.gy=R(o.5y)||1}L if(o.5y.1b==2){B.D.gx=R(o.5y[0])||1;B.D.gy=R(o.5y[1])||1}}if(o.3n&&o.3n.1F==2w){B.D.3n=o.3n}B.8L=14;b.1y(C(){B.3H=a});b.1C(\'4R\',A.X.aM)})}};A.fn.1U({8j:A.X.4v,6r:A.X.2l});A.1s={bP:C(a,b,c,d){G a<=A.X.1g.D.2n&&(a+c)>=(A.X.1g.D.2n+A.X.1g.D.1w.w)&&b<=A.X.1g.D.2j&&(b+d)>=(A.X.1g.D.2j+A.X.1g.D.1w.h)?14:H},9S:C(a,b,c,d){G!(a>(A.X.1g.D.2n+A.X.1g.D.1w.w)||(a+c)(A.X.1g.D.2j+A.X.1g.D.1w.h)||(b+d)A.X.1g.D.4d.x&&bA.X.1g.D.4d.y?14:H},4T:H,3z:{},7p:0,3p:{},ck:C(a){if(A.X.1g==P){G}F i;A.1s.3z={};F b=H;1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F c=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+c.1f.a)){if(c.1f.m==H){c.1f.p=A.1U(A.12.6x(c),A.12.6w(c));c.1f.m=14}if(c.1f.ac){A.1s.3p[i].2H(c.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&c.1f.s&&A.X.1g.D.3I){c.1f.el=A(\'.\'+c.1f.a,c);a.Y.11=\'1k\';A.1p.bM(c);c.1f.9P=A.1p.8g(A.1m(c,\'id\')).6A;a.Y.11=a.D.6o;b=14}if(c.1f.9O){c.1f.9O.1x(A.1s.3p[i].I(0),[A.X.1g])}}}}if(b){A.1p.2b()}},eF:C(){A.1s.3z={};1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F a=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+a.1f.a)){a.1f.p=A.1U(A.12.6x(a),A.12.6w(a));if(a.1f.ac){A.1s.3p[i].2H(a.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&a.1f.s&&A.X.1g.D.3I){a.1f.el=A(\'.\'+a.1f.a,a);bJ.Y.11=\'1k\';A.1p.bM(a);bJ.Y.11=bJ.D.6o}}}}},8n:C(e){if(A.X.1g==P){G}A.1s.4T=H;F i;F a=H;F b=0;1V(i in A.1s.3z){F c=A.1s.3z[i].I(0);if(A.1s.4T==H&&A.1s[c.1f.t](c.1f.p.x,c.1f.p.y,c.1f.p.1D,c.1f.p.hb)){if(c.1f.hc&&c.1f.h==H){A.1s.3z[i].2H(c.1f.hc)}if(c.1f.h==H&&c.1f.76){a=14}c.1f.h=14;A.1s.4T=c;if(A.1p&&c.1f.s&&A.X.1g.D.3I){A.1p.18.I(0).2Z=c.1f.eC;A.1p.8n(c)}b++}L if(c.1f.h==14){if(c.1f.6C){c.1f.6C.1x(c,[e,A.X.18.I(0).6M,c.1f.fx])}if(c.1f.hc){A.1s.3z[i].3S(c.1f.hc)}c.1f.h=H}}if(A.1p&&!A.1s.4T&&A.X.1g.3I){A.1p.18.I(0).Y.11=\'1k\'}if(a){A.1s.4T.1f.76.1x(A.1s.4T,[e,A.X.18.I(0).6M])}},c8:C(e){F i;1V(i in A.1s.3z){F a=A.1s.3z[i].I(0);if(a.1f.ac){A.1s.3z[i].3S(a.1f.ac)}if(a.1f.hc){A.1s.3z[i].3S(a.1f.hc)}if(a.1f.s){A.1p.73[A.1p.73.1b]=i}if(a.1f.9I&&a.1f.h==14){a.1f.h=H;a.1f.9I.1x(a,[e,a.1f.fx])}a.1f.m=H;a.1f.h=H}A.1s.3z={}},4v:C(){G B.1y(C(){if(B.8S){if(B.1f.s){id=A.1m(B,\'id\');A.1p.54[id]=P;A(\'.\'+B.1f.a,B).8j()}A.1s.3p[\'d\'+B.bG]=P;B.8S=H;B.f=P}})},2l:C(o){G B.1y(C(){if(B.8S==14||!o.3r||!A.12||!A.X){G}B.1f={a:o.3r,ac:o.9F||H,hc:o.8X||H,eC:o.4G||H,9I:o.je||o.9I||H,76:o.76||o.ev||H,6C:o.6C||o.er||H,9O:o.9O||H,t:o.5T&&(o.5T==\'bP\'||o.5T==\'9S\')?o.5T:\'1A\',fx:o.fx?o.fx:H,m:H,h:H};if(o.bC==14&&A.1p){id=A.1m(B,\'id\');A.1p.54[id]=B.1f.a;B.1f.s=14;if(o.2I){B.1f.2I=o.2I;B.1f.9P=A.1p.8g(id).6A}}B.8S=14;B.bG=R(Z.63()*aW);A.1s.3p[\'d\'+B.bG]=A(B);A.1s.7p++})}};A.fn.1U({ei:A.1s.4v,ee:A.1s.2l});A.jd=A.1s.eF;A.3l={18:P,89:C(){3D=B.2m;if(!3D)G;Y={eb:A(B).E(\'eb\')||\'\',4a:A(B).E(\'4a\')||\'\',87:A(B).E(\'87\')||\'\',e9:A(B).E(\'e9\')||\'\',e8:A(B).E(\'e8\')||\'\',e7:A(B).E(\'e7\')||\'\',bx:A(B).E(\'bx\')||\'\',e6:A(B).E(\'e6\')||\'\'};A.3l.18.E(Y);3i=A.3l.e5(3D);3i=3i.48(W bw("\\\\n","g"),"
    ");A.3l.18.3i(\'j6\');b3=A.3l.18.I(0).3P;A.3l.18.3i(3i);V=A.3l.18.I(0).3P+b3;if(B.66.65&&V>B.66.65[0]){V=B.66.65[0]}B.Y.V=V+\'Q\';if(B.4D==\'bs\'){S=A.3l.18.I(0).5r+b3;if(B.66.65&&S>B.66.65[1]){S=B.66.65[1]}B.Y.S=S+\'Q\'}},e5:C(a){bq={\'&\':\'&j1;\',\'<\':\'&j0;\',\'>\':\'>\',\'"\':\'&iZ;\'};1V(i in bq){a=a.48(W bw(i,\'g\'),bq[i])}G a},2l:C(a){if(A.3l.18==P){A(\'23\',1c).1L(\'<1W id="dX" Y="T: 1J; O: 0; M: 0; 2W: 2B;">\');A.3l.18=A(\'#dX\')}G B.1y(C(){if(/bs|aV/.3M(B.4D)){if(B.4D==\'aV\'){dT=B.4Z(\'1K\');if(!/3D|iW/.3M(dT)){G}}if(a&&(a.1F==bm||(a.1F==6h&&a.1b==2))){if(a.1F==bm)a=[a,a];L{a[0]=R(a[0])||7n;a[1]=R(a[1])||7n}B.66={65:a}}A(B).4W(A.3l.89).5Q(A.3l.89).cV(A.3l.89);A.3l.89.1x(B)}})}};A.fn.iU=A.3l.2l;A.fn.1U({c3:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'4l\',c)})},dP:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'41\',c)})},iQ:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dG\',c)})},iM:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'M\',c)})},iL:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'2D\',c)})},iK:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dF\',c)})}});A.fx.5l=C(e,a,b,c,d){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1N=A.12.2f(e);z.1e=28 b==\'4B\'?b:d||P;if(!e.4f)e.4f=z.el.E(\'11\');if(c==\'dG\'){c=z.el.E(\'11\')==\'1k\'?\'41\':\'4l\'}L if(c==\'dF\'){c=z.el.E(\'11\')==\'1k\'?\'2D\':\'M\'}z.el.1S();z.1l=a;z.29=28 b==\'C\'?b:P;z.fx=A.fx.9u(e);z.6T=c;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.6T==\'41\'||z.6T==\'2D\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(z.fx.U.1o.hb,0);1n;19\'41\':z.fx.2Y.E(\'S\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(0,z.fx.U.1o.hb);1n;19\'M\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(z.fx.U.1o.1D,0);1n;19\'2D\':z.fx.2Y.E(\'V\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(0,z.fx.U.1o.1D);1n}};A.fn.iA=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.eu(B,a,b);e.bE()})};A.fx.eu=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.29=b;z.8e=R(a)||40;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.74=5;z.52=1;z.bE=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:io,1T:C(){z.e=W A.fx(z.el.I(0),{1H:80,1T:C(){z.8e=R(z.8e/2);if(z.52<=z.74)z.bE();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'O\');z.e.1G(z.U.O-z.8e,z.U.O)}},\'O\');z.e.1G(z.U.O,z.U.O-z.8e)}};A.fn.1U({im:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3U\',c)})},ik:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'in\',c)})},ii:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3E\',c)})},ig:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3U\',c)})},ie:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'in\',c)})},ic:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3E\',c)})},ib:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3U\',c)})},ia:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'in\',c)})},i9:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3E\',c)})},i8:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3U\',c)})},i7:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'in\',c)})},i6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3E\',c)})}});A.fx.3Y=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.U={};z.U.T=z.el.E(\'T\');z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(!e.4f)e.4f=z.el.E(\'11\');if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}z.el.1S();if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.1K=d;b=28 b==\'C\'?b:P;7N=1;2X(c){19\'4l\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;7N=-1;1n;19\'41\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;1n;19\'2D\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;1n;19\'M\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;7N=-1;1n}z.e2=W A.fx(z.el.I(0),A.1l(a,z.1e,C(){z.el.E(z.U);if(z.1K==\'3U\'){z.el.E(\'11\',\'1k\')}L z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f);A.2z(z.el.I(0),\'1j\')}),\'1E\');if(d==\'in\'){z.e.1G(z.5x+1Y*7N,z.5x);z.e2.1G(0,1)}L{z.e.1G(z.5x,z.5x+1Y*7N);z.e2.1G(1,0)}};A.fn.1U({i5:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'dq\',d)})},i4:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'9g\',d)})},i3:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'3E\',d)})}});A.fx.9h=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 c==\'4B\'?c:f||P;z.29=28 c==\'C\'?c:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'9g\':\'dq\'}z.1l=a;z.S=b&&b.1F==bm?b:20;z.fx=A.fx.9u(e);z.1K=d;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.1K==\'9g\'){z.el.1S()}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};if(z.1K==\'9g\'){z.el.1S();z.fx.2Y.E(\'S\',z.S+\'Q\').E(\'V\',\'9e\');z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');z.ef.1G(z.S,z.fx.U.1o.hb)}),\'V\');z.ef.1G(0,z.fx.U.1o.1D)}L{z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');z.ef.1G(z.fx.U.1o.1D,0)}),\'S\');z.ef.1G(z.fx.U.1o.hb,z.S)}};A.fn.i2=C(c,d,e,f){G B.1r(\'dp\',C(){B.6Q=A(B).1m("Y")||\'\';f=28 e==\'4B\'?e:f||P;e=28 e==\'C\'?e:P;F a=A(B).E(\'6P\');F b=B.2S;6k(a==\'b7\'&&b){a=A(b).E(\'6P\');b=b.2S}A(B).E(\'6P\',d);if(28 B.6Q==\'7M\')B.6Q=B.6Q["9d"];A(B).4S({\'6P\':a},c,f,C(){A.2z(B,\'dp\');if(28 A(B).1m("Y")==\'7M\'){A(B).1m("Y")["9d"]="";A(B).1m("Y")["9d"]=B.6Q}L{A(B).1m("Y",B.6Q)}if(e)e.1x(B)})})};A.4n=C(e){if(/^i1$|^i0$|^hZ$|^5W$|^hY$|^hX$|^hW$|^hV$|^hU$|^23$|^hT$|^hS$|^hR$|^hQ$|^hP$|^hO$|^hN$/i.3M(e.98))G H;L G 14};A.fx.9n=C(e,a){F c=e.6M;F b=c.Y;b.T=a.T;b.4M=a.3s.t;b.4K=a.3s.l;b.4L=a.3s.b;b.53=a.3s.r;b.O=a.O+\'Q\';b.M=a.M+\'Q\';e.2S.dn(c,e);e.2S.hM(e)};A.fx.9u=C(e){if(!A.4n(e))G H;F t=A(e);F a=e.Y;F b=H;if(t.E(\'11\')==\'1k\'){95=t.E(\'2W\');t.E(\'2W\',\'2B\').1S();b=14}F c={};c.T=t.E(\'T\');c.1o=A.12.2f(e);c.3s=A.12.b2(e);F d=e.4u?e.4u.dk:t.E(\'hK\');c.O=R(t.E(\'O\'))||0;c.M=R(t.E(\'M\'))||0;F f=\'hJ\'+R(Z.63()*aW);F g=1c.3x(/^3O$|^br$|^hI$|^hr$|^7Q$|^hH$|^7M$|^3q$|^hF$|^hE$|^hC$|^90$|^dl$|^hB$/i.3M(e.98)?\'1W\':e.98);A.1m(g,\'id\',f);F h=A(g).2H(\'hA\');F i=g.Y;F j=0;F k=0;if(c.T==\'2i\'||c.T==\'1J\'){j=c.O;k=c.M}i.O=j+\'Q\';i.M=k+\'Q\';i.T=c.T!=\'2i\'&&c.T!=\'1J\'?\'2i\':c.T;i.S=c.1o.hb+\'Q\';i.V=c.1o.1D+\'Q\';i.4M=c.3s.t;i.53=c.3s.r;i.4L=c.3s.b;i.4K=c.3s.l;i.2N=\'2B\';if(A.2R.46){i.dk=d}L{i.hz=d}if(A.2R=="46"){a.4X="7s(1E="+0.dg*1Y+")"}a.1E=0.dg;e.2S.dn(g,e);g.hy(e);a.4M=\'2G\';a.53=\'2G\';a.4L=\'2G\';a.4K=\'2G\';a.T=\'1J\';a.bV=\'1k\';a.O=\'2G\';a.M=\'2G\';if(b){t.2x();a.2W=95}G{U:c,2Y:A(g)}};A.fx.7H={hx:[0,1O,1O],hw:[dd,1O,1O],hv:[db,db,hu],hs:[0,0,0],hq:[0,0,1O],hp:[d6,42,42],hn:[0,1O,1O],hm:[0,0,6N],hl:[0,6N,6N],hk:[aX,aX,aX],hi:[0,1Y,0],hg:[hf,he,cZ],hd:[6N,0,6N],ha:[85,cZ,47],h7:[1O,cY,0],h6:[h5,50,h4],h3:[6N,0,0],h2:[h1,cX,h0],gZ:[gY,0,8U],gX:[1O,0,1O],gW:[1O,gU,0],gT:[0,67,0],gS:[75,0,gQ],gP:[dd,cU,cY],gO:[gL,gK,cU],gI:[cT,1O,1O],gH:[cS,gG,cS],gF:[8U,8U,8U],gD:[1O,gC,gB],gA:[1O,1O,cT],gw:[0,1O,0],gv:[1O,0,1O],gu:[67,0,0],gs:[0,0,67],gr:[67,67,0],gq:[1O,d6,0],gp:[1O,8R,gn],gm:[67,0,67],gl:[1O,0,0],gk:[8R,8R,8R],gj:[1O,1O,1O],gi:[1O,1O,0]};A.fx.5L=C(a,b){if(A.fx.7H[a])G{r:A.fx.7H[a][0],g:A.fx.7H[a][1],b:A.fx.7H[a][2]};L if(2L=/^6v\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.8Q(a))G{r:R(2L[1]),g:R(2L[2]),b:R(2L[3])};L if(2L=/6v\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.8Q(a))G{r:2c(2L[1])*2.55,g:2c(2L[2])*2.55,b:2c(2L[3])*2.55};L if(2L=/^#([a-fA-6t-9])([a-fA-6t-9])([a-fA-6t-9])$/.8Q(a))G{r:R("6s"+2L[1]+2L[1]),g:R("6s"+2L[2]+2L[2]),b:R("6s"+2L[3]+2L[3])};L if(2L=/^#([a-fA-6t-9]{2})([a-fA-6t-9]{2})([a-fA-6t-9]{2})$/.8Q(a))G{r:R("6s"+2L[1]),g:R("6s"+2L[2]),b:R("6s"+2L[3])};L G b==14?H:{r:1O,g:1O,b:1O}};A.fx.cQ={5d:1,4y:1,5i:1,4x:1,4e:1,4a:1,S:1,M:1,bx:1,gh:1,4L:1,4K:1,53:1,4M:1,7y:1,5R:1,7x:1,8O:1,1E:1,ge:1,gc:1,4Q:1,4F:1,5g:1,5b:1,2D:1,gb:1,O:1,V:1,3j:1};A.fx.cN={6P:1,ga:1,g9:1,g8:1,g7:1,g6:1,g5:1};A.fx.7v=[\'g4\',\'g3\',\'g2\',\'g1\'];A.fx.aL={\'aK\':[\'2u\',\'cK\'],\'8E\':[\'2u\',\'aH\'],\'5X\':[\'5X\',\'\'],\'7E\':[\'7E\',\'\']};A.fn.1U({4S:C(b,c,d,f){G B.1r(C(){F a=A.1l(c,d,f);F e=W A.cI(B,a,b)})},aG:C(b,c){G B.1r(C(){F a=A.1l(b,c);F e=W A.aG(B,a)})},7w:C(a){G B.1y(C(){if(B.5e)A.aF(B,a)})},fZ:C(a){G B.1y(C(){if(B.5e)A.aF(B,a);if(B.1r&&B.1r[\'fx\'])B.1r.fx=[]})}});A.1U({aG:C(a,b){F z=B,5f;z.3f=C(){if(A.cF(b.1T))b.1T.1x(a)};z.2A=5Y(C(){z.3f()},b.1H);a.5e=z},1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a}},cI:C(f,g,h){F z=B,5f;F y=f.Y;F k=A.E(f,"2N");F l=A.E(f,"11");F o={};z.9a=(W 6p()).6y();g.1e=g.1e&&A.1e[g.1e]?g.1e:\'b1\';z.8H=C(a,b){if(A.fx.cQ[a]){if(b==\'1S\'||b==\'2x\'||b==\'3E\'){if(!f.5I)f.5I={};F r=2c(A.5S(f,a));f.5I[a]=r&&r>-aW?r:(2c(A.E(f,a))||0);b=b==\'3E\'?(l==\'1k\'?\'1S\':\'2x\'):b;g[b]=14;o[a]=b==\'1S\'?[0,f.5I[a]]:[f.5I[a],0];if(a!=\'1E\')y[a]=o[a][0]+(a!=\'3j\'&&a!=\'87\'?\'Q\':\'\');L A.1m(y,"1E",o[a][0])}L{o[a]=[2c(A.5S(f,a)),2c(b)||0]}}L if(A.fx.cN[a])o[a]=[A.fx.5L(A.5S(f,a)),A.fx.5L(b)];L if(/^5X$|7E$|2u$|8E$|aK$/i.3M(a)){F m=b.48(/\\s+/g,\' \').48(/6v\\s*\\(\\s*/g,\'6v(\').48(/\\s*,\\s*/g,\',\').48(/\\s*\\)/g,\')\').aD(/([^\\s]+)/g);2X(a){19\'5X\':19\'7E\':19\'aK\':19\'8E\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];1V(F i=0;ig.1H+z.9a){5h(z.2A);z.2A=P;1V(p in o){if(p=="1E")A.1m(y,"1E",o[p][1]);L if(28 o[p][1]==\'7M\')y[p]=\'6v(\'+o[p][1].r+\',\'+o[p][1].g+\',\'+o[p][1].b+\')\';L y[p]=o[p][1]+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}if(g.2x||g.1S)1V(F p in f.5I)if(p=="1E")A.1m(y,p,f.5I[p]);L y[p]="";y.11=g.2x?\'1k\':(l!=\'1k\'?l:\'2v\');y.2N=k;f.5e=P;if(A.cF(g.1T))g.1T.1x(f)}L{F n=t-B.9a;F a=n/g.1H;1V(p in o){if(28 o[p][1]==\'7M\'){y[p]=\'6v(\'+R(A.1e[g.1e](a,n,o[p][0].r,(o[p][1].r-o[p][0].r),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].g,(o[p][1].g-o[p][0].g),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].b,(o[p][1].b-o[p][0].b),g.1H))+\')\'}L{F b=A.1e[g.1e](a,n,o[p][0],(o[p][1]-o[p][0]),g.1H);if(p=="1E")A.1m(y,"1E",b);L y[p]=b+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}}}};z.2A=5Y(C(){z.3f()},13);f.5e=z},aF:C(a,b){if(b)a.5e.9a-=fJ;L{1P.5h(a.5e.2A);a.5e=P;A.2z(a,"fx")}}});A.ax=C(a){F b={};if(28 a==\'4B\'){a=a.5u().6W(\';\');1V(F i=0;i0){z.cy=1o[i];z.4a=2c(z.U.4a)}if(z.U.4x.3o(1o[i])>0){z.cx=1o[i];z.aq=2c(z.U.4x)||0}if(z.U.5i.3o(1o[i])>0){z.cw=1o[i];z.ap=2c(z.U.5i)||0}if(z.U.5d.3o(1o[i])>0){z.cv=1o[i];z.ao=2c(z.U.5d)||0}if(z.U.4y.3o(1o[i])>0){z.cu=1o[i];z.an=2c(z.U.4y)||0}if(z.U.5b.3o(1o[i])>0){z.ct=1o[i];z.am=2c(z.U.5b)||0}if(z.U.5g.3o(1o[i])>0){z.cr=1o[i];z.al=2c(z.U.5g)||0}if(z.U.4Q.3o(1o[i])>0){z.cq=1o[i];z.ak=2c(z.U.4Q)||0}if(z.U.4F.3o(1o[i])>0){z.cp=1o[i];z.aj=2c(z.U.4F)||0}}if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\');z.1K=m;2X(z.1K){19\'cz\':z.3V=z.O+z.26.h/2;z.4H=z.O;z.3Q=z.M+z.26.w/2;z.4r=z.M;1n;19\'as\':z.4H=z.O+z.26.h/2;z.3V=z.O;z.4r=z.M+z.26.w/2;z.3Q=z.M;1n;19\'5c\':z.4H=z.O-z.26.h/4;z.3V=z.O;z.4r=z.M-z.26.w/4;z.3Q=z.M;1n}z.ai=H;z.t=(W 6p).6y();z.4i=C(){5h(z.2A);z.2A=P};z.3f=C(){if(z.ai==H){z.el.1S();z.ai=14}F t=(W 6p).6y();F n=t-z.t;F p=n/z.1H;if(t>=z.1H+z.t){97(C(){o=1;if(z.1K){t=z.4H;l=z.4r;if(z.1K==\'5c\')o=0}z.ag(z.3v,l,t,14,o)},13);z.4i()}L{o=1;if(!A.1e||!A.1e[z.1e]){s=((-Z.51(p*Z.2F)/2)+0.5)*(z.3v-z.6m)+z.6m}L{s=A.1e[z.1e](p,n,z.6m,(z.3v-z.6m),z.1H)}if(z.1K){if(!A.1e||!A.1e[z.1e]){t=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V;l=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q;if(z.1K==\'5c\')o=((-Z.51(p*Z.2F)/2)+0.5)*(-0.9B)+0.9B}L{t=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.1H);l=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.1H);if(z.1K==\'5c\')o=A.1e[z.1e](p,n,0.9B,-0.9B,z.1H)}}z.ag(s,l,t,H,o)}};z.2A=5Y(C(){z.3f()},13);z.ag=C(a,b,c,d,e){z.el.E(\'S\',z.S*a/1Y+\'Q\').E(\'V\',z.V*a/1Y+\'Q\').E(\'M\',b+\'Q\').E(\'O\',c+\'Q\').E(\'4a\',z.4a*a/1Y+z.cy);if(z.aq)z.el.E(\'4x\',z.aq*a/1Y+z.cx);if(z.ap)z.el.E(\'5i\',z.ap*a/1Y+z.cw);if(z.ao)z.el.E(\'5d\',z.ao*a/1Y+z.cv);if(z.an)z.el.E(\'4y\',z.an*a/1Y+z.cu);if(z.am)z.el.E(\'5b\',z.am*a/1Y+z.ct);if(z.al)z.el.E(\'5g\',z.al*a/1Y+z.cr);if(z.ak)z.el.E(\'4Q\',z.ak*a/1Y+z.cq);if(z.aj)z.el.E(\'4F\',z.aj*a/1Y+z.cp);if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+e*1Y+")";z.el.I(0).Y.1E=e}if(d){if(z.bL){z.el.E(z.U)}if(z.1K==\'as\'||z.1K==\'5c\'){z.el.E(\'11\',\'1k\');if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+1Y+")";z.el.I(0).Y.1E=1}}L z.el.E(\'11\',\'2v\');if(z.29)z.29.1x(z.el.I(0));A.2z(z.el.I(0),\'1j\')}}};A.fn.1U({9A:C(a,b,c){o=A.1l(a);G B.1r(\'1j\',C(){W A.fx.9A(B,o,b,c)})},ft:C(a,b,c){G B.1y(C(){A(\'a[@2U*="#"]\',B).4U(C(e){co=B.2U.6W(\'#\');A(\'#\'+co[1]).9A(a,b,c);G H})})}});A.fx.9A=C(e,o,a,b){F z=B;z.o=o;z.e=e;z.2g=/cn|cm/.3M(a)?a:H;z.1e=b;p=A.12.3a(e);s=A.12.5O();z.4i=C(){5h(z.2A);z.2A=P;A.2z(z.e,\'1j\')};z.t=(W 6p).6y();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.4H=p.y>s.h?s.h:p.y;z.4r=p.x>s.w?s.w:p.x;z.3V=s.t;z.3Q=s.l;z.3f=C(){F t=(W 6p).6y();F n=t-z.t;F p=n/z.o.1H;if(t>=z.o.1H+z.t){z.4i();97(C(){z.ab(z.4H,z.4r)},13)}L{if(!z.2g||z.2g==\'cn\'){if(!A.1e||!A.1e[z.1e]){8v=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V}L{8v=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.o.1H)}}L{8v=z.3V}if(!z.2g||z.2g==\'cm\'){if(!A.1e||!A.1e[z.1e]){8u=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q}L{8u=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.o.1H)}}L{8u=z.3Q}z.ab(8v,8u)}};z.ab=C(t,l){1P.fs(l,t)};z.2A=5Y(C(){z.3f()},13)};A.fn.a8=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.a8(B,a,b);e.a7()})};A.fx.a8=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.74=R(a)||3;z.29=b;z.52=1;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.a7=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(e,{1H:60,1T:C(){if(z.52<=z.74)z.a7();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'M\');z.e.1G(z.U.M-20,z.U.M)}},\'M\');z.e.1G(z.U.M+20,z.U.M-20)}},\'M\');z.e.1G(z.U.M,z.U.M+20)}};A.fn.1U({dR:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'in\',c)})},c6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3U\',c)})},fr:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3E\',c)})},fq:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'in\',c)})},fp:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3U\',c)})},fo:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3E\',c)})},fm:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'in\',c)})},fl:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3U\',c)})},fk:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3E\',c)})},fj:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'in\',c)})},fi:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3U\',c)})},fh:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3E\',c)})}});A.fx.1u=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}if(!e.4f)e.4f=z.el.E(\'11\');z.el.1S();z.1l=a;z.fx=A.fx.9u(e);z.1K=d;z.6T=c;z.1T=C(){if(z.1K==\'3U\')z.el.E(\'2W\',\'2B\');A.fx.9n(z.fx.2Y.I(0),z.fx.U);if(z.1K==\'in\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.E(\'11\',\'1k\');z.el.E(\'2W\',\'cl\')}if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'S\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.hb,0);z.79.1G(0,z.fx.U.1o.hb)}L{z.ef.1G(0,-z.fx.U.1o.hb);z.79.1G(z.fx.U.1o.hb,0)}1n;19\'41\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.hb,0)}L{z.ef.1G(0,z.fx.U.1o.hb)}1n;19\'M\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'V\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.1D,0);z.79.1G(0,z.fx.U.1o.1D)}L{z.ef.1G(0,-z.fx.U.1o.1D);z.79.1G(z.fx.U.1o.1D,0)}1n;19\'2D\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.1D,0)}L{z.ef.1G(0,z.fx.U.1o.1D)}1n}};A.2O=P;A.fn.fg=C(o){G B.1r(\'1j\',C(){W A.fx.cj(B,o)})};A.fx.cj=C(e,o){if(A.2O==P){A(\'23\',1c).1L(\'<1W id="2O">\');A.2O=A(\'#2O\')}A.2O.E(\'11\',\'2v\').E(\'T\',\'1J\');F z=B;z.el=A(e);if(!o||!o.3v){G}if(o.3v.1F==8t&&1c.7o(o.3v)){o.3v=1c.7o(o.3v)}L if(!o.3v.ci){G}if(!o.1H){o.1H=ch}z.1H=o.1H;z.3v=o.3v;z.7e=o.2Z;z.1T=o.1T;if(z.7e){A.2O.2H(z.7e)}z.8s=0;z.8i=0;if(A.e0){z.8s=(R(A.2O.E(\'4y\'))||0)+(R(A.2O.E(\'5i\'))||0)+(R(A.2O.E(\'4F\'))||0)+(R(A.2O.E(\'5g\'))||0);z.8i=(R(A.2O.E(\'4x\'))||0)+(R(A.2O.E(\'5d\'))||0)+(R(A.2O.E(\'5b\'))||0)+(R(A.2O.E(\'4Q\'))||0)}z.2b=A.1U(A.12.3a(z.el.I(0)),A.12.2f(z.el.I(0)));z.3m=A.1U(A.12.3a(z.3v),A.12.2f(z.3v));z.2b.1D-=z.8s;z.2b.hb-=z.8i;z.3m.1D-=z.8s;z.3m.hb-=z.8i;z.29=o.1T;A.2O.E(\'V\',z.2b.1D+\'Q\').E(\'S\',z.2b.hb+\'Q\').E(\'O\',z.2b.y+\'Q\').E(\'M\',z.2b.x+\'Q\').4S({O:z.3m.y,M:z.3m.x,V:z.3m.1D,S:z.3m.hb},z.1H,C(){if(z.7e)A.2O.3S(z.7e);A.2O.E(\'11\',\'1k\');if(z.1T&&z.1T.1F==2w){z.1T.1x(z.el.I(0),[z.3v])}A.2z(z.el.I(0),\'1j\')})};A.1q={24:{2u:10,cf:\'1R/ff.ce\',cd:\'<3O 2E="1R/5o.cc" />\',cb:0.8,ca:\'fb 8G\',c9:\'6m\',3F:7n},fa:H,f8:H,5A:P,7m:H,7l:H,a3:C(a){if(!A.1q.7l||A.1q.7m)G;F b=a.6S||a.6R||-1;2X(b){19 35:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f7\').I(0));1n;19 36:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f6\').I(0));1n;19 37:19 8:19 33:19 80:19 f4:F c=A(\'#7j\');if(c.I(0).4q!=P){c.I(0).4q.1x(c.I(0))}1n;19 38:1n;19 39:19 34:19 32:19 fd:19 78:F d=A(\'#7h\');if(d.I(0).4q!=P){d.I(0).4q.1x(d.I(0))}1n;19 40:1n;19 27:A.1q.8q();1n}},6g:C(a){if(a)A.1U(A.1q.24,a);if(1P.3N){A(\'23\',1c).1C(\'5Q\',A.1q.a3)}L{A(1c).1C(\'5Q\',A.1q.a3)}A(\'a\').1y(C(){el=A(B);c5=el.1m(\'4o\')||\'\';c4=el.1m(\'2U\')||\'\';cg=/\\.cc|\\.f2|\\.7q|\\.ce|\\.f1/g;if(c4.5u().aD(cg)!=P&&c5.5u().3o(\'c2\')==0){el.1C(\'4U\',A.1q.2b)}});if(A.2R.46){3q=1c.3x(\'3q\');A(3q).1m({id:\'a1\',2E:\'dc:H;\',da:\'b0\',d7:\'b0\'}).E({11:\'1k\',T:\'1J\',O:\'0\',M:\'0\',4X:\'9x:9C.9E.a6(1E=0)\'});A(\'23\').1L(3q)}7r=1c.3x(\'1W\');A(7r).1m(\'id\',\'a0\').E({T:\'1J\',11:\'1k\',O:\'0\',M:\'0\',1E:0}).1L(1c.8b(\' \')).1C(\'4U\',A.1q.8q);5C=1c.3x(\'1W\');A(5C).1m(\'id\',\'c0\').E({4F:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Z=1c.3x(\'1W\');A(9Z).1m(\'id\',\'bY\').E({4F:A.1q.24.2u+\'Q\',4Q:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Y=1c.3x(\'a\');A(9Y).1m({id:\'f0\',2U:\'#\'}).E({T:\'1J\',2D:A.1q.24.2u+\'Q\',O:\'0\'}).1L(A.1q.24.cd).1C(\'4U\',A.1q.8q);6Z=1c.3x(\'1W\');A(6Z).1m(\'id\',\'9X\').E({T:\'2i\',9W:\'M\',5X:\'0 8x\',3j:1}).1L(5C).1L(9Z).1L(9Y);21=1c.3x(\'3O\');21.2E=A.1q.24.cf;A(21).1m(\'id\',\'bW\').E({T:\'1J\'});5G=1c.3x(\'a\');A(5G).1m({id:\'7j\',2U:\'#\'}).E({T:\'1J\',11:\'1k\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));5F=1c.3x(\'a\');A(5F).1m({id:\'7h\',2U:\'#\'}).E({T:\'1J\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));2q=1c.3x(\'1W\');A(2q).1m(\'id\',\'bT\').E({11:\'1k\',T:\'2i\',2N:\'2B\',9W:\'M\',5X:\'0 8x\',O:\'0\',M:\'0\',3j:2}).1L([21,5G,5F]);5Z=1c.3x(\'1W\');A(5Z).1m(\'id\',\'8m\').E({11:\'1k\',T:\'1J\',2N:\'2B\',O:\'0\',M:\'0\',9W:\'az\',6P:\'b7\',eY:\'0\'}).1L([2q,6Z]);A(\'23\').1L(7r).1L(5Z)},2b:C(e,a){el=a?A(a):A(B);8J=el.1m(\'4o\');F b,4E,5G,5F;if(8J!=\'c2\'){A.1q.5A=8J;7F=A(\'a[@4o=\'+8J+\']\');b=7F.1N();4E=7F.aY(a?a:B);5G=7F.I(4E-1);5F=7F.I(4E+1)}aw=el.1m(\'2U\');5C=el.1m(\'3T\');3R=A.12.5O();7r=A(\'#a0\');if(!A.1q.7l){A.1q.7l=14;if(A.2R.46){A(\'#a1\').E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S()}7r.E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S().bS(bz,A.1q.24.cb,C(){A.1q.aB(aw,5C,3R,b,4E,5G,5F)});A(\'#8m\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\')}L{A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.aB(aw,5C,3R,b,4E,5G,5F)}G H},aB:C(a,b,c,d,e,f,g){A(\'#aA\').9U();8l=A(\'#7j\');8l.2x();8k=A(\'#7h\');8k.2x();21=A(\'#bW\');2q=A(\'#bT\');5Z=A(\'#8m\');6Z=A(\'#9X\').E(\'2W\',\'2B\');A(\'#c0\').3i(5C);A.1q.7m=14;if(d)A(\'#bY\').3i(A.1q.24.ca+\' \'+(e+1)+\' \'+A.1q.24.c9+\' \'+d);if(f){8l.I(0).4q=C(){B.4W();A.1q.2b(P,f);G H}}if(g){8k.I(0).4q=C(){B.4W();A.1q.2b(P,g);G H}}21.1S();7u=A.12.2f(2q.I(0));4C=Z.3g(7u.1D,21.I(0).V+A.1q.24.2u*2);59=Z.3g(7u.hb,21.I(0).S+A.1q.24.2u*2);21.E({M:(4C-21.I(0).V)/2+\'Q\',O:(59-21.I(0).S)/2+\'Q\'});2q.E({V:4C+\'Q\',S:59+\'Q\'}).1S();bQ=A.12.a5();5Z.E(\'O\',c.t+(bQ.h/15)+\'Q\');if(5Z.E(\'11\')==\'1k\'){5Z.1S().6U(A.1q.24.3F)}5H=W 8M;A(5H).1m(\'id\',\'aA\').1C(\'eP\',C(){4C=5H.V+A.1q.24.2u*2;59=5H.S+A.1q.24.2u*2;21.2x();2q.4S({S:59},7u.hb!=59?A.1q.24.3F:1,C(){2q.4S({V:4C},7u.1D!=4C?A.1q.24.3F:1,C(){2q.aJ(5H);A(5H).E({T:\'1J\',M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\'}).6U(A.1q.24.3F,C(){cL=A.12.2f(6Z.I(0));if(f){8l.E({M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}if(g){8k.E({M:4C/2+A.1q.24.2u*2+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}6Z.E({V:4C+\'Q\',O:-cL.hb+\'Q\',2W:\'cl\'}).4S({O:-1},A.1q.24.3F,C(){A.1q.7m=H})})})})});5H.2E=a},8q:C(){A(\'#aA\').9U();A(\'#8m\').2x();A(\'#9X\').E(\'2W\',\'2B\');A(\'#a0\').bS(bz,0,C(){A(B).2x();if(A.2R.46){A(\'#a1\').2x()}});A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.5A=P;A.1q.7l=H;A.1q.7m=H;G H}};A.N={1v:P,3A:P,1g:P,1A:P,1o:P,T:P,7f:C(e){A.N.1g=(B.9T)?B.9T:B;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(A.N.1g).E(\'V\'))||0,S:R(A(A.N.1g).E(\'S\'))||0};A.N.T={O:R(A(A.N.1g).E(\'O\'))||0,M:R(A(A.N.1g).E(\'M\'))||0};A(1c).1C(\'3t\',A.N.aO).1C(\'5n\',A.N.aN);if(28 A.N.1g.1h.bO===\'C\'){A.N.1g.1h.bO.1x(A.N.1g)}G H},aN:C(e){A(1c).3h(\'3t\',A.N.aO).3h(\'5n\',A.N.aN);if(28 A.N.1g.1h.cO===\'C\'){A.N.1g.1h.cO.1x(A.N.1g)}A.N.1g=P},aO:C(e){if(!A.N.1g){G}1A=A.12.3W(e);6c=A.N.T.O-A.N.1A.y+1A.y;77=A.N.T.M-A.N.1A.x+1A.x;6c=Z.3g(Z.3k(6c,A.N.1g.1h.7d-A.N.1o.S),A.N.1g.1h.6F);77=Z.3g(Z.3k(77,A.N.1g.1h.7c-A.N.1o.V),A.N.1g.1h.6u);if(28 A.N.1g.1h.4h===\'C\'){F a=A.N.1g.1h.4h.1x(A.N.1g,[77,6c]);if(28 a==\'eI\'&&a.1b==2){77=a[0];6c=a[1]}}A.N.1g.Y.O=6c+\'Q\';A.N.1g.Y.M=77+\'Q\';G H},2b:C(e){A(1c).1C(\'3t\',A.N.7g).1C(\'5n\',A.N.7w);A.N.1v=B.1v;A.N.3A=B.3A;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(B.1v).E(\'V\'))||0,S:R(A(B.1v).E(\'S\'))||0};A.N.T={O:R(A(B.1v).E(\'O\'))||0,M:R(A(B.1v).E(\'M\'))||0};if(A.N.1v.1h.4c){A.N.1v.1h.4c.1x(A.N.1v,[B])}G H},7w:C(){A(1c).3h(\'3t\',A.N.7g).3h(\'5n\',A.N.7w);if(A.N.1v.1h.3C){A.N.1v.1h.3C.1x(A.N.1v,[A.N.3A])}A.N.1v=P;A.N.3A=P},5N:C(a,b){G Z.3k(Z.3g(A.N.1o.V+a*b,A.N.1v.1h.8O),A.N.1v.1h.5R)},5M:C(a,b){G Z.3k(Z.3g(A.N.1o.S+a*b,A.N.1v.1h.7x),A.N.1v.1h.7y)},bN:C(a){G Z.3k(Z.3g(a,A.N.1v.1h.7x),A.N.1v.1h.7y)},7g:C(e){if(A.N.1v==P){G}1A=A.12.3W(e);dx=1A.x-A.N.1A.x;dy=1A.y-A.N.1A.y;1B={V:A.N.1o.V,S:A.N.1o.S};2s={O:A.N.T.O,M:A.N.T.M};2X(A.N.3A){19\'e\':1B.V=A.N.5N(dx,1);1n;19\'eH\':1B.V=A.N.5N(dx,1);1B.S=A.N.5M(dy,1);1n;19\'w\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'9R\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1B.S=A.N.5M(dy,1);1n;19\'7a\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'n\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1n;19\'9Q\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,1);1n;19\'s\':1B.S=A.N.5M(dy,1);1n}if(A.N.1v.1h.44){if(A.N.3A==\'n\'||A.N.3A==\'s\')43=1B.S*A.N.1v.1h.44;L 43=1B.V;4z=A.N.bN(43*A.N.1v.1h.44);43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.S=4z;1B.V=43}if(2s.OA.N.1v.1h.7d){1B.S=A.N.1v.1h.7d-2s.O;if(A.N.1v.1h.44){1B.V=1B.S/A.N.1v.1h.44}}if(2s.M+1B.V>A.N.1v.1h.7c){1B.V=A.N.1v.1h.7c-2s.M;if(A.N.1v.1h.44){1B.S=1B.V*A.N.1v.1h.44}}F a=H;if(A.N.1v.1h.eG){a=A.N.1v.1h.eG.1x(A.N.1v,[1B,2s]);if(a){if(a.1o){A.1U(1B,a.1o)}if(a.T){A.1U(2s,a.T)}}}8f=A.N.1v.Y;8f.M=2s.M+\'Q\';8f.O=2s.O+\'Q\';8f.V=1B.V+\'Q\';8f.S=1B.S+\'Q\';G H},2l:C(b){if(!b||!b.3G||b.3G.1F!=6E){G}G B.1y(C(){F a=B;a.1h=b;a.1h.8O=b.8O||10;a.1h.7x=b.7x||10;a.1h.5R=b.5R||5P;a.1h.7y=b.7y||5P;a.1h.6F=b.6F||-8V;a.1h.6u=b.6u||-8V;a.1h.7c=b.7c||5P;a.1h.7d=b.7d||5P;bK=A(a).E(\'T\');if(!(bK==\'2i\'||bK==\'1J\')){a.Y.T=\'2i\'}eE=/n|9Q|e|eH|s|9R|w|7a/g;1V(i in a.1h.3G){if(i.5u().aD(eE)!=P){if(a.1h.3G[i].1F==8t){3c=A(a.1h.3G[i]);if(3c.1N()>0){a.1h.3G[i]=3c.I(0)}}if(a.1h.3G[i].4D){a.1h.3G[i].1v=a;a.1h.3G[i].3A=i;A(a.1h.3G[i]).1C(\'4R\',A.N.2b)}}}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){9N=A(a.1h.5k);if(9N.1N()>0){9N.1y(C(){B.9T=a});9N.1C(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).1C(\'4R\',A.N.7f)}}})},4v:C(){G B.1y(C(){F a=B;1V(i in a.1h.3G){a.1h.3G[i].1v=P;a.1h.3G[i].3A=P;A(a.1h.3G[i]).3h(\'4R\',A.N.2b)}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){3c=A(a.1h.5k);if(3c.1N()>0){3c.3h(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).3h(\'4R\',A.N.7f)}}a.1h=P})}};A.fn.1U({jk:A.N.2l,jj:A.N.4v});A.2t=P;A.6J=H;A.31=P;A.6B=[];A.9L=C(e){F a=e.6S||e.6R||-1;if(a==17||a==16){A.6J=14}};A.9J=C(e){A.6J=H};A.eB=C(e){B.f.1A=A.12.3W(e);B.f.1I=A.1U(A.12.3a(B),A.12.2f(B));B.f.4p=A.12.5O(B);B.f.1A.x-=B.f.1I.x;B.f.1A.y-=B.f.1I.y;A(B).1L(A.2t.I(0));if(B.f.hc)A.2t.2H(B.f.hc).E(\'11\',\'2v\');A.2t.E({11:\'2v\',V:\'2G\',S:\'2G\'});if(B.f.o){A.2t.E(\'1E\',B.f.o)}A.31=B;A.7A=H;A.6B=[];B.f.el.1y(C(){B.1I={x:B.7Y+(B.4u&&!A.2R.6l?R(B.4u.4y)||0:0)+(A.31.2P||0),y:B.7t+(B.4u&&!A.2R.6l?R(B.4u.4x)||0:0)+(A.31.2T||0),1D:B.3P,hb:B.5r};if(B.s==14){if(A.6J==H){B.s=H;A(B).3S(A.31.f.71)}L{A.7A=14;A.6B[A.6B.1b]=A.1m(B,\'id\')}}});A.9H.1x(B,[e]);A(1c).1C(\'3t\',A.9H).1C(\'5n\',A.bI);G H};A.9H=C(e){if(!A.31)G;A.eA.1x(A.31,[e])};A.eA=C(e){if(!A.31)G;F a=A.12.3W(e);F b=A.12.5O(A.31);a.x+=b.l-B.f.4p.l-B.f.1I.x;a.y+=b.t-B.f.4p.t-B.f.1I.y;F c=Z.3k(a.x,B.f.1A.x);F d=Z.3k(Z.3B(a.x-B.f.1A.x),Z.3B(B.f.4p.w-c));F f=Z.3k(a.y,B.f.1A.y);F g=Z.3k(Z.3B(a.y-B.f.1A.y),Z.3B(B.f.4p.h-f));if(B.2T>0&&a.y-20B.2T+B.f.1I.h){F h=Z.3k(B.f.4p.h-B.2T,10);B.2T+=h;if(B.2T!=b.t)g+=h}if(B.2P>0&&a.x-20B.2P+B.f.1I.w){F h=Z.3k(B.f.4p.w-B.2P,10);B.2P+=h;if(B.2P!=b.l)d+=h}A.2t.E({M:c+\'Q\',O:f+\'Q\',V:d+\'Q\',S:g+\'Q\'});A.2t.l=c+B.f.4p.l;A.2t.t=f+B.f.4p.t;A.2t.r=A.2t.l+d;A.2t.b=A.2t.t+g;A.7A=H;B.f.el.1y(C(){9G=A.6B.3o(A.1m(B,\'id\'));if(!(B.1I.x>A.2t.r||(B.1I.x+B.1I.1D)A.2t.b||(B.1I.y+B.1I.hb)0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[o.1b]=A.1m(B,\'id\')}})}G{6A:h,o:o}};A.fn.jg=C(o){if(!A.2t){A(\'23\',1c).1L(\'<1W id="2t">\').1C(\'70\',A.9L).1C(\'5Q\',A.9J);A.2t=A(\'#2t\');A.2t.E({T:\'1J\',11:\'1k\'});if(1P.3N){A(\'23\',1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}L{A(1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}}if(!o){o={}}G B.1y(C(){if(B.ey)G;B.ey=14;B.f={a:o.3r,o:o.1E?2c(o.1E):H,71:o.ex?o.ex:H,hc:o.4G?o.4G:H,8d:o.8d?o.8d:H,8c:o.8c?o.8c:H};B.f.el=A(\'.\'+o.3r);A(B).1C(\'4R\',A.eB).E(\'T\',\'2i\')})};A.2Q={aT:1,ew:C(b){F b=b;G B.1y(C(){B.4g.69.1y(C(a){A.2Q.4s(B,b[a])})})},I:C(){F e=[];B.1y(C(b){if(B.bD){e[b]=[];F c=B;F d=A.12.2f(B);B.4g.69.1y(C(a){F x=B.7Y;F y=B.7t;7B=R(x*1Y/(d.w-B.3P));7C=R(y*1Y/(d.h-B.5r));e[b][a]=[7B||0,7C||0,x||0,y||0]})}});G e},ad:C(a){a.D.ep=a.D.1Z.w-a.D.1w.1D;a.D.eo=a.D.1Z.h-a.D.1w.hb;if(a.92.4g.bB){8Z=a.92.4g.69.I(a.bA+1);if(8Z){a.D.1Z.w=(R(A(8Z).E(\'M\'))||0)+a.D.1w.1D;a.D.1Z.h=(R(A(8Z).E(\'O\'))||0)+a.D.1w.hb}9f=a.92.4g.69.I(a.bA-1);if(9f){F b=R(A(9f).E(\'M\'))||0;F c=R(A(9f).E(\'M\'))||0;a.D.1Z.x+=b;a.D.1Z.y+=c;a.D.1Z.w-=b;a.D.1Z.h-=c}}a.D.ek=a.D.1Z.w-a.D.1w.1D;a.D.ej=a.D.1Z.h-a.D.1w.hb;if(a.D.2C){a.D.gx=((a.D.1Z.w-a.D.1w.1D)/a.D.2C)||1;a.D.gy=((a.D.1Z.h-a.D.1w.hb)/a.D.2C)||1;a.D.d1=a.D.ek/a.D.2C;a.D.d0=a.D.ej/a.D.2C}a.D.1Z.dx=a.D.1Z.x-a.D.22.x;a.D.1Z.dy=a.D.1Z.y-a.D.22.y;A.X.18.E(\'7z\',\'8T\')},3n:C(a,x,y){if(a.D.2C){d9=R(x/a.D.d1);7B=d9*1Y/a.D.2C;d5=R(y/a.D.d0);7C=d5*1Y/a.D.2C}L{7B=R(x*1Y/a.D.ep);7C=R(y*1Y/a.D.eo)}a.D.aa=[7B||0,7C||0,x||0,y||0];if(a.D.3n)a.D.3n.1x(a,a.D.aa)},d3:C(a){6K=a.6S||a.6R||-1;2X(6K){19 35:A.2Q.4s(B.3H,[91,91]);1n;19 36:A.2Q.4s(B.3H,[-91,-91]);1n;19 37:A.2Q.4s(B.3H,[-B.3H.D.gx||-1,0]);1n;19 38:A.2Q.4s(B.3H,[0,-B.3H.D.gy||-1]);1n;19 39:A.2Q.4s(B.3H,[B.3H.D.gx||1,0]);1n;19 40:A.X.4s(B.3H,[0,B.3H.D.gy||1]);1n}},4s:C(a,b){if(!a.D){G}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.49=A.E(a,\'T\');if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){a.Y.T=\'2i\'}A.X.ah(a);A.2Q.ad(a);dx=R(b[0])||0;dy=R(b[1])||0;2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.2C){57=A.X.a9.1x(a,[2n,2j,dx,dy]);if(57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy}57=A.X.ae.1x(a,[2n,2j,dx,dy]);if(57&&57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,2n,2j)}2n=!a.D.2g||a.D.2g==\'3Z\'?2n:a.D.22.x||0;2j=!a.D.2g||a.D.2g==\'3K\'?2j:a.D.22.y||0;a.Y.M=2n+\'Q\';a.Y.O=2j+\'Q\'},2l:C(o){G B.1y(C(){if(B.bD==14||!o.3r||!A.12||!A.X||!A.1s){G}4Y=A(o.3r,B);if(4Y.1N()==0){G}F b={2e:\'7X\',4P:14,3n:o.3n&&o.3n.1F==2w?o.3n:P,2I:o.2I&&o.2I.1F==2w?o.2I:P,3c:B,1E:o.1E||H};if(o.2C&&R(o.2C)){b.2C=R(o.2C)||1;b.2C=b.2C>0?b.2C:1}if(4Y.1N()==1)4Y.6r(b);L{A(4Y.I(0)).6r(b);b.3c=P;4Y.6r(b)}4Y.70(A.2Q.d3);4Y.1m(\'aT\',A.2Q.aT++);B.bD=14;B.4g={};B.4g.ec=b.ec;B.4g.2C=b.2C;B.4g.69=4Y;B.4g.bB=o.bB?14:H;by=B;by.4g.69.1y(C(a){B.bA=a;B.92=by});if(o.5f&&o.5f.1F==6h){1V(i=o.5f.1b-1;i>=0;i--){if(o.5f[i].1F==6h&&o.5f[i].1b==2){el=B.4g.69.I(i);if(el.4D){A.2Q.4s(el,o.5f[i])}}}}})}};A.fn.1U({jc:A.2Q.2l,jb:A.2Q.ew,ja:A.2Q.I});A.2p={56:[],ea:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},di:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d-1;1R=A(\'3O\',1d.J.4O);if(1u<1){1u=1d.J.1R.1b}1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},2A:C(c){1d=1c.7o(c);if(1d.J.63){1u=1d.J.3d;6k(1u==1d.J.3d){1u=1+R(Z.63()*1d.J.1R.1b)}}L{1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},go:C(o){F a;if(o&&o.1F==6E){if(o.21){a=1c.7o(o.21.1d);5v=1P.j8.2U.6W("#");o.21.5J=P;if(5v.1b==2){1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}L{1u=1}}if(o.84){o.84.4W();a=o.84.2S.2S;id=A.1m(a,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}5v=o.84.2U.6W("#");1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}if(a.J.1R.1b<1u||1u<1){1u=1}a.J.3d=1u;4t=A.12.2f(a);e4=A.12.9y(a);e3=A.12.6b(a);if(a.J.3e){a.J.3e.o.E(\'11\',\'1k\')}if(a.J.3b){a.J.3b.o.E(\'11\',\'1k\')}if(a.J.21){y=R(e4.t)+R(e3.t);if(a.J.1Q){if(a.J.1Q.4J==\'O\'){y+=a.J.1Q.45.hb}L{4t.h-=a.J.1Q.45.hb}}if(a.J.2o){if(a.J.2o&&a.J.2o.5V==\'O\'){y+=a.J.2o.45.hb}L{4t.h-=a.J.2o.45.hb}}if(!a.J.bu){a.J.e1=o.21?o.21.S:(R(a.J.21.E(\'S\'))||0);a.J.bu=o.21?o.21.V:(R(a.J.21.E(\'V\'))||0)}a.J.21.E(\'O\',y+(4t.h-a.J.e1)/2+\'Q\');a.J.21.E(\'M\',(4t.1D-a.J.bu)/2+\'Q\');a.J.21.E(\'11\',\'2v\')}1R=A(\'3O\',a.J.4O);if(1R.1N()>0){1R.6d(a.J.3F,A.2p.7J)}L{9w=A(\'a\',a.J.1Q.o).I(1u-1);A(9w).2H(a.J.1Q.5s);F b=W 8M();b.1d=A.1m(a,\'id\');b.1u=1u-1;b.2E=a.J.1R[a.J.3d-1].2E;if(b.1T){b.5J=P;A.2p.11.1x(b)}L{b.5J=A.2p.11}if(a.J.2o){a.J.2o.o.3i(a.J.1R[1u-1].5W)}}}},7J:C(){1d=B.2S.2S;1d.J.4O.E(\'11\',\'1k\');if(1d.J.1Q.5s){9w=A(\'a\',1d.J.1Q.o).3S(1d.J.1Q.5s).I(1d.J.3d-1);A(9w).2H(1d.J.1Q.5s)}F a=W 8M();a.1d=A.1m(1d,\'id\');a.1u=1d.J.3d-1;a.2E=1d.J.1R[1d.J.3d-1].2E;if(a.1T){a.5J=P;A.2p.11.1x(a)}L{a.5J=A.2p.11}if(1d.J.2o){1d.J.2o.o.3i(1d.J.1R[1d.J.3d-1].5W)}},11:C(){1d=1c.7o(B.1d);if(1d.J.3e){1d.J.3e.o.E(\'11\',\'1k\')}if(1d.J.3b){1d.J.3b.o.E(\'11\',\'1k\')}4t=A.12.2f(1d);y=0;if(1d.J.1Q){if(1d.J.1Q.4J==\'O\'){y+=1d.J.1Q.45.hb}L{4t.h-=1d.J.1Q.45.hb}}if(1d.J.2o){if(1d.J.2o&&1d.J.2o.5V==\'O\'){y+=1d.J.2o.45.hb}L{4t.h-=1d.J.2o.45.hb}}j4=A(\'.bt\',1d);y=y+(4t.h-B.S)/2;x=(4t.1D-B.V)/2;1d.J.4O.E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').3i(\'<3O 2E="\'+B.2E+\'" />\');1d.J.4O.6U(1d.J.3F);3b=1d.J.3d+1;if(3b>1d.J.1R.1b){3b=1}3e=1d.J.3d-1;if(3e<1){3e=1d.J.1R.1b}1d.J.3b.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+2*B.V/3+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3b-1].5W);1d.J.3b.o.I(0).2U=\'#\'+3b+A.1m(1d,\'id\');1d.J.3e.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3e-1].5W);1d.J.3e.o.I(0).2U=\'#\'+3e+A.1m(1d,\'id\')},2l:C(o){if(!o||!o.2q||A.2p.56[o.2q])G;F a=A(\'#\'+o.2q);F c=a.I(0);if(c.Y.T!=\'1J\'&&c.Y.T!=\'2i\'){c.Y.T=\'2i\'}c.Y.2N=\'2B\';if(a.1N()==0)G;c.J={};c.J.1R=o.1R?o.1R:[];c.J.63=o.63&&o.63==14||H;7T=c.dj(\'j3\');1V(i=0;i<7T.1b;i++){6e=c.J.1R.1b;c.J.1R[6e]={2E:7T[i].2E,5W:7T[i].3T||7T[i].j2||\'\'}}if(c.J.1R.1b==0){G}c.J.49=A.1U(A.12.3a(c),A.12.2f(c));c.J.bp=A.12.9y(c);c.J.bo=A.12.6b(c);t=R(c.J.bp.t)+R(c.J.bo.t);b=R(c.J.bp.b)+R(c.J.bo.b);A(\'3O\',c).9U();c.J.3F=o.3F?o.3F:ch;if(o.4J||o.82||o.5s){c.J.1Q={};a.1L(\'<1W 68="dZ">\');c.J.1Q.o=A(\'.dZ\',c);if(o.82){c.J.1Q.82=o.82;c.J.1Q.o.2H(o.82)}if(o.5s){c.J.1Q.5s=o.5s}c.J.1Q.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.4J&&o.4J==\'O\'){c.J.1Q.4J=\'O\';c.J.1Q.o.E(\'O\',t+\'Q\')}L{c.J.1Q.4J=\'4e\';c.J.1Q.o.E(\'4e\',b+\'Q\')}c.J.1Q.9v=o.9v?o.9v:\' \';1V(F i=0;i\'+6e+\'\'+(6e!=c.J.1R.1b?c.J.1Q.9v:\'\'))}A(\'a\',c.J.1Q.o).1C(\'4U\',C(){A.2p.go({84:B})});c.J.1Q.45=A.12.2f(c.J.1Q.o.I(0))}if(o.5V||o.81){c.J.2o={};a.1L(\'<1W 68="dW">&6G;\');c.J.2o.o=A(\'.dW\',c);if(o.81){c.J.2o.81=o.81;c.J.2o.o.2H(o.81)}c.J.2o.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.5V&&o.5V==\'O\'){c.J.2o.5V=\'O\';c.J.2o.o.E(\'O\',(c.J.1Q&&c.J.1Q.4J==\'O\'?c.J.1Q.45.hb+t:t)+\'Q\')}L{c.J.2o.5V=\'4e\';c.J.2o.o.E(\'4e\',(c.J.1Q&&c.J.1Q.4J==\'4e\'?c.J.1Q.45.hb+b:b)+\'Q\')}c.J.2o.45=A.12.2f(c.J.2o.o.I(0))}if(o.9j){c.J.3b={9j:o.9j};a.1L(\'&6G;\');c.J.3b.o=A(\'.dV\',c);c.J.3b.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3b.9j);c.J.3b.o.1C(\'4U\',A.2p.ea)}if(o.9t){c.J.3e={9t:o.9t};a.1L(\'&6G;\');c.J.3e.o=A(\'.dS\',c);c.J.3e.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3e.9t);c.J.3e.o.1C(\'4U\',A.2p.di)}a.aJ(\'<1W 68="bt">\');c.J.4O=A(\'.bt\',c);c.J.4O.E(\'T\',\'1J\').E(\'O\',\'2G\').E(\'M\',\'2G\').E(\'11\',\'1k\');if(o.21){a.aJ(\'<1W 68="dz" Y="11: 1k;"><3O 2E="\'+o.21+\'" />\');c.J.21=A(\'.dz\',c);c.J.21.E(\'T\',\'1J\');F d=W 8M();d.1d=o.2q;d.2E=o.21;if(d.1T){d.5J=P;A.2p.go({21:d})}L{d.5J=C(){A.2p.go({21:B})}}}L{A.2p.go({2q:c})}if(o.ba){dQ=R(o.ba)*8V}A.2p.56[o.2q]=o.ba?1P.5Y(\'A.2p.2A(\\\'\'+o.2q+\'\\\')\',dQ):P}};A.1d=A.2p.2l;A.1p={73:[],54:{},18:H,6X:P,2b:C(){if(A.X.1g==P){G}F a,3s,c,cs;A.1p.18.I(0).2Z=A.X.1g.D.5z;a=A.1p.18.I(0).Y;a.11=\'2v\';A.1p.18.1w=A.1U(A.12.3a(A.1p.18.I(0)),A.12.2f(A.1p.18.I(0)));a.V=A.X.1g.D.1w.1D+\'Q\';a.S=A.X.1g.D.1w.hb+\'Q\';3s=A.12.b2(A.X.1g);a.4M=3s.t;a.53=3s.r;a.4L=3s.b;a.4K=3s.l;if(A.X.1g.D.3L==14){c=A(A.X.1g).cA(14).I(0);cs=c.Y;cs.4M=\'2G\';cs.53=\'2G\';cs.4L=\'2G\';cs.4K=\'2G\';cs.11=\'2v\';A.1p.18.58().1L(c)}A(A.X.1g).dO(A.1p.18.I(0));A.X.1g.Y.11=\'1k\'},c7:C(e){if(!e.D.3I&&A.1s.4T.bC){if(e.D.3C)e.D.3C.1x(1g);A(e).E(\'T\',e.D.av||e.D.49);A(e).8j();A(A.1s.4T).dN(e)}A.1p.18.3S(e.D.5z).3i(\'&6G;\');A.1p.6X=P;F a=A.1p.18.I(0).Y;a.11=\'1k\';A.1p.18.dO(e);if(e.D.fx>0){A(e).6U(e.D.fx)}A(\'23\').1L(A.1p.18.I(0));F b=[];F c=H;1V(F i=0;i0){c(b)}},8n:C(e,o){if(!A.X.1g)G;F a=H;F i=0;if(e.1f.el.1N()>0){1V(i=e.1f.el.1N();i>0;i--){if(e.1f.el.I(i-1)!=A.X.1g){if(!e.5t.bb){if((e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}L{1n}}L{if((e.1f.el.I(i-1).1I.x+e.1f.el.I(i-1).1I.1D/2)>A.X.1g.D.2n&&(e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}}}}}if(a&&A.1p.6X!=a){A.1p.6X=a;A(a).iT(A.1p.18.I(0))}L if(!a&&(A.1p.6X!=P||A.1p.18.I(0).2S!=e)){A.1p.6X=P;A(e).1L(A.1p.18.I(0))}A.1p.18.I(0).Y.11=\'2v\'},bM:C(e){if(A.X.1g==P){G}e.1f.el.1y(C(){B.1I=A.1U(A.12.6w(B),A.12.6x(B))})},8g:C(s){F i;F h=\'\';F o={};if(s){if(A.1p.54[s]){o[s]=[];A(\'#\'+s+\' .\'+A.1p.54[s]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[s][o[s].1b]=A.1m(B,\'id\')})}L{1V(a in s){if(A.1p.54[s[a]]){o[s[a]]=[];A(\'#\'+s[a]+\' .\'+A.1p.54[s[a]]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s[a]+\'[]=\'+A.1m(B,\'id\');o[s[a]][o[s[a]].1b]=A.1m(B,\'id\')})}}}}L{1V(i in A.1p.54){o[i]=[];A(\'#\'+i+\' .\'+A.1p.54[i]).1y(C(){if(h.1b>0){h+=\'&\'}h+=i+\'[]=\'+A.1m(B,\'id\');o[i][o[i].1b]=A.1m(B,\'id\')})}}G{6A:h,o:o}},dL:C(e){if(!e.ci){G}G B.1y(C(){if(!B.5t||!A(e).is(\'.\'+B.5t.3r))A(e).2H(B.5t.3r);A(e).6r(B.5t.D)})},4v:C(){G B.1y(C(){A(\'.\'+B.5t.3r).8j();A(B).ei();B.5t=P;B.dK=P})},2l:C(o){if(o.3r&&A.12&&A.X&&A.1s){if(!A.1p.18){A(\'23\',1c).1L(\'<1W id="dJ">&6G;\');A.1p.18=A(\'#dJ\');A.1p.18.I(0).Y.11=\'1k\'}B.ee({3r:o.3r,9F:o.9F?o.9F:H,8X:o.8X?o.8X:H,4G:o.4G?o.4G:H,76:o.76||o.ev,6C:o.6C||o.er,bC:14,2I:o.2I||o.iR,fx:o.fx?o.fx:H,3L:o.3L?14:H,5T:o.5T?o.5T:\'9S\'});G B.1y(C(){F a={5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,4c:o.4c&&o.4c.1F==2w?o.4c:H,4h:o.4h&&o.4h.1F==2w?o.4h:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:H,2M:o.2M?o.2M:H};A(\'.\'+o.3r,B).6r(a);B.dK=14;B.5t={3r:o.3r,5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,bb:o.bb?14:H,D:a}})}}};A.fn.1U({iP:A.1p.2l,dN:A.1p.dL,iO:A.1p.4v});A.iN=A.1p.8g;A.2k={62:P,9o:H,9p:P,6a:C(e){A.2k.9o=14;A.2k.1S(e,B,14)},bk:C(e){if(A.2k.62!=B)G;A.2k.9o=H;A.2k.2x(e,B)},1S:C(e,a,b){if(A.2k.62!=P)G;if(!a){a=B}A.2k.62=a;1I=A.1U(A.12.3a(a),A.12.2f(a));7U=A(a);3T=7U.1m(\'3T\');2U=7U.1m(\'2U\');if(3T){A.2k.9p=3T;7U.1m(\'3T\',\'\');A(\'#dE\').3i(3T);if(2U)A(\'#bj\').3i(2U.48(\'iI://\',\'\'));L A(\'#bj\').3i(\'\');18=A(\'#7S\');if(a.4m.2Z){18.I(0).2Z=a.4m.2Z}L{18.I(0).2Z=\'\'}bi=A.12.2f(18.I(0));dD=b&&a.4m.T==\'bn\'?\'4e\':a.4m.T;2X(dD){19\'O\':2j=1I.y-bi.hb;2n=1I.x;1n;19\'M\':2j=1I.y;2n=1I.x-bi.1D;1n;19\'2D\':2j=1I.y;2n=1I.x+1I.1D;1n;19\'bn\':A(\'23\').1C(\'3t\',A.2k.3t);1A=A.12.3W(e);2j=1A.y+15;2n=1A.x+15;1n;8T:2j=1I.y+1I.hb;2n=1I.x;1n}18.E({O:2j+\'Q\',M:2n+\'Q\'});if(a.4m.4w==H){18.1S()}L{18.6U(a.4m.4w)}if(a.4m.2K)a.4m.2K.1x(a);7U.1C(\'86\',A.2k.2x).1C(\'4W\',A.2k.bk)}},3t:C(e){if(A.2k.62==P){A(\'23\').3h(\'3t\',A.2k.3t);G}1A=A.12.3W(e);A(\'#7S\').E({O:1A.y+15+\'Q\',M:1A.x+15+\'Q\'})},2x:C(e,a){if(!a){a=B}if(A.2k.9o!=14&&A.2k.62==a){A.2k.62=P;A(\'#7S\').6d(1);A(a).1m(\'3T\',A.2k.9p).3h(\'86\',A.2k.2x).3h(\'4W\',A.2k.bk);if(a.4m.2V)a.4m.2V.1x(a);A.2k.9p=P}},2l:C(b){if(!A.2k.18){A(\'23\').1L(\'<1W id="7S"><1W id="dE"><1W id="bj">\');A(\'#7S\').E({T:\'1J\',3j:5P,11:\'1k\'});A.2k.18=14}G B.1y(C(){if(A.1m(B,\'3T\')){B.4m={T:/O|4e|M|2D|bn/.3M(b.T)?b.T:\'4e\',2Z:b.2Z?b.2Z:H,4w:b.4w?b.4w:H,2K:b.2K&&b.2K.1F==2w?b.2K:H,2V:b.2V&&b.2V.1F==2w?b.2V:H};F a=A(B);a.1C(\'9r\',A.2k.1S);a.1C(\'6a\',A.2k.6a)}})}};A.fn.iH=A.2k.2l;A.7O={bl:C(e){6K=e.6S||e.6R||-1;if(6K==9){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(B.9q){1c.64.dv().3D="\\t";B.dB=C(){B.6a();B.dB=P}}L if(B.9m){2b=B.88;3m=B.dA;B.2m=B.2m.iG(0,2b)+"\\t"+B.2m.iF(3m);B.9m(2b+1,2b+1);B.6a()}G H}},4v:C(){G B.1y(C(){if(B.6V&&B.6V==14){A(B).3h(\'70\',A.7O.bl);B.6V=H}})},2l:C(){G B.1y(C(){if(B.4D==\'bs\'&&(!B.6V||B.6V==H)){A(B).1C(\'70\',A.7O.bl);B.6V=14}})}};A.fn.1U({iD:A.7O.2l,iC:A.7O.4v});A.12={3a:C(e){F x=0;F y=0;F a=e.Y;F b=H;if(A(e).E(\'11\')==\'1k\'){F c=a.2W;F d=a.T;b=14;a.2W=\'2B\';a.11=\'2v\';a.T=\'1J\'}F f=e;6k(f){x+=f.7Y+(f.4u&&!A.2R.6l?R(f.4u.4y)||0:0);y+=f.7t+(f.4u&&!A.2R.6l?R(f.4u.4x)||0:0);f=f.dY}f=e;6k(f&&f.4D&&f.4D.5u()!=\'23\'){x-=f.2P||0;y-=f.2T||0;f=f.2S}if(b==14){a.11=\'1k\';a.T=d;a.2W=c}G{x:x,y:y}},6x:C(a){F x=0,y=0;6k(a){x+=a.7Y||0;y+=a.7t||0;a=a.dY}G{x:x,y:y}},2f:C(e){F w=A.E(e,\'V\');F h=A.E(e,\'S\');F a=0;F b=0;F c=e.Y;if(A(e).E(\'11\')!=\'1k\'){a=e.3P;b=e.5r}L{F d=c.2W;F f=c.T;c.2W=\'2B\';c.11=\'2v\';c.T=\'1J\';a=e.3P;b=e.5r;c.11=\'1k\';c.T=f;c.2W=d}G{w:w,h:h,1D:a,hb:b}},6w:C(a){G{1D:a.3P||0,hb:a.5r||0}},a5:C(e){F h,w,de;if(e){w=e.83;h=e.7P}L{de=1c.4A;w=1P.bg||9z.bg||(de&&de.83)||1c.23.83;h=1P.bf||9z.bf||(de&&de.7P)||1c.23.7P}G{w:w,h:h}},5O:C(e){F t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.98.5u()!=\'23\'){t=e.2T;l=e.2P;w=e.be;h=e.bd;iw=0;ih=0}L{if(1c.4A){t=1c.4A.2T;l=1c.4A.2P;w=1c.4A.be;h=1c.4A.bd}L if(1c.23){t=1c.23.2T;l=1c.23.2P;w=1c.23.be;h=1c.23.bd}iw=9z.bg||1c.4A.83||1c.23.83||0;ih=9z.bf||1c.4A.7P||1c.23.7P||0}G{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},b2:C(e,a){F c=A(e);F t=c.E(\'4M\')||\'\';F r=c.E(\'53\')||\'\';F b=c.E(\'4L\')||\'\';F l=c.E(\'4K\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},9y:C(e,a){F c=A(e);F t=c.E(\'5b\')||\'\';F r=c.E(\'5g\')||\'\';F b=c.E(\'4Q\')||\'\';F l=c.E(\'4F\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},6b:C(e,a){F c=A(e);F t=c.E(\'4x\')||\'\';F r=c.E(\'5i\')||\'\';F b=c.E(\'5d\')||\'\';F l=c.E(\'4y\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)||0};L G{t:t,r:r,b:b,l:l}},3W:C(a){F x=a.iB||(a.iz+(1c.4A.2P||1c.23.2P))||0;F y=a.iy||(a.ix+(1c.4A.2T||1c.23.2T))||0;G{x:x,y:y}},bH:C(a,b){b(a);a=a.6M;6k(a){A.12.bH(a,b);a=a.iv}},ji:C(c){A.12.bH(c,C(a){1V(F b in a){if(28 a[b]===\'C\'){a[b]=P}}})},ir:C(a,b){F c=A.12.5O();F d=A.12.2f(a);if(!b||b==\'3K\')A(a).E({O:c.t+((Z.3g(c.h,c.ih)-c.t-d.hb)/2)+\'Q\'});if(!b||b==\'3Z\')A(a).E({M:c.l+((Z.3g(c.w,c.iw)-c.l-d.1D)/2)+\'Q\'})},iq:C(a,b){F c=A(\'3O[@2E*="7q"]\',a||1c),7q;c.1y(C(){7q=B.2E;B.2E=b;B.Y.4X="9x:9C.9E.ip(2E=\'"+7q+"\')"})}};[].3o||(6h.jn.3o=C(v,n){n=(n==P)?0:n;F m=B.1b;1V(F i=n;i1){override=true;i++;} if(typeof arguments[i]=="object"){for(var option in arguments[i]) if(typeof ctx[option]!="undefined") ctx[option]=arguments[i][option];i++;} if(typeof arguments[i]=="number"||(typeof arguments[i]=="string"&&arguments[i].match(RegExp("^[0-9]+[smhdw]$")))) ctx["time"]=arguments[i++];if(typeof arguments[i]=="boolean") ctx["repeat"]=arguments[i++];if(typeof arguments[i]=="boolean") ctx["protect"]=arguments[i++];if(typeof arguments[i]=="object"&&typeof arguments[i+1]=="string"&&_isfn(arguments[i][arguments[i+1]])){ctx["obj"]=arguments[i++];ctx["func"]=arguments[i++];} else if(typeof arguments[i]!="undefined"&&(_isfn(arguments[i])||typeof arguments[i]=="string")) ctx["func"]=arguments[i++];while(typeof arguments[i]!="undefined") ctx["args"].push(arguments[i++]);if(override){if(typeof arguments[1]=="object"){for(var option in arguments[0]) if(typeof ctx[option]!="undefined"&&typeof arguments[1][option]=="undefined") ctx[option]=arguments[0][option];} else{for(var option in arguments[0]) if(typeof ctx[option]!="undefined") ctx[option]=arguments[0][option];} i++;} ctx["_scheduler"]=this;ctx["_handle"]=null;var match=String(ctx["time"]).match(RegExp("^([0-9]+)([smhdw])$"));if(match&&match[0]!="undefined"&&match[1]!="undefined") ctx["time"]=String(parseInt(match[1])*{s:1000,m:1000*60,h:1000*60*60,d:1000*60*60*24,w:1000*60*60*24*7}[match[2]]);if(ctx["id"]==null) ctx["id"]=(String(ctx["repeat"])+":" +String(ctx["protect"])+":" +String(ctx["time"])+":" +String(ctx["obj"])+":" +String(ctx["func"])+":" +String(ctx["args"]));if(ctx["protect"]) if(typeof this.bucket[ctx["id"]]!="undefined") return this.bucket[ctx["id"]];if(!_isfn(ctx["func"])){if(ctx["obj"]!=null&&typeof ctx["obj"]=="object"&&typeof ctx["func"]=="string"&&_isfn(ctx["obj"][ctx["func"]])) ctx["func"]=ctx["obj"][ctx["func"]];else ctx["func"]=eval("function () { "+ctx["func"]+" }");} ctx["_handle"]=this._schedule(ctx);this.bucket[ctx["id"]]=ctx;return ctx;},reschedule:function(ctx){if(typeof ctx=="string") ctx=this.bucket[ctx];ctx["_handle"]=this._schedule(ctx);return ctx;},_schedule:function(ctx){var trampoline=function(){var obj=(ctx["obj"]!=null?ctx["obj"]:ctx);(ctx["func"]).apply(obj,ctx["args"]);if(typeof(ctx["_scheduler"]).bucket[ctx["id"]]!="undefined"&&ctx["repeat"]) (ctx["_scheduler"])._schedule(ctx);else delete(ctx["_scheduler"]).bucket[ctx["id"]];};return setTimeout(trampoline,ctx["time"]);},cancel:function(ctx){if(typeof ctx=="string") ctx=this.bucket[ctx];if(typeof ctx=="object"){clearTimeout(ctx["_handle"]);delete this.bucket[ctx["id"]];}}};$.extend({scheduler$:new $.scheduler(),schedule:function(){return $.scheduler$.schedule.apply($.scheduler$,arguments)},reschedule:function(){return $.scheduler$.reschedule.apply($.scheduler$,arguments)},cancel:function(){return $.scheduler$.cancel.apply($.scheduler$,arguments)}});$.fn.extend({schedule:function(){var a=[{}];for(var i=0;i35?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}('(H(){J w=1c.4I,3n$=1c.$;J D=1c.4I=1c.$=H(a,b){I 2r D.18.5i(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,61=/^.[^:#\\[\\.]*$/,12;D.18=D.3V={5i:H(d,b){d=d||S;G(d.15){7[0]=d;7.K=1;I 7}G(1j d=="1W"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.60(c[3]);G(a){G(a.2t!=c[3])I D().2u(d);I D(a)}d=[]}}N I D(b).2u(d)}N G(D.1F(d))I D(S)[D.18.25?"25":"3Y"](d);I 7.6V(D.2h(d))},5w:"1.2.6",8H:H(){I 7.K},K:0,3p:H(a){I a==12?D.2h(7):7[a]},2F:H(b){J a=D(b);a.5n=7;I a},6V:H(a){7.K=0;2q.3V.1A.1t(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5h:H(b){J a=-1;I D.2E(b&&b.5w?b[0]:b,7)},1M:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1M"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1k d)D.1M(b?7.V:7,c,D.1e(7,d[c],b,i,c))})},1h:H(b,a){G((b==\'2d\'||b==\'1T\')&&3e(a)<0)a=12;I 7.1M(b,a,"24")},1r:H(b){G(1j b!="3y"&&b!=U)I 7.4F().3s((7[0]&&7[0].2z||S).5J(b));J a="";D.P(b||7,H(){D.P(7.3u,H(){G(7.15!=8)a+=7.15!=1?7.73:D.18.1r([7])})});I a},5W:H(b){G(7[0])D(b,7[0].2z).5y().38(7[0]).2i(H(){J a=7;1G(a.1s)a=a.1s;I a}).3s(7);I 7},8Z:H(a){I 7.P(H(){D(7).6P().5W(a)})},8S:H(a){I 7.P(H(){D(7).5W(a)})},3s:H(){I 7.3S(1a,M,Q,H(a){G(7.15==1)7.49(a)})},6E:H(){I 7.3S(1a,M,M,H(a){G(7.15==1)7.38(a,7.1s)})},6D:H(){I 7.3S(1a,Q,Q,H(a){7.1f.38(a,7)})},5p:H(){I 7.3S(1a,Q,M,H(a){7.1f.38(a,7.2J)})},3m:H(){I 7.5n||D([])},2u:H(b){J c=D.2i(7,H(a){I D.2u(b,a)});I 7.2F(/[^+>] [^+>]/.11(b)||b.1i("..")>-1?D.4u(c):c)},5y:H(e){J f=7.2i(H(){G(D.14.1g&&!D.4o(7)){J a=7.6n(M),5f=S.3t("1w");5f.49(a);I D.4h([5f.4l])[0]}N I 7.6n(M)});J d=f.2u("*").5M().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2u("*").5M().P(H(i){G(7.15==3)I;J c=D.L(7,"3x");R(J a 1k c)R(J b 1k c[a])D.W.17(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2F(D.1F(b)&&D.3G(7,H(a,i){I b.1l(a,i)})||D.3f(b,7))},4W:H(b){G(b.1q==56)G(61.11(b))I 7.2F(D.3f(b,7,M));N b=D.3f(b,7);J a=b.K&&b[b.K-1]!==12&&!b.15;I 7.1E(H(){I a?D.2E(7,b)<0:7!=b})},17:H(a){I 7.2F(D.4u(D.39(7.3p(),1j a==\'1W\'?D(a):D.2h(a))))},3C:H(a){I!!a&&D.3f(a,7).K>0},7V:H(a){I 7.3C("."+a)},6a:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2y")){J e=c.63,62=[],16=c.16,2Y=c.O=="2y-2Y";G(e<0)I U;R(J i=2Y?e:0,2e=2Y?e+1:16.K;i<2e;i++){J d=16[i];G(d.3a){b=D.14.1g&&!d.au.2s.aq?d.1r:d.2s;G(2Y)I b;62.1A(b)}}I 62}N I(7[0].2s||"").1o(/\\r/g,"")}I 12}G(b.1q==4N)b+=\'\';I 7.P(H(){G(7.15!=1)I;G(b.1q==2q&&/5R|5A/.11(7.O))7.4M=(D.2E(7.2s,b)>=0||D.2E(7.32,b)>=0);N G(D.Y(7,"2y")){J a=D.2h(b);D("9U",7).P(H(){7.3a=(D.2E(7.2s,a)>=0||D.2E(7.1r,a)>=0)});G(!a.K)7.63=-1}N 7.2s=b})},2I:H(a){I a==12?(7[0]?7[0].4l:U):7.4F().3s(a)},7b:H(a){I 7.5p(a).1Z()},77:H(i){I 7.3w(i,i+1)},3w:H(){I 7.2F(2q.3V.3w.1t(7,1a))},2i:H(b){I 7.2F(D.2i(7,H(a,i){I b.1l(a,i,a)}))},5M:H(){I 7.17(7.5n)},L:H(d,b){J a=d.1Q(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5G("9B"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1R("9v"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3S:H(g,f,h,d){J e=7.K>1,3z;I 7.P(H(){G(!3z){3z=D.4h(g,7.2z);G(h)3z.9o()}J b=7;G(f&&D.Y(7,"1X")&&D.Y(3z[0],"4H"))b=7.40("22")[0]||7.49(7.2z.3t("22"));J c=D([]);D.P(3z,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.17(a);N{G(a.15==1)c=c.17(D("1m",a).1Z());d.1l(b,a)}});c.P(6R)})}};D.18.5i.3V=D.18;H 6R(i,a){G(a.4e)D.3T({1b:a.4e,31:Q,1L:"1m"});N D.5u(a.1r||a.6N||a.4l||"");G(a.1f)a.1f.30(a)}H 1x(){I+2r 8K}D.1n=D.18.1n=H(){J b=1a[0]||{},i=1,K=1a.K,4B=Q,16;G(b.1q==8I){4B=b;b=1a[1]||{};i=2}G(1j b!="3y"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i-1}},6o:H(b,c,a){J e={};R(J d 1k c){e[d]=b.V[d];b.V[d]=c[d]}a.1l(b);R(J d 1k c)b.V[d]=e[d]},1h:H(d,e,c){G(e=="2d"||e=="1T"){J b,2L={3c:"5g",5D:"1C",19:"3H"},2S=e=="2d"?["5d","6i"]:["5b","6g"];H 5a(){b=e=="2d"?d.8g:d.8f;J a=0,2A=0;D.P(2S,H(){a+=3e(D.24(d,"55"+7,M))||0;2A+=3e(D.24(d,"2A"+7+"47",M))||0});b-=26.85(a+2A)}G(D(d).3C(":4i"))5a();N D.6o(d,2L,5a);I 26.2e(0,b)}I D.24(d,e,c)},24:H(f,l,k){J e,V=f.V;H 4d(b){G(!D.14.2f)I Q;J a=3N.53(b,U);I!a||a.52("4d")==""}G(l=="1y"&&D.14.1g){e=D.1M(V,"1y");I e==""?"1":e}G(D.14.2H&&l=="19"){J d=V.50;V.50="0 7Z 7Y";V.50=d}G(l.1I(/4g/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3N.53){G(l.1I(/4g/i))l="4g";l=l.1o(/([A-Z])/g,"-$1").3h();J c=3N.53(f,U);G(c&&!4d(f))e=c.52(l);N{J g=[],2G=[],a=f,i=0;R(;a&&4d(a);a=a.1f)2G.6b(a);R(;i<2G.K;i++)G(4d(2G[i])){g[i]=2G[i].V.19;2G[i].V.19="3H"}e=l=="19"&&g[2G.K-1]!=U?"2P":(c&&c.52(l))||"";R(i=0;i]*?)\\/>/g,H(b,a,c){I c.1I(/^(aN|43|7E|aH|4t|7z|aE|3A|aB|aA|az)$/i)?b:a+">"});J f=D.3l(d).3h(),1w=h.3t("1w");J e=!f.1i("",""]||!f.1i("",""]||f.1I(/^<(ar|22|ap|al|aj)/)&&[1,"<1X>",""]||!f.1i("<4H")&&[2,"<1X><22>",""]||(!f.1i("<22><4H>",""]||!f.1i("<7E")&&[2,"<1X><22><7p>",""]||D.14.1g&&[1,"1w<1w>",""]||[0,"",""];1w.4l=e[1]+d+e[2];1G(e[0]--)1w=1w.5U;G(D.14.1g){J g=!f.1i("<1X")&&f.1i("<22")<0?1w.1s&&1w.1s.3u:e[1]=="<1X>"&&f.1i("<22")<0?1w.3u:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3u.K)g[j].1f.30(g[j]);G(/^\\s/.11(d))1w.38(h.5J(d.1I(/^\\s*/)[0]),1w.1s)}d=D.2h(1w.3u)}G(d.K===0&&(!D.Y(d,"45")&&!D.Y(d,"2y")))I;G(d[0]==12||D.Y(d,"45")||d.16)k.1A(d);N k=D.39(k,d)});I k},1M:H(d,f,c){G(!d||d.15==3||d.15==8)I 12;J e=!D.4o(d),3W=c!==12,1g=D.14.1g;f=e&&D.2L[f]||f;G(d.2g){J g=/5x|4e|V/.11(f);G(f=="3a"&&D.14.2f)d.1f.63;G(f 1k d&&e&&!g){G(3W){G(f=="O"&&D.Y(d,"4t")&&d.1f)7m"O a5 a2\'t 9Z 9W";d[f]=c}G(D.Y(d,"45")&&d.7i(f))I d.7i(f).73;I d[f]}G(1g&&e&&f=="V")I D.1M(d.V,"9V",c);G(3W)d.9T(f,""+c);J h=1g&&e&&g?d.4K(f,2):d.4K(f);I h===U?12:h}G(1g&&f=="1y"){G(3W){d.6A=1;d.1E=(d.1E||"").1o(/7d\\([^)]*\\)/,"")+(3v(c)+\'\'=="9P"?"":"7d(1y="+c*79+")")}I d.1E&&d.1E.1i("1y=")>=0?(3e(d.1E.1I(/1y=([^)]*)/)[1])/79)+\'\':""}f=f.1o(/-([a-z])/9M,H(a,b){I b.2m()});G(3W)d[f]=c;I d[f]},3l:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2h:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1Q||b.4L||b.1l)a[0]=b;N 1G(i)a[--i]=b[i]}I a},2E:H(b,a){R(J i=0,K=a.K;i*",7).1Z();1G(7.1s)7.30(7.1s)}},H(a,b){D.18[a]=H(){I 7.P(b,1a)}});D.P(["6M","47"],H(i,c){J b=c.3h();D.18[b]=H(a){I 7[0]==1c?D.14.2H&&S.1d["5t"+c]||D.14.2f&&1c["5s"+c]||S.6X=="6W"&&S.1B["5t"+c]||S.1d["5t"+c]:7[0]==S?26.2e(26.2e(S.1d["4A"+c],S.1B["4A"+c]),26.2e(S.1d["2k"+c],S.1B["2k"+c])):a==12?(7.K?D.1h(7[0],b):U):7.1h(b,a.1q==56?a:a+"2U")}});H 2a(a,b){I a[0]&&3v(D.24(a[0],b,M),10)||0}J C=D.14.2f&&3v(D.14.5F)<8G?"(?:[\\\\w*3n-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3n-]|\\\\\\\\.)",6J=2r 4y("^>\\\\s*("+C+"+)"),6I=2r 4y("^("+C+"+)(#)("+C+"+)"),6H=2r 4y("^([#.]?)("+C+"*)");D.1n({6F:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4K("2t")==m[2]},":":{8D:H(a,i,m){I im[3]-0},2V:H(a,i,m){I m[3]-0==i},77:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3P:H(a,i,m,r){I i==r.K-1},6C:H(a,i){I i%2==0},6B:H(a,i){I i%2},"3o-4w":H(a){I a.1f.40("*")[0]==a},"3P-4w":H(a){I D.2V(a.1f.5U,1,"4D")==a},"8z-4w":H(a){I!D.2V(a.1f.5U,2,"4D")},6S:H(a){I a.1s},4F:H(a){I!a.1s},8y:H(a,i,m){I(a.6N||a.8x||D(a).1r()||"").1i(m[3])>=0},4i:H(a){I"1C"!=a.O&&D.1h(a,"19")!="2P"&&D.1h(a,"5D")!="1C"},1C:H(a){I"1C"==a.O||D.1h(a,"19")=="2P"||D.1h(a,"5D")=="1C"},8v:H(a){I!a.3O},3O:H(a){I a.3O},4M:H(a){I a.4M},3a:H(a){I a.3a||D.1M(a,"3a")},1r:H(a){I"1r"==a.O},5R:H(a){I"5R"==a.O},5A:H(a){I"5A"==a.O},5o:H(a){I"5o"==a.O},3K:H(a){I"3K"==a.O},5m:H(a){I"5m"==a.O},6z:H(a){I"6z"==a.O},6y:H(a){I"6y"==a.O},2p:H(a){I"2p"==a.O||D.Y(a,"2p")},4t:H(a){I/4t|2y|6x|2p/i.11(a.Y)},3Q:H(a,i,m){I D.2u(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3G(D.3M,H(b){I a==b.T}).K}}},6w:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2r 4y("^([:.#]*)("+C+"+)")],3f:H(a,c,b){J d,1u=[];1G(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1u=b?c=f.r:D.39(1u,f.r)}I 1u},2u:H(t,o){G(1j t!="1W")I[t];G(o&&o.15!=1&&o.15!=9)I[];o=o||S;J d=[o],2w=[],3P,Y;1G(t&&3P!=t){J r=[];3P=t;t=D.3l(t);J l=Q,3k=6J,m=3k.2D(t);G(m){Y=m[1].2m();R(J i=0;d[i];i++)R(J c=d[i].1s;c;c=c.2J)G(c.15==1&&(Y=="*"||c.Y.2m()==Y))r.1A(c);d=r;t=t.1o(3k,"");G(t.1i(" ")==0)6L;l=M}N{3k=/^([>+~])\\s*(\\w*)/i;G((m=3k.2D(t))!=U){r=[];J k={};Y=m[2].2m();m=m[1];R(J j=0,3j=d.K;j<3j;j++){J n=m=="~"||m=="+"?d[j].2J:d[j].1s;R(;n;n=n.2J)G(n.15==1){J g=D.L(n);G(m=="~"&&k[g])1V;G(!Y||n.Y.2m()==Y){G(m=="~")k[g]=M;r.1A(n)}G(m=="+")1V}}d=r;t=D.3l(t.1o(3k,""));l=M}}G(t&&!l){G(!t.1i(",")){G(o==d[0])d.4s();2w=D.39(2w,d);r=d=[o];t=" "+t.6t(1,t.K)}N{J h=6I;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6H;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.60&&!D.4o(f)){J p=f.60(m[2]);G((D.14.1g||D.14.2H)&&p&&1j p.2t=="1W"&&p.2t!=m[2])p=D(\'[@2t="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3h()=="3y")a="3A";r=D.39(r,d[i].40(a))}G(m[1]==".")r=D.5l(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4K("2t")==m[2]){e=[r[i]];1V}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3l(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2w=D.39(2w,d);I 2w},5l:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1D+" ").1i(m)>=0;G(!a&&b||a&&!b)c.1A(r[i])}I c},1E:H(t,r,h){J d;1G(t&&t!=d){d=t;J p=D.6w,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1V}}G(!m)1V;G(m[1]==":"&&m[2]=="4W")r=61.11(m[3])?D.1E(m[3],r,M).r:D(r).4W(m[3]);N G(m[1]==".")r=D.5l(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3j=r.K;i<3j;i++){J a=r[i],z=a[D.2L[m[2]]||m[2]];G(z==U||/5x|4e|3a/.11(m[2]))z=D.1M(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1i(m[5])||O=="$="&&z.6t(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1i(m[5])>=0)^h)g.1A(a)}r=g}N G(m[1]==":"&&m[2]=="2V-4w"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6C"&&"2n"||m[3]=="6B"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3j=r.K;i<3j;i++){J j=r[i],1f=j.1f,2t=D.L(1f);G(!e[2t]){J c=1;R(J n=1f.1s;n;n=n.2J)G(n.15==1)n.4r=c++;e[2t]=M}J b=Q;G(3o==0){G(j.4r==d)b=M}N G((j.4r-d)%3o==0&&(j.4r-d)/3o>=0)b=M;G(b^h)g.1A(j)}r=g}N{J f=D.6F[m[1]];G(1j f=="3y")f=f[m[2]];G(1j f=="1W")f=6s("Q||H(a,i){I "+f+";}");r=D.3G(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4T:H(b,c){J a=[],1u=b[c];1G(1u&&1u!=S){G(1u.15==1)a.1A(1u);1u=1u[c]}I a},2V:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.15==1&&++d==e)1V;I a},5v:H(n,a){J r=[];R(;n;n=n.2J){G(n.15==1&&n!=a)r.1A(n)}I r}});D.W={17:H(f,i,g,e){G(f.15==3||f.15==8)I;G(D.14.1g&&f.4L)f=1c;G(!g.29)g.29=7.29++;G(e!=12){J h=g;g=7.3J(h,H(){I h.1t(7,1a)});g.L=e}J j=D.L(f,"3x")||D.L(f,"3x",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5j)I D.W.1H.1t(1a.3I.T,1a)});1H.T=f;D.P(i.1Q(/\\s+/),H(c,b){J a=b.1Q(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2C[b]||D.W.2C[b].4q.1l(f)===Q){G(f.4a)f.4a(b,1H,Q);N G(f.6q)f.6q("4p"+b,1H)}}d[g.29]=g;D.W.28[b]=M});f=U},29:1,28:{},1Z:H(e,h,f){G(e.15==3||e.15==8)I;J i=D.L(e,"3x"),1K,5h;G(i){G(h==12||(1j h=="1W"&&h.8p(0)=="."))R(J g 1k i)7.1Z(e,g+(h||""));N{G(h.O){f=h.2o;h=h.O}D.P(h.1Q(/\\s+/),H(b,a){J c=a.1Q(".");a=c[0];G(i[a]){G(f)3d i[a][f.29];N R(f 1k i[a])G(!c[1]||i[a][f].O==c[1])3d i[a][f];R(1K 1k i[a])1V;G(!1K){G(!D.W.2C[a]||D.W.2C[a].4G.1l(e)===Q){G(e.6m)e.6m(a,D.L(e,"1H"),Q);N G(e.6l)e.6l("4p"+a,D.L(e,"1H"))}1K=U;3d i[a]}}})}R(1K 1k i)1V;G(!1K){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3x");D.3b(e,"1H")}}},1R:H(h,c,f,g,i){c=D.2h(c);G(h.1i("!")>=0){h=h.3w(0,-1);J a=M}G(!f){G(7.28[h])D("*").17([1c,S]).1R(h,c)}N{G(f.15==3||f.15==8)I 12;J b,1K,18=D.1F(f[h]||U),W=!c[0]||!c[0].37;G(W){c.6b({O:h,2N:f,37:H(){},3X:H(){},4J:1x()});c[0][E]=M}c[0].O=h;G(a)c[0].6k=M;J d=D.L(f,"1H");G(d)b=d.1t(f,c);G((!18||(D.Y(f,\'a\')&&h=="4n"))&&f["4p"+h]&&f["4p"+h].1t(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1F(i)){1K=i.1t(f,b==U?c:c.75(b));G(1K!==12)b=1K}G(18&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4n")){7.5j=M;23{f[h]()}21(e){}}7.5j=Q}I b},1H:H(b){J a,1K,2T,5e,4m;b=1a[0]=D.W.6j(b||1c.W);2T=b.O.1Q(".");b.O=2T[0];2T=2T[1];5e=!2T&&!b.6k;4m=(D.L(7,"3x")||{})[b.O];R(J j 1k 4m){J c=4m[j];G(5e||c.O==2T){b.2o=c;b.L=c.L;1K=c.1t(7,1a);G(a!==Q)a=1K;G(1K===Q){b.37();b.3X()}}}I a},2L:"8o 8n 8m 8l 2p 8k 42 5c 6h 5I 8j L 8i 8h 4k 2o 59 58 8e 8c 57 6f 8b 8a 4j 88 87 86 6d 2N 4J 6c O 84 83 2S".1Q(" "),6j:H(b){G(b[E]==M)I b;J c=b;b={82:c};R(J i=7.2L.K,1e;i;){1e=7.2L[--i];b[1e]=c[1e]}b[E]=M;b.37=H(){G(c.37)c.37();c.81=Q};b.3X=H(){G(c.3X)c.3X();c.80=M};b.4J=b.4J||1x();G(!b.2N)b.2N=b.6d||S;G(b.2N.15==3)b.2N=b.2N.1f;G(!b.4j&&b.4k)b.4j=b.4k==b.2N?b.6c:b.4k;G(b.57==U&&b.5c!=U){J a=S.1B,1d=S.1d;b.57=b.5c+(a&&a.2c||1d&&1d.2c||0)-(a.69||0);b.6f=b.6h+(a&&a.2l||1d&&1d.2l||0)-(a.68||0)}G(!b.2S&&((b.42||b.42===0)?b.42:b.59))b.2S=b.42||b.59;G(!b.58&&b.5I)b.58=b.5I;G(!b.2S&&b.2p)b.2S=(b.2p&1?1:(b.2p&2?3:(b.2p&4?2:0)));I b},3J:H(a,b){b.29=a.29=a.29||b.29||7.29++;I b},2C:{25:{4q:H(){54();I},4G:H(){I}},4c:{4q:H(){G(D.14.1g)I Q;D(7).2O("51",D.W.2C.4c.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("51",D.W.2C.4c.2o);I M},2o:H(a){G(F(a,7))I M;a.O="4c";I D.W.1H.1t(7,1a)}},3F:{4q:H(){G(D.14.1g)I Q;D(7).2O("4Z",D.W.2C.3F.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("4Z",D.W.2C.3F.2o);I M},2o:H(a){G(F(a,7))I M;a.O="3F";I D.W.1H.1t(7,1a)}}}};D.18.1n({2O:H(c,a,b){I c=="4Y"?7.2Y(c,a,b):7.P(H(){D.W.17(7,c,b||a,b&&a)})},2Y:H(d,b,c){J e=D.W.3J(c||b,H(a){D(7).3L(a,e);I(c||b).1t(7,1a)});I 7.P(H(){D.W.17(7,d,e,c&&b)})},3L:H(a,b){I 7.P(H(){D.W.1Z(7,a,b)})},1R:H(c,a,b){I 7.P(H(){D.W.1R(c,a,7,M,b)})},5G:H(c,a,b){I 7[0]&&D.W.1R(c,a,7[0],Q,b)},2B:H(b){J c=1a,i=1;1G(i=0){J i=g.3w(e,g.K);g=g.3w(0,e)}c=c||H(){};J f="2R";G(d)G(D.1F(d)){c=d;d=U}N G(1j d==\'3y\'){d=D.3A(d);f="7J"}J h=7;D.3T({1b:g,O:f,1L:"2I",L:d,1O:H(a,b){G(b=="1U"||b=="7I")h.2I(i?D("<1w/>").3s(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2u(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3A(7.7H())},7H:H(){I 7.2i(H(){I D.Y(7,"45")?D.2h(7.aK):7}).1E(H(){I 7.32&&!7.3O&&(7.4M||/2y|6x/i.11(7.Y)||/1r|1C|3K/i.11(7.O))}).2i(H(i,c){J b=D(7).6a();I b==U?U:b.1q==2q?D.2i(b,H(a,i){I{32:c.32,2s:a}}):{32:c.32,2s:b}}).3p()}});D.P("7G,7D,7C,7B,6u,7A".1Q(","),H(i,o){D.18[o]=H(f){I 7.2O(o,f)}});J B=1x();D.1n({3p:H(d,b,a,c){G(D.1F(b)){a=b;b=U}I D.3T({O:"2R",1b:d,L:b,1U:a,1L:c})},aG:H(b,a){I D.3p(b,U,a,"1m")},aF:H(c,b,a){I D.3p(c,b,a,"3B")},aD:H(d,b,a,c){G(D.1F(b)){a=b;b={}}I D.3T({O:"7J",1b:d,L:b,1U:a,1L:c})},aC:H(a){D.1n(D.5Z,a)},5Z:{1b:5Y.5x,28:M,O:"2R",2W:0,7y:"4x/x-ay-45-ax",7v:M,31:M,L:U,5r:U,3K:U,4z:{2K:"4x/2K, 1r/2K",2I:"1r/2I",1m:"1r/4v, 4x/4v",3B:"4x/3B, 1r/4v",1r:"1r/as",4S:"*/*"}},4R:{},3T:H(s){s=D.1n(M,s,D.1n(M,{},D.5Z,s));J g,33=/=\\?(&|$)/g,1v,L,O=s.O.2m();G(s.L&&s.7v&&1j s.L!="1W")s.L=D.3A(s.L);G(s.1L=="4Q"){G(O=="2R"){G(!s.1b.1I(33))s.1b+=(s.1b.1I(/\\?/)?"&":"?")+(s.4Q||"7s")+"=?"}N G(!s.L||!s.L.1I(33))s.L=(s.L?s.L+"&":"")+(s.4Q||"7s")+"=?";s.1L="3B"}G(s.1L=="3B"&&(s.L&&s.L.1I(33)||s.1b.1I(33))){g="4Q"+B++;G(s.L)s.L=(s.L+"").1o(33,"="+g+"$1");s.1b=s.1b.1o(33,"="+g+"$1");s.1L="1m";1c[g]=H(a){L=a;1U();1O();1c[g]=12;23{3d 1c[g]}21(e){}G(i)i.30(h)}}G(s.1L=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2R"){J j=1x();J k=s.1b.1o(/(\\?|&)3n=.*?(&|$)/,"$am="+j+"$2");s.1b=k+((k==s.1b)?(s.1b.1I(/\\?/)?"&":"?")+"3n="+j:"")}G(s.L&&O=="2R"){s.1b+=(s.1b.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.28&&!D.4P++)D.W.1R("7G");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1L=="1m"&&O=="2R"&&n.11(s.1b)&&n.2D(s.1b)[1]!=5Y.ak){J i=S.40("6v")[0];J h=S.3t("1m");h.4e=s.1b;G(s.7r)h.ai=s.7r;G(!g){J l=Q;h.ag=h.af=H(){G(!l&&(!7.3i||7.3i=="66"||7.3i=="1O")){l=M;1U();1O();i.30(h)}}}i.49(h);I 12}J m=Q;J c=1c.7q?2r 7q("ad.ac"):2r 6Q();G(s.5r)c.7o(O,s.1b,s.31,s.5r,s.3K);N c.7o(O,s.1b,s.31);23{G(s.L)c.4O("ab-aa",s.7y);G(s.5T)c.4O("a9-5S-a8",D.4R[s.1b]||"a7, a6 a4 a3 5O:5O:5O a1");c.4O("X-a0-9Y","6Q");c.4O("9X",s.1L&&s.4z[s.1L]?s.4z[s.1L]+", */*":s.4z.4S)}21(e){}G(s.7k&&s.7k(c,s)===Q){s.28&&D.4P--;c.7j();I Q}G(s.28)D.W.1R("7A",[c,s]);J d=H(a){G(!m&&c&&(c.3i==4||a=="2W")){m=M;G(f){7h(f);f=U}1v=a=="2W"?"2W":!D.7g(c)?"3g":s.5T&&D.7f(c,s.1b)?"7I":"1U";G(1v=="1U"){23{L=D.6U(c,s.1L,s.9S)}21(e){1v="5L"}}G(1v=="1U"){J b;23{b=c.5K("7e-5S")}21(e){}G(s.5T&&b)D.4R[s.1b]=b;G(!g)1U()}N D.5E(s,c,1v);1O();G(s.31)c=U}};G(s.31){J f=4L(d,13);G(s.2W>0)3E(H(){G(c){c.7j();G(!m)d("2W")}},s.2W)}23{c.9R(s.L)}21(e){D.5E(s,c,U,e)}G(!s.31)d();H 1U(){G(s.1U)s.1U(L,1v);G(s.28)D.W.1R("6u",[c,s])}H 1O(){G(s.1O)s.1O(c,1v);G(s.28)D.W.1R("7C",[c,s]);G(s.28&&!--D.4P)D.W.1R("7D")}I c},5E:H(s,a,b,e){G(s.3g)s.3g(a,b,e);G(s.28)D.W.1R("7B",[a,s,e])},4P:0,7g:H(a){23{I!a.1v&&5Y.9Q=="5o:"||(a.1v>=7c&&a.1v<9O)||a.1v==7a||a.1v==9N||D.14.2f&&a.1v==12}21(e){}I Q},7f:H(a,c){23{J b=a.5K("7e-5S");I a.1v==7a||b==D.4R[c]||D.14.2f&&a.1v==12}21(e){}I Q},6U:H(a,c,b){J d=a.5K("9L-O"),2K=c=="2K"||!c&&d&&d.1i("2K")>=0,L=2K?a.9K:a.4U;G(2K&&L.1B.2g=="5L")7m"5L";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3B")L=6s("("+L+")");I L},3A:H(a){J s=[];H 17(b,a){s[s.K]=78(b)+\'=\'+78(a)};G(a.1q==2q||a.5w)D.P(a,H(){17(7.32,7.2s)});N R(J j 1k a)G(a[j]&&a[j].1q==2q)D.P(a[j],H(){17(j,7)});N 17(j,D.1F(a[j])?a[j]():a[j]);I s.6r("&").1o(/%20/g,"+")}});D.18.1n({1N:H(c,b){I c?7.2j({1T:"1N",2d:"1N",1y:"1N"},c,b):7.1E(":1C").P(H(){7.V.19=7.5H||"";G(D.1h(7,"19")=="2P"){J a=D("<"+7.2g+" />").6O("1d");7.V.19=a.1h("19");G(7.V.19=="2P")7.V.19="3H";a.1Z()}}).3m()},1J:H(b,a){I b?7.2j({1T:"1J",2d:"1J",1y:"1J"},b,a):7.1E(":4i").P(H(){7.5H=7.5H||D.1h(7,"19");7.V.19="2P"}).3m()},76:D.18.2B,2B:H(a,b){I D.1F(a)&&D.1F(b)?7.76.1t(7,1a):a?7.2j({1T:"2B",2d:"2B",1y:"2B"},a,b):7.P(H(){D(7)[D(7).3C(":1C")?"1N":"1J"]()})},9J:H(b,a){I 7.2j({1T:"1N"},b,a)},9I:H(b,a){I 7.2j({1T:"1J"},b,a)},9H:H(b,a){I 7.2j({1T:"2B"},b,a)},9G:H(b,a){I 7.2j({1y:"1N"},b,a)},9F:H(b,a){I 7.2j({1y:"1J"},b,a)},9D:H(c,a,b){I 7.2j({1y:a},c,b)},2j:H(k,j,i,g){J h=D.74(j,i,g);I 7[h.35===Q?"P":"35"](H(){G(7.15!=1)I Q;J f=D.1n({},h),p,1C=D(7).3C(":1C"),41=7;R(p 1k k){G(k[p]=="1J"&&1C||k[p]=="1N"&&!1C)I f.1O.1l(7);G(p=="1T"||p=="2d"){f.19=D.1h(7,"19");f.34=7.V.34}}G(f.34!=U)7.V.34="1C";f.44=D.1n({},k);D.P(k,H(c,a){J e=2r D.27(41,f,c);G(/2B|1N|1J/.11(a))e[a=="2B"?1C?"1N":"1J":a](k);N{J b=a.6p().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1u(M)||0;G(b){J d=3e(b[2]),2M=b[3]||"2U";G(2M!="2U"){41.V[c]=(d||1)+2M;2b=((d||1)/e.1u(M))*2b;41.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3Z(2b,d,2M)}N e.3Z(2b,a,"")}});I M})},35:H(a,b){G(D.1F(a)||(a&&a.1q==2q)){b=a;a="27"}G(!a||(1j a=="1W"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2q)A(7,a,b);N{A(7,a).1A(b);G(A(7,a).K==1)b.1l(7)}})},9x:H(b,c){J a=D.3M;G(b)7.35([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7l(i,1)}});G(!c)7.5C();I 7}});J A=H(b,c,a){G(b){c=c||"27";J q=D.L(b,c+"35");G(!q||a)q=D.L(b,c+"35",D.2h(a))}I q};D.18.5C=H(a){a=a||"27";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1l(7)})};D.1n({74:H(b,a,c){J d=b&&b.1q==9u?b:{1O:c||!c&&a||D.1F(b)&&b,2v:b,3U:c&&a||a&&a.1q!=9t&&a};d.2v=(d.2v&&d.2v.1q==4N?d.2v:D.27.5N[d.2v])||D.27.5N.71;d.5P=d.1O;d.1O=H(){G(d.35!==Q)D(7).5C();G(D.1F(d.5P))d.5P.1l(7)};I d},3U:{7n:H(p,n,b,a){I b+a*p},5Q:H(p,n,b,a){I((-26.9r(p*26.9q)/2)+0.5)*a+b}},3M:[],46:U,27:H(b,c,a){7.16=c;7.T=b;7.1e=a;G(!c.3R)c.3R={}}});D.27.3V={4E:H(){G(7.16.2Z)7.16.2Z.1l(7.T,7.1x,7);(D.27.2Z[7.1e]||D.27.2Z.4S)(7);G(7.1e=="1T"||7.1e=="2d")7.T.V.19="3H"},1u:H(a){G(7.T[7.1e]!=U&&7.T.V[7.1e]==U)I 7.T[7.1e];J r=3e(D.1h(7.T,7.1e,a));I r&&r>-9p?r:3e(D.24(7.T,7.1e))||0},3Z:H(c,b,d){7.5B=1x();7.2b=c;7.3m=b;7.2M=d||7.2M||"2U";7.1x=7.2b;7.36=7.4C=0;7.4E();J e=7;H t(a){I e.2Z(a)}t.T=7.T;D.3M.1A(t);G(D.46==U){D.46=4L(H(){J a=D.3M;R(J i=0;i7.16.2v+7.5B){7.1x=7.3m;7.36=7.4C=1;7.4E();7.16.44[7.1e]=M;J b=M;R(J i 1k 7.16.44)G(7.16.44[i]!==M)b=Q;G(b){G(7.16.19!=U){7.T.V.34=7.16.34;7.T.V.19=7.16.19;G(D.1h(7.T,"19")=="2P")7.T.V.19="3H"}G(7.16.1J)7.T.V.19="2P";G(7.16.1J||7.16.1N)R(J p 1k 7.16.44)D.1M(7.T.V,p,7.16.3R[p])}G(b)7.16.1O.1l(7.T);I Q}N{J n=t-7.5B;7.4C=n/7.16.2v;7.36=D.3U[7.16.3U||(D.3U.5Q?"5Q":"7n")](7.4C,n,0,1,7.16.2v);7.1x=7.2b+((7.3m-7.2b)*7.36);7.4E()}I M}};D.1n(D.27,{5N:{9k:9i,an:7c,71:ao},2Z:{2c:H(a){a.T.2c=a.1x},2l:H(a){a.T.2l=a.1x},1y:H(a){D.1M(a.T.V,"1y",a.1x)},4S:H(a){a.T.V[a.1e]=a.1x+a.2M}}});D.18.2k=H(){J b=0,1P=0,T=7[0],3q;G(T)9f(D.14){J d=T.1f,48=T,1p=T.1p,1S=T.2z,5V=2f&&3v(5F)<9c&&!/aw/i.11(v),1h=D.24,2X=1h(T,"3c")=="2X";G(!(3r&&T==S.1d)&&T.6T){J c=T.6T();17(c.1z+26.2e(1S.1B.2c,1S.1d.2c),c.1P+26.2e(1S.1B.2l,1S.1d.2l));17(-1S.1B.69,-1S.1B.68)}N{17(T.5X,T.5z);1G(1p){17(1p.5X,1p.5z);G(3r&&!/^t(98|d|h)$/i.11(1p.2g)||2f&&!5V)2A(1p);G(!2X&&1h(1p,"3c")=="2X")2X=M;48=/^1d$/i.11(1p.2g)?48:1p;1p=1p.1p}1G(d&&d.2g&&!/^1d|2I$/i.11(d.2g)){G(!/^97|1X.*$/i.11(1h(d,"19")))17(-d.2c,-d.2l);G(3r&&1h(d,"34")!="4i")2A(d);d=d.1f}G((5V&&(2X||1h(48,"3c")=="5g"))||(3r&&1h(48,"3c")!="5g"))17(-1S.1d.5X,-1S.1d.5z);G(2X)17(26.2e(1S.1B.2c,1S.1d.2c),26.2e(1S.1B.2l,1S.1d.2l))}3q={1P:1P,1z:b}}H 2A(a){17(D.24(a,"7w",M),D.24(a,"7x",M))}H 17(l,t){b+=3v(l,10)||0;1P+=3v(t,10)||0}I 3q};D.18.1n({3c:H(){J a=0,1P=0,3q;G(7[0]){J b=7.1p(),2k=7.2k(),4b=/^1d|2I$/i.11(b[0].2g)?{1P:0,1z:0}:b.2k();2k.1P-=2a(7,\'95\');2k.1z-=2a(7,\'94\');4b.1P+=2a(b,\'7x\');4b.1z+=2a(b,\'7w\');3q={1P:2k.1P-4b.1P,1z:2k.1z-4b.1z}}I 3q},1p:H(){J a=7[0].1p;1G(a&&(!/^1d|2I$/i.11(a.2g)&&D.1h(a,\'3c\')==\'aI\'))a=a.1p;I D(a)}});D.P([\'5d\',\'5b\'],H(i,b){J c=\'4A\'+b;D.18[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1c||7==S?1c.aJ(!i?a:D(1c).2c(),i?a:D(1c).2l()):7[c]=a}):7[0]==1c||7[0]==S?41[i?\'92\':\'91\']||D.6Y&&S.1B[c]||S.1d[c]:7[0][c]}});D.P(["6M","47"],H(i,b){J c=i?"5d":"5b",43=i?"6i":"6g";D.18["5s"+b]=H(){I 7[b.3h()]()+2a(7,"55"+c)+2a(7,"55"+43)};D.18["aM"+b]=H(a){I 7["5s"+b]()+2a(7,"2A"+c+"47")+2a(7,"2A"+43+"47")+(a?2a(7,"7F"+c)+2a(7,"7F"+43):0)}})})();',62,671,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|nodeType|options|add|fn|display|arguments|url|window|body|prop|parentNode|msie|css|indexOf|typeof|in|call|script|extend|replace|offsetParent|constructor|text|firstChild|apply|cur|status|div|now|opacity|left|push|documentElement|hidden|className|filter|isFunction|while|handle|match|hide|ret|dataType|attr|show|complete|top|split|trigger|doc|height|success|break|string|table|cache|remove||catch|tbody|try|curCSS|ready|Math|fx|global|guid|num|start|scrollLeft|width|max|safari|tagName|makeArray|map|animate|offset|scrollTop|toUpperCase||handler|button|Array|new|value|id|find|duration|done|copy|select|ownerDocument|border|toggle|special|exec|inArray|pushStack|stack|opera|html|nextSibling|xml|props|unit|target|bind|none|isReady|GET|which|namespace|px|nth|timeout|fixed|one|step|removeChild|async|name|jsre|overflow|queue|pos|preventDefault|insertBefore|merge|selected|removeData|position|delete|parseFloat|multiFilter|error|toLowerCase|readyState|rl|re|trim|end|_|first|get|results|mozilla|append|createElement|childNodes|parseInt|slice|events|object|elems|param|json|is|readyList|setTimeout|mouseleave|grep|block|callee|proxy|password|unbind|timers|defaultView|disabled|last|has|orig|domManip|ajax|easing|prototype|set|stopPropagation|load|custom|getElementsByTagName|self|charCode|br|curAnim|form|timerId|Width|offsetChild|appendChild|addEventListener|parentOffset|mouseenter|color|src|currentStyle|float|clean|visible|relatedTarget|fromElement|innerHTML|handlers|click|isXMLDoc|on|setup|nodeIndex|shift|input|unique|javascript|child|application|RegExp|accepts|scroll|deep|state|previousSibling|update|empty|teardown|tr|jQuery|timeStamp|getAttribute|setInterval|checked|Number|setRequestHeader|active|jsonp|lastModified|_default|dir|responseText|styleSheets|not|lastToggle|unload|mouseout|outline|mouseover|getPropertyValue|getComputedStyle|bindReady|padding|String|pageX|metaKey|keyCode|getWH|Top|clientX|Left|all|container|absolute|index|init|triggered|removeAttribute|classFilter|submit|prevObject|file|after|windowData|username|inner|client|globalEval|sibling|jquery|href|clone|offsetTop|checkbox|startTime|dequeue|visibility|handleError|version|triggerHandler|oldblock|ctrlKey|createTextNode|getResponseHeader|parsererror|andSelf|speeds|00|old|swing|radio|Modified|ifModified|lastChild|safari2|wrapAll|offsetLeft|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|loaded|DOMContentLoaded|clientTop|clientLeft|val|unshift|toElement|srcElement|_load|pageY|Bottom|clientY|Right|fix|exclusive|detachEvent|removeEventListener|cloneNode|swap|toString|attachEvent|join|eval|substr|ajaxSuccess|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|expr|exclude|quickClass|quickID|quickChild|uuid|continue|Height|textContent|appendTo|contents|XMLHttpRequest|evalScript|parent|getBoundingClientRect|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|styleFloat|def|webkit|nodeValue|speed|concat|_toggle|eq|encodeURIComponent|100|304|replaceWith|200|alpha|Last|httpNotModified|httpSuccess|clearInterval|getAttributeNode|abort|beforeSend|splice|throw|linear|open|colgroup|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|borderLeftWidth|borderTopWidth|contentType|link|ajaxSend|ajaxError|ajaxComplete|ajaxStop|col|margin|ajaxStart|serializeArray|notmodified|POST|keyup|keypress|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|hasClass|doScroll|hover|black|solid|cancelBubble|returnValue|originalEvent|wheelDelta|view|round|shiftKey|screenY|screenX|mousedown|relatedNode|prevValue|originalTarget|keydown|newValue|offsetHeight|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|charAt|0n|substring|animated|header|noConflict|enabled|line|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|417|size|Boolean|toggleClass|Date|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|wrap|contentDocument|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|pageXOffset|pageYOffset|next|marginLeft|marginTop|parents|inline|able|rowSpan|rowspan|cellSpacing|522|cellspacing|maxLength|with|maxlength|readOnly|600|readonly|slow|1px|class|htmlFor|reverse|10000|PI|cos|compatible|Function|Object|setData|ie|stop|ra|it|rv|getData|userAgent|fadeTo|navigator|fadeOut|fadeIn|slideToggle|slideUp|slideDown|responseXML|content|ig|1223|300|NaN|protocol|send|dataFilter|setAttribute|option|cssText|changed|Accept|With|be|Requested|GMT|can|1970|Jan|property|01|Thu|Since|If|Type|Content|XMLHTTP|Microsoft|th|onreadystatechange|onload|td|charset|cap|host|colg|1_|fast|400|tfoot|specified|thead|plain|leg|attributes|opt|adobeair|urlencoded|www|embed|area|hr|ajaxSetup|post|meta|getJSON|getScript|img|static|scrollTo|elements|serialize|outer|abbr|pixelLeft'.split('|'),0,{}));jQuery.noConflict(); blogs/wp-includes/js/jquery/suggest.js0000644000000000000000000001635411077635520017105 0ustar rootroot/* * jquery.suggest 1.1b - 2007-08-06 * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228 * * Uses code and techniques from following libraries: * 1. http://www.dyve.net/jquery/?autocomplete * 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js * * All the new stuff written by Peter Vulgaris (www.vulgarisoip.com) * Feel free to do whatever you want with this file * */ (function($) { $.suggest = function(input, options) { var $input = $(input).attr("autocomplete", "off"); var $results = $(document.createElement("ul")); var timeout = false; // hold timeout ID for suggestion results to appear var prevLength = 0; // last recorded length of $input.val() var cache = []; // cache MRU list var cacheSize = 0; // size of cache in chars (bytes?) $results.addClass(options.resultsClass).appendTo('body'); resetPosition(); $(window) .load(resetPosition) // just in case user is changing size of page while loading .resize(resetPosition); $input.blur(function() { setTimeout(function() { $results.hide() }, 200); }); // help IE users if possible try { $results.bgiframe(); } catch(e) { } // I really hate browser detection, but I don't see any other way if ($.browser.mozilla) $input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera else $input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari function resetPosition() { // requires jquery.dimension plugin var offset = $input.offset(); $results.css({ top: (offset.top + input.offsetHeight) + 'px', left: offset.left + 'px' }); } function processKey(e) { // handling up/down/escape requires results to be visible // handling enter/tab requires that AND a result to be selected if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) || (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); e.cancelBubble = true; e.returnValue = false; switch(e.keyCode) { case 38: // up prevResult(); break; case 40: // down nextResult(); break; case 9: // tab case 13: // return selectCurrentResult(); break; case 27: // escape $results.hide(); break; } } else if ($input.val().length != prevLength) { if (timeout) clearTimeout(timeout); timeout = setTimeout(suggest, options.delay); prevLength = $input.val().length; } } function suggest() { var q = $.trim($input.val()); if ( options.multiple ) { var multipleSepPos = q.lastIndexOf(options.multipleSep); if ( multipleSepPos != -1 ) { q = q.substr(multipleSepPos + options.multipleSep.length); } } if (q.length >= options.minchars) { cached = checkCache(q); if (cached) { displayItems(cached['items']); } else { $.get(options.source, {q: q}, function(txt) { $results.hide(); var items = parseTxt(txt, q); displayItems(items); addToCache(q, items, txt.length); }); } } else { $results.hide(); } } function checkCache(q) { for (var i = 0; i < cache.length; i++) if (cache[i]['q'] == q) { cache.unshift(cache.splice(i, 1)[0]); return cache[0]; } return false; } function addToCache(q, items, size) { while (cache.length && (cacheSize + size > options.maxCacheSize)) { var cached = cache.pop(); cacheSize -= cached['size']; } cache.push({ q: q, size: size, items: items }); cacheSize += size; } function displayItems(items) { if (!items) return; if (!items.length) { $results.hide(); return; } resetPosition(); // when the form moves after the page has loaded var html = ''; for (var i = 0; i < items.length; i++) html += '
  • ' + items[i] + '
  • '; $results.html(html).show(); $results .children('li') .mouseover(function() { $results.children('li').removeClass(options.selectClass); $(this).addClass(options.selectClass); }) .click(function(e) { e.preventDefault(); e.stopPropagation(); selectCurrentResult(); }); } function parseTxt(txt, q) { var items = []; var tokens = txt.split(options.delimiter); // parse returned data for non-empty items for (var i = 0; i < tokens.length; i++) { var token = $.trim(tokens[i]); if (token) { token = token.replace( new RegExp(q, 'ig'), function(q) { return '' + q + '' } ); items[items.length] = token; } } return items; } function getCurrentResult() { if (!$results.is(':visible')) return false; var $currentResult = $results.children('li.' + options.selectClass); if (!$currentResult.length) $currentResult = false; return $currentResult; } function selectCurrentResult() { $currentResult = getCurrentResult(); if ($currentResult) { if ( options.multiple ) { if ( $input.val().indexOf(options.multipleSep) != -1 ) { $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ); } else { $currentVal = ""; } $input.val( $currentVal + $currentResult.text() + options.multipleSep); $input.focus(); } else { $input.val($currentResult.text()); } $results.hide(); if (options.onSelect) options.onSelect.apply($input[0]); } } function nextResult() { $currentResult = getCurrentResult(); if ($currentResult) $currentResult .removeClass(options.selectClass) .next() .addClass(options.selectClass); else $results.children('li:first-child').addClass(options.selectClass); } function prevResult() { $currentResult = getCurrentResult(); if ($currentResult) $currentResult .removeClass(options.selectClass) .prev() .addClass(options.selectClass); else $results.children('li:last-child').addClass(options.selectClass); } } $.fn.suggest = function(source, options) { if (!source) return; options = options || {}; options.multiple = options.multiple || false; options.multipleSep = options.multipleSep || ", "; options.source = source; options.delay = options.delay || 100; options.resultsClass = options.resultsClass || 'ac_results'; options.selectClass = options.selectClass || 'ac_over'; options.matchClass = options.matchClass || 'ac_match'; options.minchars = options.minchars || 2; options.delimiter = options.delimiter || '\n'; options.onSelect = options.onSelect || false; options.maxCacheSize = options.maxCacheSize || 65536; this.each(function() { new $.suggest(this, options); }); return this; }; })(jQuery);blogs/wp-includes/js/jquery/ui.core.js0000644000000000000000000000715411077635520016766 0ustar rootrooteval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[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}('(3(C){C.8={2s:{1o:3(E,F,H){6 G=C.8[E].n;1v(6 D 2r H){G.w[D]=G.w[D]||[];G.w[D].2q([F,H[D]])}},1n:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G\').1i(D).f({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.o[D]=!!((!(/2f|2e/).h(E.f("2d"))||(/^[1-9]/).h(E.f("2c"))||(/^[1-9]/).h(E.f("2b"))||!(/1r/).h(E.f("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.f("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.o[D]},23:3(D){D.j="1g";D.1q=3(){4 7};5(D.v){D.v.1p="1r"}},22:3(D){D.j="21";D.1q=3(){4 d};5(D.v){D.v.1p=""}},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 d}G[D]=1;F=G[D]>0?d:7;G[D]=0;4 F}};6 B=C.10.t;C.10.t=3(){C("*",2).1o(2).1X("t");4 B.u(2,1m)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(W D=="V"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.l=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(W J=="V"),I=1U.n.1T.1n(1m,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].u(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].u(K,I)}1P{5(!H){C.Z(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1h=F+"-"+E;2.a=C.1l({},C.l.p,C[F][E].p,H);2.c=C(I).g("m."+E,3(L,J,K){4 G.m(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("t",3(){4 G.1j()});2.1k()};C[F][E].n=C.1l({},C.l.n,D)};C.l.n={1k:3(){},1j:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},m:3(D,E){2.a[D]=E;5(D=="k"){2.c[E?"1i":"1M"](2.1h+"-k")}},1L:3(){2.m("k",7)},1K:3(){2.m("k",d)}};C.l.p={k:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1e(E)});5(C.U.T){2.1f=2.c.X("j");2.c.X("j","1g")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.X("j",2.1f))},1e:3(F){(2.b&&2.i(F));2.r=F;6 E=2,G=(F.1F==1),D=(W 2.a.y=="V"?C(F.1E).1D(2.a.y):7);5(!G||D||!2.15(F)){4 d}2.q=!2.a.x;5(!2.q){2.1C=1B(3(){E.q=d},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 d}}2.S=3(H){4 E.1d(H)};2.Q=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.S).g("1a."+2.e,2.Q);4 7},1d:3(D){5(C.U.T&&!D.1z){4 2.i(D)}5(2.b){2.z(D);4 7}5(2.P(D)&&2.N(D)){2.b=(2.M(2.r,D)!==7);(2.b?2.z(D):2.i(D))}4!2.b},i:3(D){C(1c).R("1b."+2.e,2.S).R("1a."+2.e,2.Q);5(2.b){2.b=7;2.16(D)}4 7},P:3(D){4(O.1y(O.18(2.r.19-D.19),O.18(2.r.17-D.17))>=2.a.13)},N:3(D){4 2.q},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 d}};C.8.14.p={y:1x,13:1,x:0}})(1w)',62,153,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|true|widgetName|css|bind|test|mouseUp|unselectable|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet|_mouseDownEvent||remove|apply|style|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|string|typeof|attr|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|add|MozUserSelect|onselectstart|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|is|target|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|trigger|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|class|div|length|push|in|plugin'.split('|'),0,{})) blogs/wp-includes/js/jquery/ui.tabs.js0000644000000000000000000001406211077635520016763 0ustar rootrooteval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[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}('(4(A){A.39("8.3",{38:4(){2.c.v+=".3";2.1e(1c)},37:4(B,C){5((/^7/).1Z(B)){2.16(C)}n{2.c[B]=C;2.1e()}},i:4(){f 2.$3.i},1E:4(B){f B.24&&B.24.13(/\\s/g,"23").13(/[^A-36-35-9\\-23:\\.]/g,"")||2.c.1Q+A.e(B)},8:4(C,B){f{c:2.c,34:C,1M:B}},1e:4(O){2.$h=A("1i:33(a[o])",2.l);2.$3=2.$h.1s(4(){f A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.V(4(R,Q){5(Q.u&&Q.u.13("#","")){P.$b=P.$b.1b(Q.u)}n{5(A(Q).12("o")!="#"){A.e(Q,"o.3",Q.o);A.e(Q,"q.3",Q.o);6 T=P.1E(Q);Q.o="#"+T;6 S=A("#"+T);5(!S.i){S=A(D.1x).12("1f",T).m(D.18).32(P.$b[R-1]||P.l);S.e("1a.3",1c)}P.$b=P.$b.1b(S)}n{D.d.1U(R+1)}}});5(O){2.l.m(D.1w);2.$b.V(4(){6 Q=A(2);Q.m(D.18)});5(D.7===1p){5(1J.u){2.$3.V(4(S,Q){5(Q.u==1J.u){D.7=S;5(A.W.1g||A.W.31){6 R=A(1J.u),T=R.12("1f");R.12("1f","");1z(4(){R.12("1f",T)},30)}2Z(0,0);f p}})}n{5(D.Y){6 J=2Y(A.Y("8-3"+A.e(P.l)),10);5(J&&P.$3[J]){D.7=J}}n{5(P.$h.z("."+D.k).i){D.7=P.$h.Z(P.$h.z("."+D.k)[0])}}}}D.7=D.7===j||D.7!==1p?D.7:0;D.d=A.2X(D.d.2W(A.1s(2.$h.z("."+D.U),4(R,Q){f P.$h.Z(R)}))).1T();5(A.1r(D.7,D.d)!=-1){D.d.2V(A.1r(D.7,D.d),1)}2.$b.m(D.w);2.$h.r(D.k);5(D.7!==j){2.$b.t(D.7).1G().r(D.w);2.$h.t(D.7).m(D.k);6 K=4(){A(P.l).y("20",[j,P.8(P.$3[D.7],P.$b[D.7])],D.1G)};5(A.e(2.$3[D.7],"q.3")){2.q(D.7,K)}n{K()}}A(2U).15("2T",4(){P.$3.14(".3");P.$h=P.$3=P.$b=j})}2S(6 G=0,N;N=2.$h[G];G++){A(N)[A.1r(G,D.d)!=-1&&!A(N).11(D.k)?"m":"r"](D.U)}5(D.x===p){2.$3.1m("x.3")}6 C,I,B={"2R-2Q":0,1I:1},E="2P";5(D.X&&D.X.2O==2N){C=D.X[0]||B,I=D.X[1]||B}n{C=I=D.X||B}6 H={1q:"",2M:"",2L:""};5(!A.W.1g){H.1H=""}4 M(R,Q,S){Q.22(C,C.1I||E,4(){Q.m(D.w).1d(H);5(A.W.1g&&C.1H){Q[0].21.z=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1d("1q","1D")}S.22(I,I.1I||E,4(){S.r(D.w).1d(H);5(A.W.1g&&I.1H){S[0].21.z=""}A(P.l).y("20",[j,P.8(R,S[0])],D.1G)})}4 F(R,T,Q,S){T.m(D.k).2K().r(D.k);M(R,Q,S)}2.$3.14(".3").15(D.v,4(){6 T=A(2).2J("1i:t(0)"),Q=P.$b.z(":2I"),S=A(2.u);5((T.11(D.k)&&!D.1h)||T.11(D.U)||A(2).11(D.17)||A(P.l).y("2H",[j,P.8(2,S[0])],D.16)===p){2.1t();f p}P.c.7=P.$3.Z(2);5(D.1h){5(T.11(D.k)){P.c.7=j;T.r(D.k);P.$b.1F();M(2,Q);2.1t();f p}n{5(!Q.i){P.$b.1F();6 R=2;P.q(P.$3.Z(2),4(){T.m(D.k).m(D.1v);L(R,S)});2.1t();f p}}}5(D.Y){A.Y("8-3"+A.e(P.l),P.c.7,D.Y)}P.$b.1F();5(S.i){6 R=2;P.q(P.$3.Z(2),Q.i?4(){F(R,T,Q,S)}:4(){T.m(D.k);L(R,S)})}n{2G"1K 2F 2E: 2D 2C 2B."}5(A.W.1g){2.1t()}f p});5(!(/^1y/).1Z(D.v)){2.$3.15("1y.3",4(){f p})}},1b:4(E,D,C){5(C==1p){C=2.$3.i}6 G=2.c;6 I=A(G.1P.13(/#\\{o\\}/g,E).13(/#\\{1j\\}/g,D));I.e("1a.3",1c);6 H=E.2A("#")==0?E.13("#",""):2.1E(A("a:2z-2y",I)[0]);6 F=A("#"+H);5(!F.i){F=A(G.1x).12("1f",H).m(G.w).e("1a.3",1c)}F.m(G.18);5(C>=2.$h.i){I.1Y(2.l);F.1Y(2.l[0].2x)}n{I.1X(2.$h[C]);F.1X(2.$b[C])}G.d=A.1s(G.d,4(K,J){f K>=C?++K:K});2.1e();5(2.$3.i==1){I.m(G.k);F.r(G.w);6 B=A.e(2.$3[0],"q.3");5(B){2.q(C,B)}}2.l.y("2w",[j,2.8(2.$3[C],2.$b[C])],G.1b)},19:4(B){6 D=2.c,E=2.$h.t(B).19(),C=2.$b.t(B).19();5(E.11(D.k)&&2.$3.i>1){2.16(B+(B+1<2.$3.i?1:-1))}D.d=A.1s(A.1W(D.d,4(G,F){f G!=B}),4(G,F){f G>=B?--G:G});2.1e();2.l.y("2v",[j,2.8(E.1C("a")[0],C[0])],D.19)},1V:4(B){6 C=2.c;5(A.1r(B,C.d)==-1){f}6 D=2.$h.t(B).r(C.U);5(A.W.2u){D.1d("1q","2t-1D");1z(4(){D.1d("1q","1D")},0)}C.d=A.1W(C.d,4(F,E){f F!=B});2.l.y("2s",[j,2.8(2.$3[B],2.$b[B])],C.1V)},1S:4(C){6 B=2,D=2.c;5(C!=D.7){2.$h.t(C).m(D.U);D.d.1U(C);D.d.1T();2.l.y("2r",[j,2.8(2.$3[C],2.$b[C])],D.1S)}},16:4(B){5(2q B=="2p"){B=2.$3.Z(2.$3.z("[o$="+B+"]")[0])}2.$3.t(B).2o(2.c.v)},q:4(G,K){6 L=2,D=2.c,E=2.$3.t(G),J=E[0],H=K==1p||K===p,B=E.e("q.3");K=K||4(){};5(!B||!H&&A.e(J,"x.3")){K();f}6 M=4(N){6 O=A(N),P=O.1C("*:2n");f P.i&&P||O};6 C=4(){L.$3.z("."+D.17).r(D.17).V(4(){5(D.1l){M(2).2m().1o(M(2).e("1j.3"))}});L.1n=j};5(D.1l){6 I=M(J).1o();M(J).2l("<1B>").1C("1B").e("1j.3",I).1o(D.1l)}6 F=A.1L({},D.1k,{1R:B,1A:4(O,N){A(J.u).1o(O);C();5(D.x){A.e(J,"x.3",1c)}A(L.l).y("2k",[j,L.8(L.$3[G],L.$b[G])],D.q);D.1k.1A&&D.1k.1A(O,N);K()}});5(2.1n){2.1n.2j();C()}E.m(D.17);1z(4(){L.1n=A.2i(F)},0)},1R:4(C,B){2.$3.t(C).1m("x.3").e("q.3",B)},1a:4(){6 B=2.c;2.l.14(".3").r(B.1w).1m("3");2.$3.V(4(){6 C=A.e(2,"o.3");5(C){2.o=C}6 D=A(2).14(".3");A.V(["o","q","x"],4(E,F){D.1m(F+".3")})});2.$h.1b(2.$b).V(4(){5(A.e(2,"1a.3")){A(2).19()}n{A(2).r([B.k,B.1v,B.U,B.18,B.w].2h(" "))}})}});A.8.3.2g={1h:p,v:"1y",d:[],Y:j,1l:"2fe;",x:p,1Q:"8-3-",1k:{},X:j,1P:\'<1i><1O>#{1j}\',1x:"<1N>",1w:"8-3-2d",k:"8-3-7",1v:"8-3-1h",U:"8-3-d",18:"8-3-1M",w:"8-3-2c",17:"8-3-2b"};A.8.3.2a="i";A.1L(A.8.3.29,{1u:j,28:4(C,F){F=F||p;6 B=2,E=2.c.7;4 G(){B.1u=27(4(){E=++E= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else options.data = q; // data is the query string for 'post' var $form = this, callbacks = []; if (options.resetForm) callbacks.push(function() { $form.resetForm(); }); if (options.clearForm) callbacks.push(function() { $form.clearForm(); }); // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { if (this.evalScripts) $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments); else // jQuery v1.1.4 $(options.target).html(data).each(oldSuccess, arguments); }); } else if (options.success) callbacks.push(options.success); options.success = function(data, status) { for (var i=0, max=callbacks.length; i < max; i++) callbacks[i](data, status, $form); }; // are there files to upload? var files = $('input:file', this).fieldValue(); var found = false; for (var j=0; j < files.length; j++) if (files[j]) found = true; // options.iframe allows user to force iframe mode if (options.iframe || found) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if ($.browser.safari && options.closeKeepAlive) $.get(options.closeKeepAlive, fileUpload); else fileUpload(); } else $.ajax(options); // fire 'notify' event $.event.trigger('form.submit.notify', [this, options]); return this; // private function for handling file uploads (hat tip to YAHOO!) function fileUpload() { var form = $form[0]; var opts = $.extend({}, $.ajaxSettings, options); var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++; var $io = $(''); this.iefix = $(this.update.id+'_iefix'); } if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); }, fixIEOverlapping: function() { Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); this.iefix.style.zIndex = 1; this.update.style.zIndex = 2; Element.show(this.iefix); }, hide: function() { this.stopIndicator(); if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); if(this.iefix) Element.hide(this.iefix); }, startIndicator: function() { if(this.options.indicator) Element.show(this.options.indicator); }, stopIndicator: function() { if(this.options.indicator) Element.hide(this.options.indicator); }, onKeyPress: function(event) { if(this.active) switch(event.keyCode) { case Event.KEY_TAB: case Event.KEY_RETURN: this.selectEntry(); Event.stop(event); case Event.KEY_ESC: this.hide(); this.active = false; Event.stop(event); return; case Event.KEY_LEFT: case Event.KEY_RIGHT: return; case Event.KEY_UP: this.markPrevious(); this.render(); if(Prototype.Browser.WebKit) Event.stop(event); return; case Event.KEY_DOWN: this.markNext(); this.render(); if(Prototype.Browser.WebKit) Event.stop(event); return; } else if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; this.changed = true; this.hasFocus = true; if(this.observer) clearTimeout(this.observer); this.observer = setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); }, activate: function() { this.changed = false; this.hasFocus = true; this.getUpdatedChoices(); }, onHover: function(event) { var element = Event.findElement(event, 'LI'); if(this.index != element.autocompleteIndex) { this.index = element.autocompleteIndex; this.render(); } Event.stop(event); }, onClick: function(event) { var element = Event.findElement(event, 'LI'); this.index = element.autocompleteIndex; this.selectEntry(); this.hide(); }, onBlur: function(event) { // needed to make click events working setTimeout(this.hide.bind(this), 250); this.hasFocus = false; this.active = false; }, render: function() { if(this.entryCount > 0) { for (var i = 0; i < this.entryCount; i++) this.index==i ? Element.addClassName(this.getEntry(i),"selected") : Element.removeClassName(this.getEntry(i),"selected"); if(this.hasFocus) { this.show(); this.active = true; } } else { this.active = false; this.hide(); } }, markPrevious: function() { if(this.index > 0) this.index-- else this.index = this.entryCount-1; this.getEntry(this.index).scrollIntoView(true); }, markNext: function() { if(this.index < this.entryCount-1) this.index++ else this.index = 0; this.getEntry(this.index).scrollIntoView(false); }, getEntry: function(index) { return this.update.firstChild.childNodes[index]; }, getCurrentEntry: function() { return this.getEntry(this.index); }, selectEntry: function() { this.active = false; this.updateElement(this.getCurrentEntry()); }, updateElement: function(selectedElement) { if (this.options.updateElement) { this.options.updateElement(selectedElement); return; } var value = ''; if (this.options.select) { var nodes = $(selectedElement).select('.' + this.options.select) || []; if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); } else value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); var bounds = this.getTokenBounds(); if (bounds[0] != -1) { var newValue = this.element.value.substr(0, bounds[0]); var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); if (whitespace) newValue += whitespace[0]; this.element.value = newValue + value + this.element.value.substr(bounds[1]); } else { this.element.value = value; } this.oldElementValue = this.element.value; this.element.focus(); if (this.options.afterUpdateElement) this.options.afterUpdateElement(this.element, selectedElement); }, updateChoices: function(choices) { if(!this.changed && this.hasFocus) { this.update.innerHTML = choices; Element.cleanWhitespace(this.update); Element.cleanWhitespace(this.update.down()); if(this.update.firstChild && this.update.down().childNodes) { this.entryCount = this.update.down().childNodes.length; for (var i = 0; i < this.entryCount; i++) { var entry = this.getEntry(i); entry.autocompleteIndex = i; this.addObservers(entry); } } else { this.entryCount = 0; } this.stopIndicator(); this.index = 0; if(this.entryCount==1 && this.options.autoSelect) { this.selectEntry(); this.hide(); } else { this.render(); } } }, addObservers: function(element) { Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); Event.observe(element, "click", this.onClick.bindAsEventListener(this)); }, onObserverEvent: function() { this.changed = false; this.tokenBounds = null; if(this.getToken().length>=this.options.minChars) { this.getUpdatedChoices(); } else { this.active = false; this.hide(); } this.oldElementValue = this.element.value; }, getToken: function() { var bounds = this.getTokenBounds(); return this.element.value.substring(bounds[0], bounds[1]).strip(); }, getTokenBounds: function() { if (null != this.tokenBounds) return this.tokenBounds; var value = this.element.value; if (value.strip().empty()) return [-1, 0]; var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); var offset = (diff == this.oldElementValue.length ? 1 : 0); var prevTokenPos = -1, nextTokenPos = value.length; var tp; for (var index = 0, l = this.options.tokens.length; index < l; ++index) { tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); if (tp > prevTokenPos) prevTokenPos = tp; tp = value.indexOf(this.options.tokens[index], diff + offset); if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; } return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); } }); Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { var boundary = Math.min(newS.length, oldS.length); for (var index = 0; index < boundary; ++index) if (newS[index] != oldS[index]) return index; return boundary; }; Ajax.Autocompleter = Class.create(Autocompleter.Base, { initialize: function(element, update, url, options) { this.baseInitialize(element, update, options); this.options.asynchronous = true; this.options.onComplete = this.onComplete.bind(this); this.options.defaultParams = this.options.parameters || null; this.url = url; }, getUpdatedChoices: function() { this.startIndicator(); var entry = encodeURIComponent(this.options.paramName) + '=' + encodeURIComponent(this.getToken()); this.options.parameters = this.options.callback ? this.options.callback(this.element, entry) : entry; if(this.options.defaultParams) this.options.parameters += '&' + this.options.defaultParams; new Ajax.Request(this.url, this.options); }, onComplete: function(request) { this.updateChoices(request.responseText); } }); // The local array autocompleter. Used when you'd prefer to // inject an array of autocompletion options into the page, rather // than sending out Ajax queries, which can be quite slow sometimes. // // The constructor takes four parameters. The first two are, as usual, // the id of the monitored textbox, and id of the autocompletion menu. // The third is the array you want to autocomplete from, and the fourth // is the options block. // // Extra local autocompletion options: // - choices - How many autocompletion choices to offer // // - partialSearch - If false, the autocompleter will match entered // text only at the beginning of strings in the // autocomplete array. Defaults to true, which will // match text at the beginning of any *word* in the // strings in the autocomplete array. If you want to // search anywhere in the string, additionally set // the option fullSearch to true (default: off). // // - fullSsearch - Search anywhere in autocomplete array strings. // // - partialChars - How many characters to enter before triggering // a partial match (unlike minChars, which defines // how many characters are required to do any match // at all). Defaults to 2. // // - ignoreCase - Whether to ignore case when autocompleting. // Defaults to true. // // It's possible to pass in a custom function as the 'selector' // option, if you prefer to write your own autocompletion logic. // In that case, the other options above will not apply unless // you support them. Autocompleter.Local = Class.create(Autocompleter.Base, { initialize: function(element, update, array, options) { this.baseInitialize(element, update, options); this.options.array = array; }, getUpdatedChoices: function() { this.updateChoices(this.options.selector(this)); }, setOptions: function(options) { this.options = Object.extend({ choices: 10, partialSearch: true, partialChars: 2, ignoreCase: true, fullSearch: false, selector: function(instance) { var ret = []; // Beginning matches var partial = []; // Inside matches var entry = instance.getToken(); var count = 0; for (var i = 0; i < instance.options.array.length && ret.length < instance.options.choices ; i++) { var elem = instance.options.array[i]; var foundPos = instance.options.ignoreCase ? elem.toLowerCase().indexOf(entry.toLowerCase()) : elem.indexOf(entry); while (foundPos != -1) { if (foundPos == 0 && elem.length != entry.length) { ret.push("
  • " + elem.substr(0, entry.length) + "" + elem.substr(entry.length) + "
  • "); break; } else if (entry.length >= instance.options.partialChars && instance.options.partialSearch && foundPos != -1) { if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { partial.push("
  • " + elem.substr(0, foundPos) + "" + elem.substr(foundPos, entry.length) + "" + elem.substr( foundPos + entry.length) + "
  • "); break; } } foundPos = instance.options.ignoreCase ? elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : elem.indexOf(entry, foundPos + 1); } } if (partial.length) ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) return "
      " + ret.join('') + "
    "; } }, options || { }); } }); // AJAX in-place editor and collection editor // Full rewrite by Christophe Porteneuve (April 2007). // Use this if you notice weird scrolling problems on some browsers, // the DOM might be a bit confused when this gets called so do this // waits 1 ms (with setTimeout) until it does the activation Field.scrollFreeActivate = function(field) { setTimeout(function() { Field.activate(field); }, 1); } Ajax.InPlaceEditor = Class.create({ initialize: function(element, url, options) { this.url = url; this.element = element = $(element); this.prepareOptions(); this._controls = { }; arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! Object.extend(this.options, options || { }); if (!this.options.formId && this.element.id) { this.options.formId = this.element.id + '-inplaceeditor'; if ($(this.options.formId)) this.options.formId = ''; } if (this.options.externalControl) this.options.externalControl = $(this.options.externalControl); if (!this.options.externalControl) this.options.externalControlOnly = false; this._originalBackground = this.element.getStyle('background-color') || 'transparent'; this.element.title = this.options.clickToEditText; this._boundCancelHandler = this.handleFormCancellation.bind(this); this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); this._boundFailureHandler = this.handleAJAXFailure.bind(this); this._boundSubmitHandler = this.handleFormSubmission.bind(this); this._boundWrapperHandler = this.wrapUp.bind(this); this.registerListeners(); }, checkForEscapeOrReturn: function(e) { if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; if (Event.KEY_ESC == e.keyCode) this.handleFormCancellation(e); else if (Event.KEY_RETURN == e.keyCode) this.handleFormSubmission(e); }, createControl: function(mode, handler, extraClasses) { var control = this.options[mode + 'Control']; var text = this.options[mode + 'Text']; if ('button' == control) { var btn = document.createElement('input'); btn.type = 'submit'; btn.value = text; btn.className = 'editor_' + mode + '_button'; if ('cancel' == mode) btn.onclick = this._boundCancelHandler; this._form.appendChild(btn); this._controls[mode] = btn; } else if ('link' == control) { var link = document.createElement('a'); link.href = '#'; link.appendChild(document.createTextNode(text)); link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; link.className = 'editor_' + mode + '_link'; if (extraClasses) link.className += ' ' + extraClasses; this._form.appendChild(link); this._controls[mode] = link; } }, createEditField: function() { var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); var fld; if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { fld = document.createElement('input'); fld.type = 'text'; var size = this.options.size || this.options.cols || 0; if (0 < size) fld.size = size; } else { fld = document.createElement('textarea'); fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); fld.cols = this.options.cols || 40; } fld.name = this.options.paramName; fld.value = text; // No HTML breaks conversion anymore fld.className = 'editor_field'; if (this.options.submitOnBlur) fld.onblur = this._boundSubmitHandler; this._controls.editor = fld; if (this.options.loadTextURL) this.loadExternalText(); this._form.appendChild(this._controls.editor); }, createForm: function() { var ipe = this; function addText(mode, condition) { var text = ipe.options['text' + mode + 'Controls']; if (!text || condition === false) return; ipe._form.appendChild(document.createTextNode(text)); }; this._form = $(document.createElement('form')); this._form.id = this.options.formId; this._form.addClassName(this.options.formClassName); this._form.onsubmit = this._boundSubmitHandler; this.createEditField(); if ('textarea' == this._controls.editor.tagName.toLowerCase()) this._form.appendChild(document.createElement('br')); if (this.options.onFormCustomization) this.options.onFormCustomization(this, this._form); addText('Before', this.options.okControl || this.options.cancelControl); this.createControl('ok', this._boundSubmitHandler); addText('Between', this.options.okControl && this.options.cancelControl); this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); addText('After', this.options.okControl || this.options.cancelControl); }, destroy: function() { if (this._oldInnerHTML) this.element.innerHTML = this._oldInnerHTML; this.leaveEditMode(); this.unregisterListeners(); }, enterEditMode: function(e) { if (this._saving || this._editing) return; this._editing = true; this.triggerCallback('onEnterEditMode'); if (this.options.externalControl) this.options.externalControl.hide(); this.element.hide(); this.createForm(); this.element.parentNode.insertBefore(this._form, this.element); if (!this.options.loadTextURL) this.postProcessEditField(); if (e) Event.stop(e); }, enterHover: function(e) { if (this.options.hoverClassName) this.element.addClassName(this.options.hoverClassName); if (this._saving) return; this.triggerCallback('onEnterHover'); }, getText: function() { return this.element.innerHTML; }, handleAJAXFailure: function(transport) { this.triggerCallback('onFailure', transport); if (this._oldInnerHTML) { this.element.innerHTML = this._oldInnerHTML; this._oldInnerHTML = null; } }, handleFormCancellation: function(e) { this.wrapUp(); if (e) Event.stop(e); }, handleFormSubmission: function(e) { var form = this._form; var value = $F(this._controls.editor); this.prepareSubmission(); var params = this.options.callback(form, value) || ''; if (Object.isString(params)) params = params.toQueryParams(); params.editorId = this.element.id; if (this.options.htmlResponse) { var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); Object.extend(options, { parameters: params, onComplete: this._boundWrapperHandler, onFailure: this._boundFailureHandler }); new Ajax.Updater({ success: this.element }, this.url, options); } else { var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); Object.extend(options, { parameters: params, onComplete: this._boundWrapperHandler, onFailure: this._boundFailureHandler }); new Ajax.Request(this.url, options); } if (e) Event.stop(e); }, leaveEditMode: function() { this.element.removeClassName(this.options.savingClassName); this.removeForm(); this.leaveHover(); this.element.style.backgroundColor = this._originalBackground; this.element.show(); if (this.options.externalControl) this.options.externalControl.show(); this._saving = false; this._editing = false; this._oldInnerHTML = null; this.triggerCallback('onLeaveEditMode'); }, leaveHover: function(e) { if (this.options.hoverClassName) this.element.removeClassName(this.options.hoverClassName); if (this._saving) return; this.triggerCallback('onLeaveHover'); }, loadExternalText: function() { this._form.addClassName(this.options.loadingClassName); this._controls.editor.disabled = true; var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); Object.extend(options, { parameters: 'editorId=' + encodeURIComponent(this.element.id), onComplete: Prototype.emptyFunction, onSuccess: function(transport) { this._form.removeClassName(this.options.loadingClassName); var text = transport.responseText; if (this.options.stripLoadedTextTags) text = text.stripTags(); this._controls.editor.value = text; this._controls.editor.disabled = false; this.postProcessEditField(); }.bind(this), onFailure: this._boundFailureHandler }); new Ajax.Request(this.options.loadTextURL, options); }, postProcessEditField: function() { var fpc = this.options.fieldPostCreation; if (fpc) $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); }, prepareOptions: function() { this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); [this._extraDefaultOptions].flatten().compact().each(function(defs) { Object.extend(this.options, defs); }.bind(this)); }, prepareSubmission: function() { this._saving = true; this.removeForm(); this.leaveHover(); this.showSaving(); }, registerListeners: function() { this._listeners = { }; var listener; $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { listener = this[pair.value].bind(this); this._listeners[pair.key] = listener; if (!this.options.externalControlOnly) this.element.observe(pair.key, listener); if (this.options.externalControl) this.options.externalControl.observe(pair.key, listener); }.bind(this)); }, removeForm: function() { if (!this._form) return; this._form.remove(); this._form = null; this._controls = { }; }, showSaving: function() { this._oldInnerHTML = this.element.innerHTML; this.element.innerHTML = this.options.savingText; this.element.addClassName(this.options.savingClassName); this.element.style.backgroundColor = this._originalBackground; this.element.show(); }, triggerCallback: function(cbName, arg) { if ('function' == typeof this.options[cbName]) { this.options[cbName](this, arg); } }, unregisterListeners: function() { $H(this._listeners).each(function(pair) { if (!this.options.externalControlOnly) this.element.stopObserving(pair.key, pair.value); if (this.options.externalControl) this.options.externalControl.stopObserving(pair.key, pair.value); }.bind(this)); }, wrapUp: function(transport) { this.leaveEditMode(); // Can't use triggerCallback due to backward compatibility: requires // binding + direct element this._boundComplete(transport, this.element); } }); Object.extend(Ajax.InPlaceEditor.prototype, { dispose: Ajax.InPlaceEditor.prototype.destroy }); Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { initialize: function($super, element, url, options) { this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; $super(element, url, options); }, createEditField: function() { var list = document.createElement('select'); list.name = this.options.paramName; list.size = 1; this._controls.editor = list; this._collection = this.options.collection || []; if (this.options.loadCollectionURL) this.loadCollection(); else this.checkForExternalText(); this._form.appendChild(this._controls.editor); }, loadCollection: function() { this._form.addClassName(this.options.loadingClassName); this.showLoadingText(this.options.loadingCollectionText); var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); Object.extend(options, { parameters: 'editorId=' + encodeURIComponent(this.element.id), onComplete: Prototype.emptyFunction, onSuccess: function(transport) { var js = transport.responseText.strip(); if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check throw 'Server returned an invalid collection representation.'; this._collection = eval(js); this.checkForExternalText(); }.bind(this), onFailure: this.onFailure }); new Ajax.Request(this.options.loadCollectionURL, options); }, showLoadingText: function(text) { this._controls.editor.disabled = true; var tempOption = this._controls.editor.firstChild; if (!tempOption) { tempOption = document.createElement('option'); tempOption.value = ''; this._controls.editor.appendChild(tempOption); tempOption.selected = true; } tempOption.update((text || '').stripScripts().stripTags()); }, checkForExternalText: function() { this._text = this.getText(); if (this.options.loadTextURL) this.loadExternalText(); else this.buildOptionList(); }, loadExternalText: function() { this.showLoadingText(this.options.loadingText); var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); Object.extend(options, { parameters: 'editorId=' + encodeURIComponent(this.element.id), onComplete: Prototype.emptyFunction, onSuccess: function(transport) { this._text = transport.responseText.strip(); this.buildOptionList(); }.bind(this), onFailure: this.onFailure }); new Ajax.Request(this.options.loadTextURL, options); }, buildOptionList: function() { this._form.removeClassName(this.options.loadingClassName); this._collection = this._collection.map(function(entry) { return 2 === entry.length ? entry : [entry, entry].flatten(); }); var marker = ('value' in this.options) ? this.options.value : this._text; var textFound = this._collection.any(function(entry) { return entry[0] == marker; }.bind(this)); this._controls.editor.update(''); var option; this._collection.each(function(entry, index) { option = document.createElement('option'); option.value = entry[0]; option.selected = textFound ? entry[0] == marker : 0 == index; option.appendChild(document.createTextNode(entry[1])); this._controls.editor.appendChild(option); }.bind(this)); this._controls.editor.disabled = false; Field.scrollFreeActivate(this._controls.editor); } }); //**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** //**** This only exists for a while, in order to let **** //**** users adapt to the new API. Read up on the new **** //**** API and convert your code to it ASAP! **** Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { if (!options) return; function fallback(name, expr) { if (name in options || expr === undefined) return; options[name] = expr; }; fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : options.cancelLink == options.cancelButton == false ? false : undefined))); fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : options.okLink == options.okButton == false ? false : undefined))); fallback('highlightColor', options.highlightcolor); fallback('highlightEndColor', options.highlightendcolor); }; Object.extend(Ajax.InPlaceEditor, { DefaultOptions: { ajaxOptions: { }, autoRows: 3, // Use when multi-line w/ rows == 1 cancelControl: 'link', // 'link'|'button'|false cancelText: 'cancel', clickToEditText: 'Click to edit', externalControl: null, // id|elt externalControlOnly: false, fieldPostCreation: 'activate', // 'activate'|'focus'|false formClassName: 'inplaceeditor-form', formId: null, // id|elt highlightColor: '#ffff99', highlightEndColor: '#ffffff', hoverClassName: '', htmlResponse: true, loadingClassName: 'inplaceeditor-loading', loadingText: 'Loading...', okControl: 'button', // 'link'|'button'|false okText: 'ok', paramName: 'value', rows: 1, // If 1 and multi-line, uses autoRows savingClassName: 'inplaceeditor-saving', savingText: 'Saving...', size: 0, stripLoadedTextTags: false, submitOnBlur: false, textAfterControls: '', textBeforeControls: '', textBetweenControls: '' }, DefaultCallbacks: { callback: function(form) { return Form.serialize(form); }, onComplete: function(transport, element) { // For backward compatibility, this one is bound to the IPE, and passes // the element directly. It was too often customized, so we don't break it. new Effect.Highlight(element, { startcolor: this.options.highlightColor, keepBackgroundImage: true }); }, onEnterEditMode: null, onEnterHover: function(ipe) { ipe.element.style.backgroundColor = ipe.options.highlightColor; if (ipe._effect) ipe._effect.cancel(); }, onFailure: function(transport, ipe) { alert('Error communication with the server: ' + transport.responseText.stripTags()); }, onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. onLeaveEditMode: null, onLeaveHover: function(ipe) { ipe._effect = new Effect.Highlight(ipe.element, { startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, restorecolor: ipe._originalBackground, keepBackgroundImage: true }); } }, Listeners: { click: 'enterEditMode', keydown: 'checkForEscapeOrReturn', mouseover: 'enterHover', mouseout: 'leaveHover' } }); Ajax.InPlaceCollectionEditor.DefaultOptions = { loadingCollectionText: 'Loading options...' }; // Delayed observer, like Form.Element.Observer, // but waits for delay after last key input // Ideal for live-search fields Form.Element.DelayedObserver = Class.create({ initialize: function(element, delay, callback) { this.delay = delay || 0.5; this.element = $(element); this.callback = callback; this.timer = null; this.lastValue = $F(this.element); Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); }, delayedListener: function(event) { if(this.lastValue == $F(this.element)) return; if(this.timer) clearTimeout(this.timer); this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); this.lastValue = $F(this.element); }, onTimerEvent: function() { this.timer = null; this.callback(this.element, $F(this.element)); } }); blogs/wp-includes/js/scriptaculous/slider.js0000644000000000000000000002407011077635520020261 0ustar rootroot// script.aculo.us slider.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ if (!Control) var Control = { }; // options: // axis: 'vertical', or 'horizontal' (default) // // callbacks: // onChange(value) // onSlide(value) Control.Slider = Class.create({ initialize: function(handle, track, options) { var slider = this; if (Object.isArray(handle)) { this.handles = handle.collect( function(e) { return $(e) }); } else { this.handles = [$(handle)]; } this.track = $(track); this.options = options || { }; this.axis = this.options.axis || 'horizontal'; this.increment = this.options.increment || 1; this.step = parseInt(this.options.step || '1'); this.range = this.options.range || $R(0,1); this.value = 0; // assure backwards compat this.values = this.handles.map( function() { return 0 }); this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; this.options.startSpan = $(this.options.startSpan || null); this.options.endSpan = $(this.options.endSpan || null); this.restricted = this.options.restricted || false; this.maximum = this.options.maximum || this.range.end; this.minimum = this.options.minimum || this.range.start; // Will be used to align the handle onto the track, if necessary this.alignX = parseInt(this.options.alignX || '0'); this.alignY = parseInt(this.options.alignY || '0'); this.trackLength = this.maximumOffset() - this.minimumOffset(); this.handleLength = this.isVertical() ? (this.handles[0].offsetHeight != 0 ? this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : this.handles[0].style.width.replace(/px$/,"")); this.active = false; this.dragging = false; this.disabled = false; if (this.options.disabled) this.setDisabled(); // Allowed values array this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; if (this.allowedValues) { this.minimum = this.allowedValues.min(); this.maximum = this.allowedValues.max(); } this.eventMouseDown = this.startDrag.bindAsEventListener(this); this.eventMouseUp = this.endDrag.bindAsEventListener(this); this.eventMouseMove = this.update.bindAsEventListener(this); // Initialize handles in reverse (make sure first handle is active) this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( (Object.isArray(slider.options.sliderValue) ? slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); h.makePositioned().observe("mousedown", slider.eventMouseDown); }); this.track.observe("mousedown", this.eventMouseDown); document.observe("mouseup", this.eventMouseUp); document.observe("mousemove", this.eventMouseMove); this.initialized = true; }, dispose: function() { var slider = this; Event.stopObserving(this.track, "mousedown", this.eventMouseDown); Event.stopObserving(document, "mouseup", this.eventMouseUp); Event.stopObserving(document, "mousemove", this.eventMouseMove); this.handles.each( function(h) { Event.stopObserving(h, "mousedown", slider.eventMouseDown); }); }, setDisabled: function(){ this.disabled = true; }, setEnabled: function(){ this.disabled = false; }, getNearestValue: function(value){ if (this.allowedValues){ if (value >= this.allowedValues.max()) return(this.allowedValues.max()); if (value <= this.allowedValues.min()) return(this.allowedValues.min()); var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; this.allowedValues.each( function(v) { var currentOffset = Math.abs(v - value); if (currentOffset <= offset){ newValue = v; offset = currentOffset; } }); return newValue; } if (value > this.range.end) return this.range.end; if (value < this.range.start) return this.range.start; return value; }, setValue: function(sliderValue, handleIdx){ if (!this.active) { this.activeHandleIdx = handleIdx || 0; this.activeHandle = this.handles[this.activeHandleIdx]; this.updateStyles(); } handleIdx = handleIdx || this.activeHandleIdx || 0; if (this.initialized && this.restricted) { if ((handleIdx>0) && (sliderValuethis.values[handleIdx+1])) sliderValue = this.values[handleIdx+1]; } sliderValue = this.getNearestValue(sliderValue); this.values[handleIdx] = sliderValue; this.value = this.values[0]; // assure backwards compat this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = this.translateToPx(sliderValue); this.drawSpans(); if (!this.dragging || !this.event) this.updateFinished(); }, setValueBy: function(delta, handleIdx) { this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, handleIdx || this.activeHandleIdx || 0); }, translateToPx: function(value) { return Math.round( ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * (value - this.range.start)) + "px"; }, translateToValue: function(offset) { return ((offset/(this.trackLength-this.handleLength) * (this.range.end-this.range.start)) + this.range.start); }, getRange: function(range) { var v = this.values.sortBy(Prototype.K); range = range || 0; return $R(v[range],v[range+1]); }, minimumOffset: function(){ return(this.isVertical() ? this.alignY : this.alignX); }, maximumOffset: function(){ return(this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : this.track.style.height.replace(/px$/,"")) - this.alignY : (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/,"")) - this.alignX); }, isVertical: function(){ return (this.axis == 'vertical'); }, drawSpans: function() { var slider = this; if (this.spans) $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); if (this.options.startSpan) this.setSpan(this.options.startSpan, $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); if (this.options.endSpan) this.setSpan(this.options.endSpan, $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); }, setSpan: function(span, range) { if (this.isVertical()) { span.style.top = this.translateToPx(range.start); span.style.height = this.translateToPx(range.end - range.start + this.range.start); } else { span.style.left = this.translateToPx(range.start); span.style.width = this.translateToPx(range.end - range.start + this.range.start); } }, updateStyles: function() { this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); Element.addClassName(this.activeHandle, 'selected'); }, startDrag: function(event) { if (Event.isLeftClick(event)) { if (!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; if (track==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; if (this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } } Event.stop(event); } }, update: function(event) { if (this.active) { if (!this.dragging) this.dragging = true; this.draw(event); if (Prototype.Browser.WebKit) window.scrollBy(0,0); Event.stop(event); } }, draw: function(event) { var pointer = [Event.pointerX(event), Event.pointerY(event)]; var offsets = Position.cumulativeOffset(this.track); pointer[0] -= this.offsetX + offsets[0]; pointer[1] -= this.offsetY + offsets[1]; this.event = event; this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); if (this.initialized && this.options.onSlide) this.options.onSlide(this.values.length>1 ? this.values : this.value, this); }, endDrag: function(event) { if (this.active && this.dragging) { this.finishDrag(event, true); Event.stop(event); } this.active = false; this.dragging = false; }, finishDrag: function(event, success) { this.active = false; this.dragging = false; this.updateFinished(); }, updateFinished: function() { if (this.initialized && this.options.onChange) this.options.onChange(this.values.length>1 ? this.values : this.value, this); this.event = null; } }); blogs/wp-includes/js/scriptaculous/MIT-LICENSE0000644000000000000000000000214511077635520020074 0ustar rootrootCopyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.blogs/wp-includes/js/scriptaculous/sound.js0000644000000000000000000000360011077635520020123 0ustar rootroot// script.aculo.us sound.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Based on code created by Jules Gravinese (http://www.webveteran.com/) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ Sound = { tracks: {}, _enabled: true, template: new Template(''), enable: function(){ Sound._enabled = true; }, disable: function(){ Sound._enabled = false; }, play: function(url){ if(!Sound._enabled) return; var options = Object.extend({ track: 'global', url: url, replace: false }, arguments[1] || {}); if(options.replace && this.tracks[options.track]) { $R(0, this.tracks[options.track].id).each(function(id){ var sound = $('sound_'+options.track+'_'+id); sound.Stop && sound.Stop(); sound.remove(); }) this.tracks[options.track] = null; } if(!this.tracks[options.track]) this.tracks[options.track] = { id: 0 } else this.tracks[options.track].id++; options.id = this.tracks[options.track].id; $$('body')[0].insert( Prototype.Browser.IE ? new Element('bgsound',{ id: 'sound_'+options.track+'_'+options.id, src: options.url, loop: 1, autostart: true }) : Sound.template.evaluate(options)); } }; if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){ if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 })) Sound.template = new Template('') else Sound.play = function(){} } blogs/wp-includes/js/scriptaculous/builder.js0000644000000000000000000001124211077635520020422 0ustar rootroot// script.aculo.us builder.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ var Builder = { NODEMAP: { AREA: 'map', CAPTION: 'table', COL: 'table', COLGROUP: 'table', LEGEND: 'fieldset', OPTGROUP: 'select', OPTION: 'select', PARAM: 'object', TBODY: 'table', TD: 'table', TFOOT: 'table', TH: 'table', THEAD: 'table', TR: 'table' }, // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, // due to a Firefox bug node: function(elementName) { elementName = elementName.toUpperCase(); // try innerHTML approach var parentTag = this.NODEMAP[elementName] || 'div'; var parentElement = document.createElement(parentTag); try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" + elementName + ">"; } catch(e) {} var element = parentElement.firstChild || null; // see if browser added wrapping tags if(element && (element.tagName.toUpperCase() != elementName)) element = element.getElementsByTagName(elementName)[0]; // fallback to createElement approach if(!element) element = document.createElement(elementName); // abort if nothing could be created if(!element) return; // attributes (or text) if(arguments[1]) if(this._isStringOrNumber(arguments[1]) || (arguments[1] instanceof Array) || arguments[1].tagName) { this._children(element, arguments[1]); } else { var attrs = this._attributes(arguments[1]); if(attrs.length) { try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" +elementName + " " + attrs + ">"; } catch(e) {} element = parentElement.firstChild || null; // workaround firefox 1.0.X bug if(!element) { element = document.createElement(elementName); for(attr in arguments[1]) element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; } if(element.tagName.toUpperCase() != elementName) element = parentElement.getElementsByTagName(elementName)[0]; } } // text, or array of children if(arguments[2]) this._children(element, arguments[2]); return element; }, _text: function(text) { return document.createTextNode(text); }, ATTR_MAP: { 'className': 'class', 'htmlFor': 'for' }, _attributes: function(attributes) { var attrs = []; for(attribute in attributes) attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); return attrs.join(" "); }, _children: function(element, children) { if(children.tagName) { element.appendChild(children); return; } if(typeof children=='object') { // array can hold nodes and text children.flatten().each( function(e) { if(typeof e=='object') element.appendChild(e) else if(Builder._isStringOrNumber(e)) element.appendChild(Builder._text(e)); }); } else if(Builder._isStringOrNumber(children)) element.appendChild(Builder._text(children)); }, _isStringOrNumber: function(param) { return(typeof param=='string' || typeof param=='number'); }, build: function(html) { var element = this.node('div'); $(element).update(html.strip()); return element.down(); }, dump: function(scope) { if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); tags.each( function(tag){ scope[tag] = function() { return Builder.node.apply(Builder, [tag].concat($A(arguments))); } }); } } blogs/wp-includes/js/scriptaculous/wp-scriptaculous.js0000644000000000000000000000507111077635520022323 0ustar rootroot// script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // For details, see the script.aculo.us web site: http://script.aculo.us/ var Scriptaculous = { Version: '1.8.0', require: function(libraryName) { // inserting via DOM fails in Safari 2.0, so brute force approach document.write(''); }, REQUIRED_PROTOTYPE: '1.6', load: function() { function convertVersionString(versionString){ var r = versionString.split('.'); return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]); } if((typeof Prototype=='undefined') || (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || (convertVersionString(Prototype.Version) < convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE))) throw("script.aculo.us requires the Prototype JavaScript framework >= " + Scriptaculous.REQUIRED_PROTOTYPE); $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) }).each( function(s) { var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); var includes = s.src.match(/\?.*load=([a-z,]*)/); if ( includes ) includes[1].split(',').each( function(include) { Scriptaculous.require(path+include+'.js') }); }); } } Scriptaculous.load(); blogs/wp-includes/js/scriptaculous/prototype.js0000644000000000000000000036235011077635520021052 0ustar rootroot/* Prototype JavaScript framework, version 1.6.0 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://www.prototypejs.org/ * *--------------------------------------------------------------------------*/ var Prototype = { Version: '1.6.0', Browser: { IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) }, BrowserFeatures: { XPath: !!document.evaluate, ElementExtensions: !!window.HTMLElement, SpecificElementExtensions: document.createElement('div').__proto__ && document.createElement('div').__proto__ !== document.createElement('form').__proto__ }, ScriptFragment: ']*>([\\S\\s]*?)<\/script>', JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, emptyFunction: function() { }, K: function(x) { return x } }; if (Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions = false; if (Prototype.Browser.WebKit) Prototype.BrowserFeatures.XPath = false; /* Based on Alex Arnell's inheritance implementation. */ var Class = { create: function() { var parent = null, properties = $A(arguments); if (Object.isFunction(properties[0])) parent = properties.shift(); function klass() { this.initialize.apply(this, arguments); } Object.extend(klass, Class.Methods); klass.superclass = parent; klass.subclasses = []; if (parent) { var subclass = function() { }; subclass.prototype = parent.prototype; klass.prototype = new subclass; parent.subclasses.push(klass); } for (var i = 0; i < properties.length; i++) klass.addMethods(properties[i]); if (!klass.prototype.initialize) klass.prototype.initialize = Prototype.emptyFunction; klass.prototype.constructor = klass; return klass; } }; Class.Methods = { addMethods: function(source) { var ancestor = this.superclass && this.superclass.prototype; var properties = Object.keys(source); if (!Object.keys({ toString: true }).length) properties.push("toString", "valueOf"); for (var i = 0, length = properties.length; i < length; i++) { var property = properties[i], value = source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames().first() == "$super") { var method = value, value = Object.extend((function(m) { return function() { return ancestor[m].apply(this, arguments) }; })(property).wrap(method), { valueOf: function() { return method }, toString: function() { return method.toString() } }); } this.prototype[property] = value; } return this; } }; var Abstract = { }; Object.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination; }; Object.extend(Object, { inspect: function(object) { try { if (object === undefined) return 'undefined'; if (object === null) return 'null'; return object.inspect ? object.inspect() : object.toString(); } catch (e) { if (e instanceof RangeError) return '...'; throw e; } }, toJSON: function(object) { var type = typeof object; switch (type) { case 'undefined': case 'function': case 'unknown': return; case 'boolean': return object.toString(); } if (object === null) return 'null'; if (object.toJSON) return object.toJSON(); if (Object.isElement(object)) return; var results = []; for (var property in object) { var value = Object.toJSON(object[property]); if (value !== undefined) results.push(property.toJSON() + ': ' + value); } return '{' + results.join(', ') + '}'; }, toQueryString: function(object) { return $H(object).toQueryString(); }, toHTML: function(object) { return object && object.toHTML ? object.toHTML() : String.interpret(object); }, keys: function(object) { var keys = []; for (var property in object) keys.push(property); return keys; }, values: function(object) { var values = []; for (var property in object) values.push(object[property]); return values; }, clone: function(object) { return Object.extend({ }, object); }, isElement: function(object) { return object && object.nodeType == 1; }, isArray: function(object) { return object && object.constructor === Array; }, isHash: function(object) { return object instanceof Hash; }, isFunction: function(object) { return typeof object == "function"; }, isString: function(object) { return typeof object == "string"; }, isNumber: function(object) { return typeof object == "number"; }, isUndefined: function(object) { return typeof object == "undefined"; } }); Object.extend(Function.prototype, { argumentNames: function() { var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); return names.length == 1 && !names[0] ? [] : names; }, bind: function() { if (arguments.length < 2 && arguments[0] === undefined) return this; var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } }, bindAsEventListener: function() { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [event || window.event].concat(args)); } }, curry: function() { if (!arguments.length) return this; var __method = this, args = $A(arguments); return function() { return __method.apply(this, args.concat($A(arguments))); } }, delay: function() { var __method = this, args = $A(arguments), timeout = args.shift() * 1000; return window.setTimeout(function() { return __method.apply(__method, args); }, timeout); }, wrap: function(wrapper) { var __method = this; return function() { return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); } }, methodize: function() { if (this._methodized) return this._methodized; var __method = this; return this._methodized = function() { return __method.apply(null, [this].concat($A(arguments))); }; } }); Function.prototype.defer = Function.prototype.delay.curry(0.01); Date.prototype.toJSON = function() { return '"' + this.getUTCFullYear() + '-' + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + this.getUTCDate().toPaddedString(2) + 'T' + this.getUTCHours().toPaddedString(2) + ':' + this.getUTCMinutes().toPaddedString(2) + ':' + this.getUTCSeconds().toPaddedString(2) + 'Z"'; }; var Try = { these: function() { var returnValue; for (var i = 0, length = arguments.length; i < length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break; } catch (e) { } } return returnValue; } }; RegExp.prototype.match = RegExp.prototype.test; RegExp.escape = function(str) { return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); }; /*--------------------------------------------------------------------------*/ var PeriodicalExecuter = Class.create({ initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback(); }, registerCallback: function() { this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, execute: function() { this.callback(this); }, stop: function() { if (!this.timer) return; clearInterval(this.timer); this.timer = null; }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; this.execute(); } finally { this.currentlyExecuting = false; } } } }); Object.extend(String, { interpret: function(value) { return value == null ? '' : String(value); }, specialChar: { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '\\': '\\\\' } }); Object.extend(String.prototype, { gsub: function(pattern, replacement) { var result = '', source = this, match; replacement = arguments.callee.prepareReplacement(replacement); while (source.length > 0) { if (match = source.match(pattern)) { result += source.slice(0, match.index); result += String.interpret(replacement(match)); source = source.slice(match.index + match[0].length); } else { result += source, source = ''; } } return result; }, sub: function(pattern, replacement, count) { replacement = this.gsub.prepareReplacement(replacement); count = count === undefined ? 1 : count; return this.gsub(pattern, function(match) { if (--count < 0) return match[0]; return replacement(match); }); }, scan: function(pattern, iterator) { this.gsub(pattern, iterator); return String(this); }, truncate: function(length, truncation) { length = length || 30; truncation = truncation === undefined ? '...' : truncation; return this.length > length ? this.slice(0, length - truncation.length) + truncation : String(this); }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, stripTags: function() { return this.replace(/<\/?[^>]+>/gi, ''); }, stripScripts: function() { return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); }, extractScripts: function() { var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); return (this.match(matchAll) || []).map(function(scriptTag) { return (scriptTag.match(matchOne) || ['', ''])[1]; }); }, evalScripts: function() { return this.extractScripts().map(function(script) { return eval(script) }); }, escapeHTML: function() { var self = arguments.callee; self.text.data = this; return self.div.innerHTML; }, unescapeHTML: function() { var div = new Element('div'); div.innerHTML = this.stripTags(); return div.childNodes[0] ? (div.childNodes.length > 1 ? $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : div.childNodes[0].nodeValue) : ''; }, toQueryParams: function(separator) { var match = this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return { }; return match[1].split(separator || '&').inject({ }, function(hash, pair) { if ((pair = pair.split('='))[0]) { var key = decodeURIComponent(pair.shift()); var value = pair.length > 1 ? pair.join('=') : pair[0]; if (value != undefined) value = decodeURIComponent(value); if (key in hash) { if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; hash[key].push(value); } else hash[key] = value; } return hash; }); }, toArray: function() { return this.split(''); }, succ: function() { return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); }, times: function(count) { return count < 1 ? '' : new Array(count + 1).join(this); }, camelize: function() { var parts = this.split('-'), len = parts.length; if (len == 1) return parts[0]; var camelized = this.charAt(0) == '-' ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0]; for (var i = 1; i < len; i++) camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); return camelized; }, capitalize: function() { return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }, underscore: function() { return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); }, dasherize: function() { return this.gsub(/_/,'-'); }, inspect: function(useDoubleQuotes) { var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { var character = String.specialChar[match[0]]; return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); }); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; return "'" + escapedString.replace(/'/g, '\\\'') + "'"; }, toJSON: function() { return this.inspect(true); }, unfilterJSON: function(filter) { return this.sub(filter || Prototype.JSONFilter, '#{1}'); }, isJSON: function() { var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, evalJSON: function(sanitize) { var json = this.unfilterJSON(); try { if (!sanitize || json.isJSON()) return eval('(' + json + ')'); } catch (e) { } throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); }, include: function(pattern) { return this.indexOf(pattern) > -1; }, startsWith: function(pattern) { return this.indexOf(pattern) === 0; }, endsWith: function(pattern) { var d = this.length - pattern.length; return d >= 0 && this.lastIndexOf(pattern) === d; }, empty: function() { return this == ''; }, blank: function() { return /^\s*$/.test(this); }, interpolate: function(object, pattern) { return new Template(this, pattern).evaluate(object); } }); if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { escapeHTML: function() { return this.replace(/&/g,'&').replace(//g,'>'); }, unescapeHTML: function() { return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); } }); String.prototype.gsub.prepareReplacement = function(replacement) { if (Object.isFunction(replacement)) return replacement; var template = new Template(replacement); return function(match) { return template.evaluate(match) }; }; String.prototype.parseQuery = String.prototype.toQueryParams; Object.extend(String.prototype.escapeHTML, { div: document.createElement('div'), text: document.createTextNode('') }); with (String.prototype.escapeHTML) div.appendChild(text); var Template = Class.create({ initialize: function(template, pattern) { this.template = template.toString(); this.pattern = pattern || Template.Pattern; }, evaluate: function(object) { if (Object.isFunction(object.toTemplateReplacements)) object = object.toTemplateReplacements(); return this.template.gsub(this.pattern, function(match) { if (object == null) return ''; var before = match[1] || ''; if (before == '\\') return match[2]; var ctx = object, expr = match[3]; var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); if (match == null) return before; while (match != null) { var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; ctx = ctx[comp]; if (null == ctx || '' == match[3]) break; expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); match = pattern.exec(expr); } return before + String.interpret(ctx); }.bind(this)); } }); Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; var $break = { }; var Enumerable = { each: function(iterator, context) { var index = 0; iterator = iterator.bind(context); try { this._each(function(value) { iterator(value, index++); }); } catch (e) { if (e != $break) throw e; } return this; }, eachSlice: function(number, iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var index = -number, slices = [], array = this.toArray(); while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.collect(iterator, context); }, all: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var result = true; this.each(function(value, index) { result = result && !!iterator(value, index); if (!result) throw $break; }); return result; }, any: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var result = false; this.each(function(value, index) { if (result = !!iterator(value, index)) throw $break; }); return result; }, collect: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var results = []; this.each(function(value, index) { results.push(iterator(value, index)); }); return results; }, detect: function(iterator, context) { iterator = iterator.bind(context); var result; this.each(function(value, index) { if (iterator(value, index)) { result = value; throw $break; } }); return result; }, findAll: function(iterator, context) { iterator = iterator.bind(context); var results = []; this.each(function(value, index) { if (iterator(value, index)) results.push(value); }); return results; }, grep: function(filter, iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var results = []; if (Object.isString(filter)) filter = new RegExp(filter); this.each(function(value, index) { if (filter.match(value)) results.push(iterator(value, index)); }); return results; }, include: function(object) { if (Object.isFunction(this.indexOf)) if (this.indexOf(object) != -1) return true; var found = false; this.each(function(value) { if (value == object) { found = true; throw $break; } }); return found; }, inGroupsOf: function(number, fillWith) { fillWith = fillWith === undefined ? null : fillWith; return this.eachSlice(number, function(slice) { while(slice.length < number) slice.push(fillWith); return slice; }); }, inject: function(memo, iterator, context) { iterator = iterator.bind(context); this.each(function(value, index) { memo = iterator(memo, value, index); }); return memo; }, invoke: function(method) { var args = $A(arguments).slice(1); return this.map(function(value) { return value[method].apply(value, args); }); }, max: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var result; this.each(function(value, index) { value = iterator(value, index); if (result == undefined || value >= result) result = value; }); return result; }, min: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var result; this.each(function(value, index) { value = iterator(value, index); if (result == undefined || value < result) result = value; }); return result; }, partition: function(iterator, context) { iterator = iterator ? iterator.bind(context) : Prototype.K; var trues = [], falses = []; this.each(function(value, index) { (iterator(value, index) ? trues : falses).push(value); }); return [trues, falses]; }, pluck: function(property) { var results = []; this.each(function(value) { results.push(value[property]); }); return results; }, reject: function(iterator, context) { iterator = iterator.bind(context); var results = []; this.each(function(value, index) { if (!iterator(value, index)) results.push(value); }); return results; }, sortBy: function(iterator, context) { iterator = iterator.bind(context); return this.map(function(value, index) { return {value: value, criteria: iterator(value, index)}; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluck('value'); }, toArray: function() { return this.map(); }, zip: function() { var iterator = Prototype.K, args = $A(arguments); if (Object.isFunction(args.last())) iterator = args.pop(); var collections = [this].concat(args).map($A); return this.map(function(value, index) { return iterator(collections.pluck(index)); }); }, size: function() { return this.toArray().length; }, inspect: function() { return '#'; } }; Object.extend(Enumerable, { map: Enumerable.collect, find: Enumerable.detect, select: Enumerable.findAll, filter: Enumerable.findAll, member: Enumerable.include, entries: Enumerable.toArray, every: Enumerable.all, some: Enumerable.any }); function $A(iterable) { if (!iterable) return []; if (iterable.toArray) return iterable.toArray(); var length = iterable.length, results = new Array(length); while (length--) results[length] = iterable[length]; return results; } if (Prototype.Browser.WebKit) { function $A(iterable) { if (!iterable) return []; if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && iterable.toArray) return iterable.toArray(); var length = iterable.length, results = new Array(length); while (length--) results[length] = iterable[length]; return results; } } Array.from = $A; Object.extend(Array.prototype, Enumerable); if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }, clear: function() { this.length = 0; return this; }, first: function() { return this[0]; }, last: function() { return this[this.length - 1]; }, compact: function() { return this.select(function(value) { return value != null; }); }, flatten: function() { return this.inject([], function(array, value) { return array.concat(Object.isArray(value) ? value.flatten() : [value]); }); }, without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, reverse: function(inline) { return (inline !== false ? this : this.toArray())._reverse(); }, reduce: function() { return this.length > 1 ? this : this[0]; }, uniq: function(sorted) { return this.inject([], function(array, value, index) { if (0 == index || (sorted ? array.last() != value : !array.include(value))) array.push(value); return array; }); }, intersect: function(array) { return this.uniq().findAll(function(item) { return array.detect(function(value) { return item === value }); }); }, clone: function() { return [].concat(this); }, size: function() { return this.length; }, inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; }, toJSON: function() { var results = []; this.each(function(object) { var value = Object.toJSON(object); if (value !== undefined) results.push(value); }); return '[' + results.join(', ') + ']'; } }); // use native browser JS 1.6 implementation if available if (Object.isFunction(Array.prototype.forEach)) Array.prototype._each = Array.prototype.forEach; if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { i || (i = 0); var length = this.length; if (i < 0) i = length + i; for (; i < length; i++) if (this[i] === item) return i; return -1; }; if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; var n = this.slice(0, i).reverse().indexOf(item); return (n < 0) ? n : i - n - 1; }; Array.prototype.toArray = Array.prototype.clone; function $w(string) { if (!Object.isString(string)) return []; string = string.strip(); return string ? string.split(/\s+/) : []; } if (Prototype.Browser.Opera){ Array.prototype.concat = function() { var array = []; for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); for (var i = 0, length = arguments.length; i < length; i++) { if (Object.isArray(arguments[i])) { for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) array.push(arguments[i][j]); } else { array.push(arguments[i]); } } return array; }; } Object.extend(Number.prototype, { toColorPart: function() { return this.toPaddedString(2, 16); }, succ: function() { return this + 1; }, times: function(iterator) { $R(0, this, true).each(iterator); return this; }, toPaddedString: function(length, radix) { var string = this.toString(radix || 10); return '0'.times(length - string.length) + string; }, toJSON: function() { return isFinite(this) ? this.toString() : 'null'; } }); $w('abs round ceil floor').each(function(method){ Number.prototype[method] = Math[method].methodize(); }); function $H(object) { return new Hash(object); }; var Hash = Class.create(Enumerable, (function() { if (function() { var i = 0, Test = function(value) { this.key = value }; Test.prototype.key = 'foo'; for (var property in new Test('bar')) i++; return i > 1; }()) { function each(iterator) { var cache = []; for (var key in this._object) { var value = this._object[key]; if (cache.include(key)) continue; cache.push(key); var pair = [key, value]; pair.key = key; pair.value = value; iterator(pair); } } } else { function each(iterator) { for (var key in this._object) { var value = this._object[key], pair = [key, value]; pair.key = key; pair.value = value; iterator(pair); } } } function toQueryPair(key, value) { if (Object.isUndefined(value)) return key; return key + '=' + encodeURIComponent(String.interpret(value)); } return { initialize: function(object) { this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); }, _each: each, set: function(key, value) { return this._object[key] = value; }, get: function(key) { return this._object[key]; }, unset: function(key) { var value = this._object[key]; delete this._object[key]; return value; }, toObject: function() { return Object.clone(this._object); }, keys: function() { return this.pluck('key'); }, values: function() { return this.pluck('value'); }, index: function(value) { var match = this.detect(function(pair) { return pair.value === value; }); return match && match.key; }, merge: function(object) { return this.clone().update(object); }, update: function(object) { return new Hash(object).inject(this, function(result, pair) { result.set(pair.key, pair.value); return result; }); }, toQueryString: function() { return this.map(function(pair) { var key = encodeURIComponent(pair.key), values = pair.value; if (values && typeof values == 'object') { if (Object.isArray(values)) return values.map(toQueryPair.curry(key)).join('&'); } return toQueryPair(key, values); }).join('&'); }, inspect: function() { return '#'; }, toJSON: function() { return Object.toJSON(this.toObject()); }, clone: function() { return new Hash(this); } } })()); Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; Hash.from = $H; var ObjectRange = Class.create(Enumerable, { initialize: function(start, end, exclusive) { this.start = start; this.end = end; this.exclusive = exclusive; }, _each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); } }, include: function(value) { if (value < this.start) return false; if (this.exclusive) return value < this.end; return value <= this.end; } }); var $R = function(start, end, exclusive) { return new ObjectRange(start, end, exclusive); }; var Ajax = { getTransport: function() { return Try.these( function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, activeRequestCount: 0 }; Ajax.Responders = { responders: [], _each: function(iterator) { this.responders._each(iterator); }, register: function(responder) { if (!this.include(responder)) this.responders.push(responder); }, unregister: function(responder) { this.responders = this.responders.without(responder); }, dispatch: function(callback, request, transport, json) { this.each(function(responder) { if (Object.isFunction(responder[callback])) { try { responder[callback].apply(responder, [request, transport, json]); } catch (e) { } } }); } }; Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++ }, onComplete: function() { Ajax.activeRequestCount-- } }); Ajax.Base = Class.create({ initialize: function(options) { this.options = { method: 'post', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', parameters: '', evalJSON: true, evalJS: true }; Object.extend(this.options, options || { }); this.options.method = this.options.method.toLowerCase(); if (Object.isString(this.options.parameters)) this.options.parameters = this.options.parameters.toQueryParams(); } }); Ajax.Request = Class.create(Ajax.Base, { _complete: false, initialize: function($super, url, options) { $super(options); this.transport = Ajax.getTransport(); this.request(url); }, request: function(url) { this.url = url; this.method = this.options.method; var params = Object.clone(this.options.parameters); if (!['get', 'post'].include(this.method)) { // simulate other verbs over post params['_method'] = this.method; this.method = 'post'; } this.parameters = params; if (params = Object.toQueryString(params)) { // when GET, append parameters to URL if (this.method == 'get') this.url += (this.url.include('?') ? '&' : '?') + params; else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='; } try { var response = new Ajax.Response(this); if (this.options.onCreate) this.options.onCreate(response); Ajax.Responders.dispatch('onCreate', this, response); this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); this.transport.onreadystatechange = this.onStateChange.bind(this); this.setRequestHeaders(); this.body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(this.body); /* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange(); } catch (e) { this.dispatchException(e); } }, onStateChange: function() { var readyState = this.transport.readyState; if (readyState > 1 && !((readyState == 4) && this._complete)) this.respondToReadyState(this.transport.readyState); }, setRequestHeaders: function() { var headers = { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }; if (this.method == 'post') { headers['Content-type'] = this.options.contentType + (this.options.encoding ? '; charset=' + this.options.encoding : ''); /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect * Content-length header. See Mozilla Bugzilla #246651. */ if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close'; } // user-defined headers if (typeof this.options.requestHeaders == 'object') { var extras = this.options.requestHeaders; if (Object.isFunction(extras.push)) for (var i = 0, length = extras.length; i < length; i += 2) headers[extras[i]] = extras[i+1]; else $H(extras).each(function(pair) { headers[pair.key] = pair.value }); } for (var name in headers) this.transport.setRequestHeader(name, headers[name]); }, success: function() { var status = this.getStatus(); return !status || (status >= 200 && status < 300); }, getStatus: function() { try { return this.transport.status || 0; } catch (e) { return 0 } }, respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); if (state == 'Complete') { try { this._complete = true; (this.options['on' + response.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(response, response.headerJSON); } catch (e) { this.dispatchException(e); } var contentType = response.getHeader('Content-type'); if (this.options.evalJS == 'force' || (this.options.evalJS && contentType && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } }, getHeader: function(name) { try { return this.transport.getResponseHeader(name); } catch (e) { return null } }, evalResponse: function() { try { return eval((this.transport.responseText || '').unfilterJSON()); } catch (e) { this.dispatchException(e); } }, dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception); } }); Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Ajax.Response = Class.create({ initialize: function(request){ this.request = request; var transport = this.transport = request.transport, readyState = this.readyState = transport.readyState; if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { this.status = this.getStatus(); this.statusText = this.getStatusText(); this.responseText = String.interpret(transport.responseText); this.headerJSON = this._getHeaderJSON(); } if(readyState == 4) { var xml = transport.responseXML; this.responseXML = xml === undefined ? null : xml; this.responseJSON = this._getResponseJSON(); } }, status: 0, statusText: '', getStatus: Ajax.Request.prototype.getStatus, getStatusText: function() { try { return this.transport.statusText || ''; } catch (e) { return '' } }, getHeader: Ajax.Request.prototype.getHeader, getAllHeaders: function() { try { return this.getAllResponseHeaders(); } catch (e) { return null } }, getResponseHeader: function(name) { return this.transport.getResponseHeader(name); }, getAllResponseHeaders: function() { return this.transport.getAllResponseHeaders(); }, _getHeaderJSON: function() { var json = this.getHeader('X-JSON'); if (!json) return null; json = decodeURIComponent(escape(json)); try { return json.evalJSON(this.request.options.sanitizeJSON); } catch (e) { this.request.dispatchException(e); } }, _getResponseJSON: function() { var options = this.request.options; if (!options.evalJSON || (options.evalJSON != 'force' && !(this.getHeader('Content-type') || '').include('application/json'))) return null; try { return this.transport.responseText.evalJSON(options.sanitizeJSON); } catch (e) { this.request.dispatchException(e); } } }); Ajax.Updater = Class.create(Ajax.Request, { initialize: function($super, container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) }; options = options || { }; var onComplete = options.onComplete; options.onComplete = (function(response, param) { this.updateContent(response.responseText); if (Object.isFunction(onComplete)) onComplete(response, param); }).bind(this); $super(url, options); }, updateContent: function(responseText) { var receiver = this.container[this.success() ? 'success' : 'failure'], options = this.options; if (!options.evalScripts) responseText = responseText.stripScripts(); if (receiver = $(receiver)) { if (options.insertion) { if (Object.isString(options.insertion)) { var insertion = { }; insertion[options.insertion] = responseText; receiver.insert(insertion); } else options.insertion(receiver, responseText); } else receiver.update(responseText); } if (this.success()) { if (this.onComplete) this.onComplete.bind(this).defer(); } } }); Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { initialize: function($super, container, url, options) { $super(options); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); this.decay = (this.options.decay || 1); this.updater = { }; this.container = container; this.url = url; this.start(); }, start: function() { this.options.onComplete = this.updateComplete.bind(this); this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete = undefined; clearTimeout(this.timer); (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, updateComplete: function(response) { if (this.options.decay) { this.decay = (response.responseText == this.lastText ? this.decay * this.options.decay : 1); this.lastText = response.responseText; } this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); }, onTimerEvent: function() { this.updater = new Ajax.Updater(this.container, this.url, this.options); } }); function $(element) { if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i])); return elements; } if (Object.isString(element)) element = document.getElementById(element); return Element.extend(element); } if (Prototype.BrowserFeatures.XPath) { document._getElementsByXPath = function(expression, parentElement) { var results = []; var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(Element.extend(query.snapshotItem(i))); return results; }; } /*--------------------------------------------------------------------------*/ if (!window.Node) var Node = { }; if (!Node.ELEMENT_NODE) { // DOM level 2 ECMAScript Language Binding Object.extend(Node, { ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12 }); } (function() { var element = this.Element; this.Element = function(tagName, attributes) { attributes = attributes || { }; tagName = tagName.toLowerCase(); var cache = Element.cache; if (Prototype.Browser.IE && attributes.name) { tagName = '<' + tagName + ' name="' + attributes.name + '">'; delete attributes.name; return Element.writeAttribute(document.createElement(tagName), attributes); } if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); }; Object.extend(this.Element, element || { }); }).call(window); Element.cache = { }; Element.Methods = { visible: function(element) { return $(element).style.display != 'none'; }, toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element); return element; }, hide: function(element) { $(element).style.display = 'none'; return element; }, show: function(element) { $(element).style.display = ''; return element; }, remove: function(element) { element = $(element); element.parentNode.removeChild(element); return element; }, update: function(element, content) { element = $(element); if (content && content.toElement) content = content.toElement(); if (Object.isElement(content)) return element.update().insert(content); content = Object.toHTML(content); element.innerHTML = content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }, replace: function(element, content) { element = $(element); if (content && content.toElement) content = content.toElement(); else if (!Object.isElement(content)) { content = Object.toHTML(content); var range = element.ownerDocument.createRange(); range.selectNode(element); content.evalScripts.bind(content).defer(); content = range.createContextualFragment(content.stripScripts()); } element.parentNode.replaceChild(content, element); return element; }, insert: function(element, insertions) { element = $(element); if (Object.isString(insertions) || Object.isNumber(insertions) || Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) insertions = {bottom:insertions}; var content, t, range; for (position in insertions) { content = insertions[position]; position = position.toLowerCase(); t = Element._insertionTranslations[position]; if (content && content.toElement) content = content.toElement(); if (Object.isElement(content)) { t.insert(element, content); continue; } content = Object.toHTML(content); range = element.ownerDocument.createRange(); t.initializeRange(element, range); t.insert(element, range.createContextualFragment(content.stripScripts())); content.evalScripts.bind(content).defer(); } return element; }, wrap: function(element, wrapper, attributes) { element = $(element); if (Object.isElement(wrapper)) $(wrapper).writeAttribute(attributes || { }); else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); else wrapper = new Element('div', wrapper); if (element.parentNode) element.parentNode.replaceChild(wrapper, element); wrapper.appendChild(element); return wrapper; }, inspect: function(element) { element = $(element); var result = '<' + element.tagName.toLowerCase(); $H({'id': 'id', 'className': 'class'}).each(function(pair) { var property = pair.first(), attribute = pair.last(); var value = (element[property] || '').toString(); if (value) result += ' ' + attribute + '=' + value.inspect(true); }); return result + '>'; }, recursivelyCollect: function(element, property) { element = $(element); var elements = []; while (element = element[property]) if (element.nodeType == 1) elements.push(Element.extend(element)); return elements; }, ancestors: function(element) { return $(element).recursivelyCollect('parentNode'); }, descendants: function(element) { return $A($(element).getElementsByTagName('*')).each(Element.extend); }, firstDescendant: function(element) { element = $(element).firstChild; while (element && element.nodeType != 1) element = element.nextSibling; return $(element); }, immediateDescendants: function(element) { if (!(element = $(element).firstChild)) return []; while (element && element.nodeType != 1) element = element.nextSibling; if (element) return [element].concat($(element).nextSiblings()); return []; }, previousSiblings: function(element) { return $(element).recursivelyCollect('previousSibling'); }, nextSiblings: function(element) { return $(element).recursivelyCollect('nextSibling'); }, siblings: function(element) { element = $(element); return element.previousSiblings().reverse().concat(element.nextSiblings()); }, match: function(element, selector) { if (Object.isString(selector)) selector = new Selector(selector); return selector.match($(element)); }, up: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(element.parentNode); var ancestors = element.ancestors(); return expression ? Selector.findElement(ancestors, expression, index) : ancestors[index || 0]; }, down: function(element, expression, index) { element = $(element); if (arguments.length == 1) return element.firstDescendant(); var descendants = element.descendants(); return expression ? Selector.findElement(descendants, expression, index) : descendants[index || 0]; }, previous: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); var previousSiblings = element.previousSiblings(); return expression ? Selector.findElement(previousSiblings, expression, index) : previousSiblings[index || 0]; }, next: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); var nextSiblings = element.nextSiblings(); return expression ? Selector.findElement(nextSiblings, expression, index) : nextSiblings[index || 0]; }, select: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args); }, adjacent: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element.parentNode, args).without(element); }, identify: function(element) { element = $(element); var id = element.readAttribute('id'), self = arguments.callee; if (id) return id; do { id = 'anonymous_element_' + self.counter++ } while ($(id)); element.writeAttribute('id', id); return id; }, readAttribute: function(element, name) { element = $(element); if (Prototype.Browser.IE) { var t = Element._attributeTranslations.read; if (t.values[name]) return t.values[name](element, name); if (t.names[name]) name = t.names[name]; if (name.include(':')) { return (!element.attributes || !element.attributes[name]) ? null : element.attributes[name].value; } } return element.getAttribute(name); }, writeAttribute: function(element, name, value) { element = $(element); var attributes = { }, t = Element._attributeTranslations.write; if (typeof name == 'object') attributes = name; else attributes[name] = value === undefined ? true : value; for (var attr in attributes) { var name = t.names[attr] || attr, value = attributes[attr]; if (t.values[attr]) name = t.values[attr](element, value); if (value === false || value === null) element.removeAttribute(name); else if (value === true) element.setAttribute(name, name); else element.setAttribute(name, value); } return element; }, getHeight: function(element) { return $(element).getDimensions().height; }, getWidth: function(element) { return $(element).getDimensions().width; }, classNames: function(element) { return new Element.ClassNames(element); }, hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); }, addClassName: function(element, className) { if (!(element = $(element))) return; if (!element.hasClassName(className)) element.className += (element.className ? ' ' : '') + className; return element; }, removeClassName: function(element, className) { if (!(element = $(element))) return; element.className = element.className.replace( new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); return element; }, toggleClassName: function(element, className) { if (!(element = $(element))) return; return element[element.hasClassName(className) ? 'removeClassName' : 'addClassName'](className); }, // removes whitespace-only text node children cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, empty: function(element) { return $(element).innerHTML.blank(); }, descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor); if (element.compareDocumentPosition) return (element.compareDocumentPosition(ancestor) & 8) === 8; if (element.sourceIndex && !Prototype.Browser.Opera) { var e = element.sourceIndex, a = ancestor.sourceIndex, nextAncestor = ancestor.nextSibling; if (!nextAncestor) { do { ancestor = ancestor.parentNode; } while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); } if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); } while (element = element.parentNode) if (element == ancestor) return true; return false; }, scrollTo: function(element) { element = $(element); var pos = element.cumulativeOffset(); window.scrollTo(pos[0], pos[1]); return element; }, getStyle: function(element, style) { element = $(element); style = style == 'float' ? 'cssFloat' : style.camelize(); var value = element.style[style]; if (!value) { var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; } if (style == 'opacity') return value ? parseFloat(value) : 1.0; return value == 'auto' ? null : value; }, getOpacity: function(element) { return $(element).getStyle('opacity'); }, setStyle: function(element, styles) { element = $(element); var elementStyle = element.style, match; if (Object.isString(styles)) { element.style.cssText += ';' + styles; return styles.include('opacity') ? element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; } for (var property in styles) if (property == 'opacity') element.setOpacity(styles[property]); else elementStyle[(property == 'float' || property == 'cssFloat') ? (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') : property] = styles[property]; return element; }, setOpacity: function(element, value) { element = $(element); element.style.opacity = (value == 1 || value === '') ? '' : (value < 0.00001) ? 0 : value; return element; }, getDimensions: function(element) { element = $(element); var display = $(element).getStyle('display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; var originalDisplay = els.display; els.visibility = 'hidden'; els.position = 'absolute'; els.display = 'block'; var originalWidth = element.clientWidth; var originalHeight = element.clientHeight; els.display = originalDisplay; els.position = originalPosition; els.visibility = originalVisibility; return {width: originalWidth, height: originalHeight}; }, makePositioned: function(element) { element = $(element); var pos = Element.getStyle(element, 'position'); if (pos == 'static' || !pos) { element._madePositioned = true; element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined if (window.opera) { element.style.top = 0; element.style.left = 0; } } return element; }, undoPositioned: function(element) { element = $(element); if (element._madePositioned) { element._madePositioned = undefined; element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = ''; } return element; }, makeClipping: function(element) { element = $(element); if (element._overflow) return element; element._overflow = Element.getStyle(element, 'overflow') || 'auto'; if (element._overflow !== 'hidden') element.style.overflow = 'hidden'; return element; }, undoClipping: function(element) { element = $(element); if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null; return element; }, cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return Element._returnOffset(valueL, valueT); }, positionedOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { if (element.tagName == 'BODY') break; var p = Element.getStyle(element, 'position'); if (p == 'relative' || p == 'absolute') break; } } while (element); return Element._returnOffset(valueL, valueT); }, absolutize: function(element) { element = $(element); if (element.getStyle('position') == 'absolute') return; // Position.prepare(); // To be done manually by Scripty when it needs it. var offsets = element.positionedOffset(); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.width = width + 'px'; element.style.height = height + 'px'; return element; }, relativize: function(element) { element = $(element); if (element.getStyle('position') == 'relative') return; // Position.prepare(); // To be done manually by Scripty when it needs it. element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.height = element._originalHeight; element.style.width = element._originalWidth; return element; }, cumulativeScrollOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.scrollTop || 0; valueL += element.scrollLeft || 0; element = element.parentNode; } while (element); return Element._returnOffset(valueL, valueT); }, getOffsetParent: function(element) { if (element.offsetParent) return $(element.offsetParent); if (element == document.body) return $(element); while ((element = element.parentNode) && element != document.body) if (Element.getStyle(element, 'position') != 'static') return $(element); return $(document.body); }, viewportOffset: function(forElement) { var valueT = 0, valueL = 0; var element = forElement; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; // Safari fix if (element.offsetParent == document.body && Element.getStyle(element, 'position') == 'absolute') break; } while (element = element.offsetParent); element = forElement; do { if (!Prototype.Browser.Opera || element.tagName == 'BODY') { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; } } while (element = element.parentNode); return Element._returnOffset(valueL, valueT); }, clonePosition: function(element, source) { var options = Object.extend({ setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetTop: 0, offsetLeft: 0 }, arguments[2] || { }); // find page position of source source = $(source); var p = source.viewportOffset(); // find coordinate system to use element = $(element); var delta = [0, 0]; var parent = null; // delta [0,0] will do fine with position: fixed elements, // position:absolute needs offsetParent deltas if (Element.getStyle(element, 'position') == 'absolute') { parent = element.getOffsetParent(); delta = parent.viewportOffset(); } // correct by body offsets (fixes Safari) if (parent == document.body) { delta[0] -= document.body.offsetLeft; delta[1] -= document.body.offsetTop; } // set position if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; if (options.setWidth) element.style.width = source.offsetWidth + 'px'; if (options.setHeight) element.style.height = source.offsetHeight + 'px'; return element; } }; Element.Methods.identify.counter = 1; Object.extend(Element.Methods, { getElementsBySelector: Element.Methods.select, childElements: Element.Methods.immediateDescendants }); Element._attributeTranslations = { write: { names: { className: 'class', htmlFor: 'for' }, values: { } } }; if (!document.createRange || Prototype.Browser.Opera) { Element.Methods.insert = function(element, insertions) { element = $(element); if (Object.isString(insertions) || Object.isNumber(insertions) || Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) insertions = { bottom: insertions }; var t = Element._insertionTranslations, content, position, pos, tagName; for (position in insertions) { content = insertions[position]; position = position.toLowerCase(); pos = t[position]; if (content && content.toElement) content = content.toElement(); if (Object.isElement(content)) { pos.insert(element, content); continue; } content = Object.toHTML(content); tagName = ((position == 'before' || position == 'after') ? element.parentNode : element).tagName.toUpperCase(); if (t.tags[tagName]) { var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); if (position == 'top' || position == 'after') fragments.reverse(); fragments.each(pos.insert.curry(element)); } else element.insertAdjacentHTML(pos.adjacency, content.stripScripts()); content.evalScripts.bind(content).defer(); } return element; }; } if (Prototype.Browser.Opera) { Element.Methods._getStyle = Element.Methods.getStyle; Element.Methods.getStyle = function(element, style) { switch(style) { case 'left': case 'top': case 'right': case 'bottom': if (Element._getStyle(element, 'position') == 'static') return null; default: return Element._getStyle(element, style); } }; Element.Methods._readAttribute = Element.Methods.readAttribute; Element.Methods.readAttribute = function(element, attribute) { if (attribute == 'title') return element.title; return Element._readAttribute(element, attribute); }; } else if (Prototype.Browser.IE) { $w('positionedOffset getOffsetParent viewportOffset').each(function(method) { Element.Methods[method] = Element.Methods[method].wrap( function(proceed, element) { element = $(element); var position = element.getStyle('position'); if (position != 'static') return proceed(element); element.setStyle({ position: 'relative' }); var value = proceed(element); element.setStyle({ position: position }); return value; } ); }); Element.Methods.getStyle = function(element, style) { element = $(element); style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); var value = element.style[style]; if (!value && element.currentStyle) value = element.currentStyle[style]; if (style == 'opacity') { if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) if (value[1]) return parseFloat(value[1]) / 100; return 1.0; } if (value == 'auto') { if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) return element['offset' + style.capitalize()] + 'px'; return null; } return value; }; Element.Methods.setOpacity = function(element, value) { function stripAlpha(filter){ return filter.replace(/alpha\([^\)]*\)/gi,''); } element = $(element); var currentStyle = element.currentStyle; if ((currentStyle && !currentStyle.hasLayout) || (!currentStyle && element.style.zoom == 'normal')) element.style.zoom = 1; var filter = element.getStyle('filter'), style = element.style; if (value == 1 || value === '') { (filter = stripAlpha(filter)) ? style.filter = filter : style.removeAttribute('filter'); return element; } else if (value < 0.00001) value = 0; style.filter = stripAlpha(filter) + 'alpha(opacity=' + (value * 100) + ')'; return element; }; Element._attributeTranslations = { read: { names: { 'class': 'className', 'for': 'htmlFor' }, values: { _getAttr: function(element, attribute) { return element.getAttribute(attribute, 2); }, _getAttrNode: function(element, attribute) { var node = element.getAttributeNode(attribute); return node ? node.value : ""; }, _getEv: function(element, attribute) { var attribute = element.getAttribute(attribute); return attribute ? attribute.toString().slice(23, -2) : null; }, _flag: function(element, attribute) { return $(element).hasAttribute(attribute) ? attribute : null; }, style: function(element) { return element.style.cssText.toLowerCase(); }, title: function(element) { return element.title; } } } }; Element._attributeTranslations.write = { names: Object.clone(Element._attributeTranslations.read.names), values: { checked: function(element, value) { element.checked = !!value; }, style: function(element, value) { element.style.cssText = value ? value : ''; } } }; Element._attributeTranslations.has = {}; $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + 'encType maxLength readOnly longDesc').each(function(attr) { Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; Element._attributeTranslations.has[attr.toLowerCase()] = attr; }); (function(v) { Object.extend(v, { href: v._getAttr, src: v._getAttr, type: v._getAttr, action: v._getAttrNode, disabled: v._flag, checked: v._flag, readonly: v._flag, multiple: v._flag, onload: v._getEv, onunload: v._getEv, onclick: v._getEv, ondblclick: v._getEv, onmousedown: v._getEv, onmouseup: v._getEv, onmouseover: v._getEv, onmousemove: v._getEv, onmouseout: v._getEv, onfocus: v._getEv, onblur: v._getEv, onkeypress: v._getEv, onkeydown: v._getEv, onkeyup: v._getEv, onsubmit: v._getEv, onreset: v._getEv, onselect: v._getEv, onchange: v._getEv }); })(Element._attributeTranslations.read.values); } else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { Element.Methods.setOpacity = function(element, value) { element = $(element); element.style.opacity = (value == 1) ? 0.999999 : (value === '') ? '' : (value < 0.00001) ? 0 : value; return element; }; } else if (Prototype.Browser.WebKit) { Element.Methods.setOpacity = function(element, value) { element = $(element); element.style.opacity = (value == 1 || value === '') ? '' : (value < 0.00001) ? 0 : value; if (value == 1) if(element.tagName == 'IMG' && element.width) { element.width++; element.width--; } else try { var n = document.createTextNode(' '); element.appendChild(n); element.removeChild(n); } catch (e) { } return element; }; // Safari returns margins on body which is incorrect if the child is absolutely // positioned. For performance reasons, redefine Position.cumulativeOffset for // KHTML/WebKit only. Element.Methods.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; if (element.offsetParent == document.body) if (Element.getStyle(element, 'position') == 'absolute') break; element = element.offsetParent; } while (element); return Element._returnOffset(valueL, valueT); }; } if (Prototype.Browser.IE || Prototype.Browser.Opera) { // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements Element.Methods.update = function(element, content) { element = $(element); if (content && content.toElement) content = content.toElement(); if (Object.isElement(content)) return element.update().insert(content); content = Object.toHTML(content); var tagName = element.tagName.toUpperCase(); if (tagName in Element._insertionTranslations.tags) { $A(element.childNodes).each(function(node) { element.removeChild(node) }); Element._getContentFromAnonymousElement(tagName, content.stripScripts()) .each(function(node) { element.appendChild(node) }); } else element.innerHTML = content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }; } if (document.createElement('div').outerHTML) { Element.Methods.replace = function(element, content) { element = $(element); if (content && content.toElement) content = content.toElement(); if (Object.isElement(content)) { element.parentNode.replaceChild(content, element); return element; } content = Object.toHTML(content); var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); if (Element._insertionTranslations.tags[tagName]) { var nextSibling = element.next(); var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); parent.removeChild(element); if (nextSibling) fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); else fragments.each(function(node) { parent.appendChild(node) }); } else element.outerHTML = content.stripScripts(); content.evalScripts.bind(content).defer(); return element; }; } Element._returnOffset = function(l, t) { var result = [l, t]; result.left = l; result.top = t; return result; }; Element._getContentFromAnonymousElement = function(tagName, html) { var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; div.innerHTML = t[0] + html + t[1]; t[2].times(function() { div = div.firstChild }); return $A(div.childNodes); }; Element._insertionTranslations = { before: { adjacency: 'beforeBegin', insert: function(element, node) { element.parentNode.insertBefore(node, element); }, initializeRange: function(element, range) { range.setStartBefore(element); } }, top: { adjacency: 'afterBegin', insert: function(element, node) { element.insertBefore(node, element.firstChild); }, initializeRange: function(element, range) { range.selectNodeContents(element); range.collapse(true); } }, bottom: { adjacency: 'beforeEnd', insert: function(element, node) { element.appendChild(node); } }, after: { adjacency: 'afterEnd', insert: function(element, node) { element.parentNode.insertBefore(node, element.nextSibling); }, initializeRange: function(element, range) { range.setStartAfter(element); } }, tags: { TABLE: ['', '
    ', 1], TBODY: ['', '
    ', 2], TR: ['', '
    ', 3], TD: ['
    ', '
    ', 4], SELECT: ['', 1] } }; (function() { this.bottom.initializeRange = this.top.initializeRange; Object.extend(this.tags, { THEAD: this.tags.TBODY, TFOOT: this.tags.TBODY, TH: this.tags.TD }); }).call(Element._insertionTranslations); Element.Methods.Simulated = { hasAttribute: function(element, attribute) { attribute = Element._attributeTranslations.has[attribute] || attribute; var node = $(element).getAttributeNode(attribute); return node && node.specified; } }; Element.Methods.ByTag = { }; Object.extend(Element, Element.Methods); if (!Prototype.BrowserFeatures.ElementExtensions && document.createElement('div').__proto__) { window.HTMLElement = { }; window.HTMLElement.prototype = document.createElement('div').__proto__; Prototype.BrowserFeatures.ElementExtensions = true; } Element.extend = (function() { if (Prototype.BrowserFeatures.SpecificElementExtensions) return Prototype.K; var Methods = { }, ByTag = Element.Methods.ByTag; var extend = Object.extend(function(element) { if (!element || element._extendedByPrototype || element.nodeType != 1 || element == window) return element; var methods = Object.clone(Methods), tagName = element.tagName, property, value; // extend methods for specific tags if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); for (property in methods) { value = methods[property]; if (Object.isFunction(value) && !(property in element)) element[property] = value.methodize(); } element._extendedByPrototype = Prototype.emptyFunction; return element; }, { refresh: function() { // extend methods for all tags (Safari doesn't need this) if (!Prototype.BrowserFeatures.ElementExtensions) { Object.extend(Methods, Element.Methods); Object.extend(Methods, Element.Methods.Simulated); } } }); extend.refresh(); return extend; })(); Element.hasAttribute = function(element, attribute) { if (element.hasAttribute) return element.hasAttribute(attribute); return Element.Methods.Simulated.hasAttribute(element, attribute); }; Element.addMethods = function(methods) { var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; if (!methods) { Object.extend(Form, Form.Methods); Object.extend(Form.Element, Form.Element.Methods); Object.extend(Element.Methods.ByTag, { "FORM": Object.clone(Form.Methods), "INPUT": Object.clone(Form.Element.Methods), "SELECT": Object.clone(Form.Element.Methods), "TEXTAREA": Object.clone(Form.Element.Methods) }); } if (arguments.length == 2) { var tagName = methods; methods = arguments[1]; } if (!tagName) Object.extend(Element.Methods, methods || { }); else { if (Object.isArray(tagName)) tagName.each(extend); else extend(tagName); } function extend(tagName) { tagName = tagName.toUpperCase(); if (!Element.Methods.ByTag[tagName]) Element.Methods.ByTag[tagName] = { }; Object.extend(Element.Methods.ByTag[tagName], methods); } function copy(methods, destination, onlyIfAbsent) { onlyIfAbsent = onlyIfAbsent || false; for (var property in methods) { var value = methods[property]; if (!Object.isFunction(value)) continue; if (!onlyIfAbsent || !(property in destination)) destination[property] = value.methodize(); } } function findDOMClass(tagName) { var klass; var trans = { "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": "FrameSet", "IFRAME": "IFrame" }; if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; if (window[klass]) return window[klass]; klass = 'HTML' + tagName + 'Element'; if (window[klass]) return window[klass]; klass = 'HTML' + tagName.capitalize() + 'Element'; if (window[klass]) return window[klass]; window[klass] = { }; window[klass].prototype = document.createElement(tagName).__proto__; return window[klass]; } if (F.ElementExtensions) { copy(Element.Methods, HTMLElement.prototype); copy(Element.Methods.Simulated, HTMLElement.prototype, true); } if (F.SpecificElementExtensions) { for (var tag in Element.Methods.ByTag) { var klass = findDOMClass(tag); if (Object.isUndefined(klass)) continue; copy(T[tag], klass.prototype); } } Object.extend(Element, Element.Methods); delete Element.ByTag; if (Element.extend.refresh) Element.extend.refresh(); Element.cache = { }; }; document.viewport = { getDimensions: function() { var dimensions = { }; $w('width height').each(function(d) { var D = d.capitalize(); dimensions[d] = self['inner' + D] || (document.documentElement['client' + D] || document.body['client' + D]); }); return dimensions; }, getWidth: function() { return this.getDimensions().width; }, getHeight: function() { return this.getDimensions().height; }, getScrollOffsets: function() { return Element._returnOffset( window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); } }; /* Portions of the Selector class are derived from Jack Slocum’s DomQuery, * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style * license. Please see http://www.yui-ext.com/ for more information. */ var Selector = Class.create({ initialize: function(expression) { this.expression = expression.strip(); this.compileMatcher(); }, compileMatcher: function() { // Selectors with namespaced attributes can't use the XPath version if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression)) return this.compileXPathMatcher(); var e = this.expression, ps = Selector.patterns, h = Selector.handlers, c = Selector.criteria, le, p, m; if (Selector._cache[e]) { this.matcher = Selector._cache[e]; return; } this.matcher = ["this.matcher = function(root) {", "var r = root, h = Selector.handlers, c = false, n;"]; while (e && le != e && (/\S/).test(e)) { le = e; for (var i in ps) { p = ps[i]; if (m = e.match(p)) { this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : new Template(c[i]).evaluate(m)); e = e.replace(m[0], ''); break; } } } this.matcher.push("return h.unique(n);\n}"); eval(this.matcher.join('\n')); Selector._cache[this.expression] = this.matcher; }, compileXPathMatcher: function() { var e = this.expression, ps = Selector.patterns, x = Selector.xpath, le, m; if (Selector._cache[e]) { this.xpath = Selector._cache[e]; return; } this.matcher = ['.//*']; while (e && le != e && (/\S/).test(e)) { le = e; for (var i in ps) { if (m = e.match(ps[i])) { this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m)); e = e.replace(m[0], ''); break; } } } this.xpath = this.matcher.join(''); Selector._cache[this.expression] = this.xpath; }, findElements: function(root) { root = root || document; if (this.xpath) return document._getElementsByXPath(this.xpath, root); return this.matcher(root); }, match: function(element) { this.tokens = []; var e = this.expression, ps = Selector.patterns, as = Selector.assertions; var le, p, m; while (e && le !== e && (/\S/).test(e)) { le = e; for (var i in ps) { p = ps[i]; if (m = e.match(p)) { // use the Selector.assertions methods unless the selector // is too complex. if (as[i]) { this.tokens.push([i, Object.clone(m)]); e = e.replace(m[0], ''); } else { // reluctantly do a document-wide search // and look for a match in the array return this.findElements(document).include(element); } } } } var match = true, name, matches; for (var i = 0, token; token = this.tokens[i]; i++) { name = token[0], matches = token[1]; if (!Selector.assertions[name](element, matches)) { match = false; break; } } return match; }, toString: function() { return this.expression; }, inspect: function() { return "#"; } }); Object.extend(Selector, { _cache: { }, xpath: { descendant: "//*", child: "/*", adjacent: "/following-sibling::*[1]", laterSibling: '/following-sibling::*', tagName: function(m) { if (m[1] == '*') return ''; return "[local-name()='" + m[1].toLowerCase() + "' or local-name()='" + m[1].toUpperCase() + "']"; }, className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", id: "[@id='#{1}']", attrPresence: "[@#{1}]", attr: function(m) { m[3] = m[5] || m[6]; return new Template(Selector.xpath.operators[m[2]]).evaluate(m); }, pseudo: function(m) { var h = Selector.xpath.pseudos[m[1]]; if (!h) return ''; if (Object.isFunction(h)) return h(m); return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); }, operators: { '=': "[@#{1}='#{3}']", '!=': "[@#{1}!='#{3}']", '^=': "[starts-with(@#{1}, '#{3}')]", '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", '*=': "[contains(@#{1}, '#{3}')]", '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" }, pseudos: { 'first-child': '[not(preceding-sibling::*)]', 'last-child': '[not(following-sibling::*)]', 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]", 'checked': "[@checked]", 'disabled': "[@disabled]", 'enabled': "[not(@disabled)]", 'not': function(m) { var e = m[6], p = Selector.patterns, x = Selector.xpath, le, m, v; var exclusion = []; while (e && le != e && (/\S/).test(e)) { le = e; for (var i in p) { if (m = e.match(p[i])) { v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); exclusion.push("(" + v.substring(1, v.length - 1) + ")"); e = e.replace(m[0], ''); break; } } } return "[not(" + exclusion.join(" and ") + ")]"; }, 'nth-child': function(m) { return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); }, 'nth-last-child': function(m) { return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); }, 'nth-of-type': function(m) { return Selector.xpath.pseudos.nth("position() ", m); }, 'nth-last-of-type': function(m) { return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); }, 'first-of-type': function(m) { m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); }, 'last-of-type': function(m) { m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); }, 'only-of-type': function(m) { var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); }, nth: function(fragment, m) { var mm, formula = m[6], predicate; if (formula == 'even') formula = '2n+0'; if (formula == 'odd') formula = '2n+1'; if (mm = formula.match(/^(\d+)$/)) // digit only return '[' + fragment + "= " + mm[1] + ']'; if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b if (mm[1] == "-") mm[1] = -1; var a = mm[1] ? Number(mm[1]) : 1; var b = mm[2] ? Number(mm[2]) : 0; predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + "((#{fragment} - #{b}) div #{a} >= 0)]"; return new Template(predicate).evaluate({ fragment: fragment, a: a, b: b }); } } } }, criteria: { tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', className: 'n = h.className(n, r, "#{1}", c); c = false;', id: 'n = h.id(n, r, "#{1}", c); c = false;', attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', attr: function(m) { m[3] = (m[5] || m[6]); return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); }, pseudo: function(m) { if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); }, descendant: 'c = "descendant";', child: 'c = "child";', adjacent: 'c = "adjacent";', laterSibling: 'c = "laterSibling";' }, patterns: { // combinators must be listed first // (and descendant needs to be last combinator) laterSibling: /^\s*~\s*/, child: /^\s*>\s*/, adjacent: /^\s*\+\s*/, descendant: /^\s/, // selectors follow tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, id: /^#([\w\-\*]+)(\b|$)/, className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/, attrPresence: /^\[([\w]+)\]/, attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }, // for Selector.match and Element#match assertions: { tagName: function(element, matches) { return matches[1].toUpperCase() == element.tagName.toUpperCase(); }, className: function(element, matches) { return Element.hasClassName(element, matches[1]); }, id: function(element, matches) { return element.id === matches[1]; }, attrPresence: function(element, matches) { return Element.hasAttribute(element, matches[1]); }, attr: function(element, matches) { var nodeValue = Element.readAttribute(element, matches[1]); return Selector.operators[matches[2]](nodeValue, matches[3]); } }, handlers: { // UTILITY FUNCTIONS // joins two collections concat: function(a, b) { for (var i = 0, node; node = b[i]; i++) a.push(node); return a; }, // marks an array of nodes for counting mark: function(nodes) { for (var i = 0, node; node = nodes[i]; i++) node._counted = true; return nodes; }, unmark: function(nodes) { for (var i = 0, node; node = nodes[i]; i++) node._counted = undefined; return nodes; }, // mark each child node with its position (for nth calls) // "ofType" flag indicates whether we're indexing for nth-of-type // rather than nth-child index: function(parentNode, reverse, ofType) { parentNode._counted = true; if (reverse) { for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { var node = nodes[i]; if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; } } else { for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; } }, // filters out duplicates and extends all nodes unique: function(nodes) { if (nodes.length == 0) return nodes; var results = [], n; for (var i = 0, l = nodes.length; i < l; i++) if (!(n = nodes[i])._counted) { n._counted = true; results.push(Element.extend(n)); } return Selector.handlers.unmark(results); }, // COMBINATOR FUNCTIONS descendant: function(nodes) { var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) h.concat(results, node.getElementsByTagName('*')); return results; }, child: function(nodes) { var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) { for (var j = 0, children = [], child; child = node.childNodes[j]; j++) if (child.nodeType == 1 && child.tagName != '!') results.push(child); } return results; }, adjacent: function(nodes) { for (var i = 0, results = [], node; node = nodes[i]; i++) { var next = this.nextElementSibling(node); if (next) results.push(next); } return results; }, laterSibling: function(nodes) { var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) h.concat(results, Element.nextSiblings(node)); return results; }, nextElementSibling: function(node) { while (node = node.nextSibling) if (node.nodeType == 1) return node; return null; }, previousElementSibling: function(node) { while (node = node.previousSibling) if (node.nodeType == 1) return node; return null; }, // TOKEN FUNCTIONS tagName: function(nodes, root, tagName, combinator) { tagName = tagName.toUpperCase(); var results = [], h = Selector.handlers; if (nodes) { if (combinator) { // fastlane for ordinary descendant combinators if (combinator == "descendant") { for (var i = 0, node; node = nodes[i]; i++) h.concat(results, node.getElementsByTagName(tagName)); return results; } else nodes = this[combinator](nodes); if (tagName == "*") return nodes; } for (var i = 0, node; node = nodes[i]; i++) if (node.tagName.toUpperCase() == tagName) results.push(node); return results; } else return root.getElementsByTagName(tagName); }, id: function(nodes, root, id, combinator) { var targetNode = $(id), h = Selector.handlers; if (!targetNode) return []; if (!nodes && root == document) return [targetNode]; if (nodes) { if (combinator) { if (combinator == 'child') { for (var i = 0, node; node = nodes[i]; i++) if (targetNode.parentNode == node) return [targetNode]; } else if (combinator == 'descendant') { for (var i = 0, node; node = nodes[i]; i++) if (Element.descendantOf(targetNode, node)) return [targetNode]; } else if (combinator == 'adjacent') { for (var i = 0, node; node = nodes[i]; i++) if (Selector.handlers.previousElementSibling(targetNode) == node) return [targetNode]; } else nodes = h[combinator](nodes); } for (var i = 0, node; node = nodes[i]; i++) if (node == targetNode) return [targetNode]; return []; } return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; }, className: function(nodes, root, className, combinator) { if (nodes && combinator) nodes = this[combinator](nodes); return Selector.handlers.byClassName(nodes, root, className); }, byClassName: function(nodes, root, className) { if (!nodes) nodes = Selector.handlers.descendant([root]); var needle = ' ' + className + ' '; for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { nodeClassName = node.className; if (nodeClassName.length == 0) continue; if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) results.push(node); } return results; }, attrPresence: function(nodes, root, attr) { if (!nodes) nodes = root.getElementsByTagName("*"); var results = []; for (var i = 0, node; node = nodes[i]; i++) if (Element.hasAttribute(node, attr)) results.push(node); return results; }, attr: function(nodes, root, attr, value, operator) { if (!nodes) nodes = root.getElementsByTagName("*"); var handler = Selector.operators[operator], results = []; for (var i = 0, node; node = nodes[i]; i++) { var nodeValue = Element.readAttribute(node, attr); if (nodeValue === null) continue; if (handler(nodeValue, value)) results.push(node); } return results; }, pseudo: function(nodes, name, value, root, combinator) { if (nodes && combinator) nodes = this[combinator](nodes); if (!nodes) nodes = root.getElementsByTagName("*"); return Selector.pseudos[name](nodes, value, root); } }, pseudos: { 'first-child': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { if (Selector.handlers.previousElementSibling(node)) continue; results.push(node); } return results; }, 'last-child': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { if (Selector.handlers.nextElementSibling(node)) continue; results.push(node); } return results; }, 'only-child': function(nodes, value, root) { var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) results.push(node); return results; }, 'nth-child': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root); }, 'nth-last-child': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, true); }, 'nth-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, false, true); }, 'nth-last-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, formula, root, true, true); }, 'first-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, "1", root, false, true); }, 'last-of-type': function(nodes, formula, root) { return Selector.pseudos.nth(nodes, "1", root, true, true); }, 'only-of-type': function(nodes, formula, root) { var p = Selector.pseudos; return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); }, // handles the an+b logic getIndices: function(a, b, total) { if (a == 0) return b > 0 ? [b] : []; return $R(1, total).inject([], function(memo, i) { if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); return memo; }); }, // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type nth: function(nodes, formula, root, reverse, ofType) { if (nodes.length == 0) return []; if (formula == 'even') formula = '2n+0'; if (formula == 'odd') formula = '2n+1'; var h = Selector.handlers, results = [], indexed = [], m; h.mark(nodes); for (var i = 0, node; node = nodes[i]; i++) { if (!node.parentNode._counted) { h.index(node.parentNode, reverse, ofType); indexed.push(node.parentNode); } } if (formula.match(/^\d+$/)) { // just a number formula = Number(formula); for (var i = 0, node; node = nodes[i]; i++) if (node.nodeIndex == formula) results.push(node); } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b if (m[1] == "-") m[1] = -1; var a = m[1] ? Number(m[1]) : 1; var b = m[2] ? Number(m[2]) : 0; var indices = Selector.pseudos.getIndices(a, b, nodes.length); for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { for (var j = 0; j < l; j++) if (node.nodeIndex == indices[j]) results.push(node); } } h.unmark(nodes); h.unmark(indexed); return results; }, 'empty': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { // IE treats comments as element nodes if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue; results.push(node); } return results; }, 'not': function(nodes, selector, root) { var h = Selector.handlers, selectorType, m; var exclusions = new Selector(selector).findElements(root); h.mark(exclusions); for (var i = 0, results = [], node; node = nodes[i]; i++) if (!node._counted) results.push(node); h.unmark(exclusions); return results; }, 'enabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (!node.disabled) results.push(node); return results; }, 'disabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (node.disabled) results.push(node); return results; }, 'checked': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (node.checked) results.push(node); return results; } }, operators: { '=': function(nv, v) { return nv == v; }, '!=': function(nv, v) { return nv != v; }, '^=': function(nv, v) { return nv.startsWith(v); }, '$=': function(nv, v) { return nv.endsWith(v); }, '*=': function(nv, v) { return nv.include(v); }, '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } }, matchElements: function(elements, expression) { var matches = new Selector(expression).findElements(), h = Selector.handlers; h.mark(matches); for (var i = 0, results = [], element; element = elements[i]; i++) if (element._counted) results.push(element); h.unmark(matches); return results; }, findElement: function(elements, expression, index) { if (Object.isNumber(expression)) { index = expression; expression = false; } return Selector.matchElements(elements, expression || '*')[index || 0]; }, findChildElements: function(element, expressions) { var exprs = expressions.join(','), expressions = []; exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { expressions.push(m[1].strip()); }); var results = [], h = Selector.handlers; for (var i = 0, l = expressions.length, selector; i < l; i++) { selector = new Selector(expressions[i].strip()); h.concat(results, selector.findElements(element)); } return (l > 1) ? h.unique(results) : results; } }); function $$() { return Selector.findChildElements(document, $A(arguments)); } var Form = { reset: function(form) { $(form).reset(); return form; }, serializeElements: function(elements, options) { if (typeof options != 'object') options = { hash: !!options }; else if (options.hash === undefined) options.hash = true; var key, value, submitted = false, submit = options.submit; var data = elements.inject({ }, function(result, element) { if (!element.disabled && element.name) { key = element.name; value = $(element).getValue(); if (value != null && (element.type != 'submit' || (!submitted && submit !== false && (!submit || key == submit) && (submitted = true)))) { if (key in result) { // a key is already present; construct an array of values if (!Object.isArray(result[key])) result[key] = [result[key]]; result[key].push(value); } else result[key] = value; } } return result; }); return options.hash ? data : Object.toQueryString(data); } }; Form.Methods = { serialize: function(form, options) { return Form.serializeElements(Form.getElements(form), options); }, getElements: function(form) { return $A($(form).getElementsByTagName('*')).inject([], function(elements, child) { if (Form.Element.Serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child)); return elements; } ); }, getInputs: function(form, typeName, name) { form = $(form); var inputs = form.getElementsByTagName('input'); if (!typeName && !name) return $A(inputs).map(Element.extend); for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { var input = inputs[i]; if ((typeName && input.type != typeName) || (name && input.name != name)) continue; matchingInputs.push(Element.extend(input)); } return matchingInputs; }, disable: function(form) { form = $(form); Form.getElements(form).invoke('disable'); return form; }, enable: function(form) { form = $(form); Form.getElements(form).invoke('enable'); return form; }, findFirstElement: function(form) { var elements = $(form).getElements().findAll(function(element) { return 'hidden' != element.type && !element.disabled; }); var firstByIndex = elements.findAll(function(element) { return element.hasAttribute('tabIndex') && element.tabIndex >= 0; }).sortBy(function(element) { return element.tabIndex }).first(); return firstByIndex ? firstByIndex : elements.find(function(element) { return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); }); }, focusFirstElement: function(form) { form = $(form); form.findFirstElement().activate(); return form; }, request: function(form, options) { form = $(form), options = Object.clone(options || { }); var params = options.parameters, action = form.readAttribute('action') || ''; if (action.blank()) action = window.location.href; options.parameters = form.serialize(true); if (params) { if (Object.isString(params)) params = params.toQueryParams(); Object.extend(options.parameters, params); } if (form.hasAttribute('method') && !options.method) options.method = form.method; return new Ajax.Request(action, options); } }; /*--------------------------------------------------------------------------*/ Form.Element = { focus: function(element) { $(element).focus(); return element; }, select: function(element) { $(element).select(); return element; } }; Form.Element.Methods = { serialize: function(element) { element = $(element); if (!element.disabled && element.name) { var value = element.getValue(); if (value != undefined) { var pair = { }; pair[element.name] = value; return Object.toQueryString(pair); } } return ''; }, getValue: function(element) { element = $(element); var method = element.tagName.toLowerCase(); return Form.Element.Serializers[method](element); }, setValue: function(element, value) { element = $(element); var method = element.tagName.toLowerCase(); Form.Element.Serializers[method](element, value); return element; }, clear: function(element) { $(element).value = ''; return element; }, present: function(element) { return $(element).value != ''; }, activate: function(element) { element = $(element); try { element.focus(); if (element.select && (element.tagName.toLowerCase() != 'input' || !['button', 'reset', 'submit'].include(element.type))) element.select(); } catch (e) { } return element; }, disable: function(element) { element = $(element); element.blur(); element.disabled = true; return element; }, enable: function(element) { element = $(element); element.disabled = false; return element; } }; /*--------------------------------------------------------------------------*/ var Field = Form.Element; var $F = Form.Element.Methods.getValue; /*--------------------------------------------------------------------------*/ Form.Element.Serializers = { input: function(element, value) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': return Form.Element.Serializers.inputSelector(element, value); default: return Form.Element.Serializers.textarea(element, value); } }, inputSelector: function(element, value) { if (value === undefined) return element.checked ? element.value : null; else element.checked = !!value; }, textarea: function(element, value) { if (value === undefined) return element.value; else element.value = value; }, select: function(element, index) { if (index === undefined) return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); else { var opt, value, single = !Object.isArray(index); for (var i = 0, length = element.length; i < length; i++) { opt = element.options[i]; value = this.optionValue(opt); if (single) { if (value == index) { opt.selected = true; return; } } else opt.selected = index.include(value); } } }, selectOne: function(element) { var index = element.selectedIndex; return index >= 0 ? this.optionValue(element.options[index]) : null; }, selectMany: function(element) { var values, length = element.length; if (!length) return null; for (var i = 0, values = []; i < length; i++) { var opt = element.options[i]; if (opt.selected) values.push(this.optionValue(opt)); } return values; }, optionValue: function(opt) { // extend element because hasAttribute may not be native return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; } }; /*--------------------------------------------------------------------------*/ Abstract.TimedObserver = Class.create(PeriodicalExecuter, { initialize: function($super, element, frequency, callback) { $super(callback, frequency); this.element = $(element); this.lastValue = this.getValue(); }, execute: function() { var value = this.getValue(); if (Object.isString(this.lastValue) && Object.isString(value) ? this.lastValue != value : String(this.lastValue) != String(value)) { this.callback(this.element, value); this.lastValue = value; } } }); Form.Element.Observer = Class.create(Abstract.TimedObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); Form.Observer = Class.create(Abstract.TimedObserver, { getValue: function() { return Form.serialize(this.element); } }); /*--------------------------------------------------------------------------*/ Abstract.EventObserver = Class.create({ initialize: function(element, callback) { this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); if (this.element.tagName.toLowerCase() == 'form') this.registerFormCallbacks(); else this.registerCallback(this.element); }, onElementEvent: function() { var value = this.getValue(); if (this.lastValue != value) { this.callback(this.element, value); this.lastValue = value; } }, registerFormCallbacks: function() { Form.getElements(this.element).each(this.registerCallback, this); }, registerCallback: function(element) { if (element.type) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': Event.observe(element, 'click', this.onElementEvent.bind(this)); break; default: Event.observe(element, 'change', this.onElementEvent.bind(this)); break; } } } }); Form.Element.EventObserver = Class.create(Abstract.EventObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); Form.EventObserver = Class.create(Abstract.EventObserver, { getValue: function() { return Form.serialize(this.element); } }); if (!window.Event) var Event = { }; Object.extend(Event, { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, KEY_INSERT: 45, cache: { }, relatedTarget: function(event) { var element; switch(event.type) { case 'mouseover': element = event.fromElement; break; case 'mouseout': element = event.toElement; break; default: return null; } return Element.extend(element); } }); Event.Methods = (function() { var isButton; if (Prototype.Browser.IE) { var buttonMap = { 0: 1, 1: 4, 2: 2 }; isButton = function(event, code) { return event.button == buttonMap[code]; }; } else if (Prototype.Browser.WebKit) { isButton = function(event, code) { switch (code) { case 0: return event.which == 1 && !event.metaKey; case 1: return event.which == 1 && event.metaKey; default: return false; } }; } else { isButton = function(event, code) { return event.which ? (event.which === code + 1) : (event.button === code); }; } return { isLeftClick: function(event) { return isButton(event, 0) }, isMiddleClick: function(event) { return isButton(event, 1) }, isRightClick: function(event) { return isButton(event, 2) }, element: function(event) { var node = Event.extend(event).target; return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); }, findElement: function(event, expression) { var element = Event.element(event); return element.match(expression) ? element : element.up(expression); }, pointer: function(event) { return { x: event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)), y: event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) }; }, pointerX: function(event) { return Event.pointer(event).x }, pointerY: function(event) { return Event.pointer(event).y }, stop: function(event) { Event.extend(event); event.preventDefault(); event.stopPropagation(); event.stopped = true; } }; })(); Event.extend = (function() { var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { m[name] = Event.Methods[name].methodize(); return m; }); if (Prototype.Browser.IE) { Object.extend(methods, { stopPropagation: function() { this.cancelBubble = true }, preventDefault: function() { this.returnValue = false }, inspect: function() { return "[object Event]" } }); return function(event) { if (!event) return false; if (event._extendedByPrototype) return event; event._extendedByPrototype = Prototype.emptyFunction; var pointer = Event.pointer(event); Object.extend(event, { target: event.srcElement, relatedTarget: Event.relatedTarget(event), pageX: pointer.x, pageY: pointer.y }); return Object.extend(event, methods); }; } else { Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__; Object.extend(Event.prototype, methods); return Prototype.K; } })(); Object.extend(Event, (function() { var cache = Event.cache; function getEventID(element) { if (element._eventID) return element._eventID; arguments.callee.id = arguments.callee.id || 1; return element._eventID = ++arguments.callee.id; } function getDOMEventName(eventName) { if (eventName && eventName.include(':')) return "dataavailable"; return eventName; } function getCacheForID(id) { return cache[id] = cache[id] || { }; } function getWrappersForEventName(id, eventName) { var c = getCacheForID(id); return c[eventName] = c[eventName] || []; } function createWrapper(element, eventName, handler) { var id = getEventID(element); var c = getWrappersForEventName(id, eventName); if (c.pluck("handler").include(handler)) return false; var wrapper = function(event) { if (!Event || !Event.extend || (event.eventName && event.eventName != eventName)) return false; Event.extend(event); handler.call(element, event) }; wrapper.handler = handler; c.push(wrapper); return wrapper; } function findWrapper(id, eventName, handler) { var c = getWrappersForEventName(id, eventName); return c.find(function(wrapper) { return wrapper.handler == handler }); } function destroyWrapper(id, eventName, handler) { var c = getCacheForID(id); if (!c[eventName]) return false; c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); } function destroyCache() { for (var id in cache) for (var eventName in cache[id]) cache[id][eventName] = null; } if (window.attachEvent) { window.attachEvent("onunload", destroyCache); } return { observe: function(element, eventName, handler) { element = $(element); var name = getDOMEventName(eventName); var wrapper = createWrapper(element, eventName, handler); if (!wrapper) return element; if (element.addEventListener) { element.addEventListener(name, wrapper, false); } else { element.attachEvent("on" + name, wrapper); } return element; }, stopObserving: function(element, eventName, handler) { element = $(element); var id = getEventID(element), name = getDOMEventName(eventName); if (!handler && eventName) { getWrappersForEventName(id, eventName).each(function(wrapper) { element.stopObserving(eventName, wrapper.handler); }); return element; } else if (!eventName) { Object.keys(getCacheForID(id)).each(function(eventName) { element.stopObserving(eventName); }); return element; } var wrapper = findWrapper(id, eventName, handler); if (!wrapper) return element; if (element.removeEventListener) { element.removeEventListener(name, wrapper, false); } else { element.detachEvent("on" + name, wrapper); } destroyWrapper(id, eventName, handler); return element; }, fire: function(element, eventName, memo) { element = $(element); if (element == document && document.createEvent && !element.dispatchEvent) element = document.documentElement; if (document.createEvent) { var event = document.createEvent("HTMLEvents"); event.initEvent("dataavailable", true, true); } else { var event = document.createEventObject(); event.eventType = "ondataavailable"; } event.eventName = eventName; event.memo = memo || { }; if (document.createEvent) { element.dispatchEvent(event); } else { element.fireEvent(event.eventType, event); } return event; } }; })()); Object.extend(Event, Event.Methods); Element.addMethods({ fire: Event.fire, observe: Event.observe, stopObserving: Event.stopObserving }); Object.extend(document, { fire: Element.Methods.fire.methodize(), observe: Element.Methods.observe.methodize(), stopObserving: Element.Methods.stopObserving.methodize() }); (function() { /* Support for the DOMContentLoaded event is based on work by Dan Webb, Matthias Miller, Dean Edwards and John Resig. */ var timer, fired = false; function fireContentLoadedEvent() { if (fired) return; if (timer) window.clearInterval(timer); document.fire("dom:loaded"); fired = true; } if (document.addEventListener) { if (Prototype.Browser.WebKit) { timer = window.setInterval(function() { if (/loaded|complete/.test(document.readyState)) fireContentLoadedEvent(); }, 0); Event.observe(window, "load", fireContentLoadedEvent); } else { document.addEventListener("DOMContentLoaded", fireContentLoadedEvent, false); } } else { document.write("';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

    ( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
    ';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y blank_page blogs/wp-includes/js/tinymce/tiny_mce_popup.js0000644000000000000000000001532611077635520020605 0ustar rootroot// Some global instances var tinymce = null, tinyMCEPopup, tinyMCE; tinyMCEPopup = { init : function() { var t = this, w, ti, li, q, i, it; li = ('' + document.location.search).replace(/^\?/, '').split('&'); q = {}; for (i=0; i'); tinymce.ScriptLoader.markDone(u); } } }, pickColor : function(e, element_id) { this.execCommand('mceColorPicker', true, { color : document.getElementById(element_id).value, func : function(c) { document.getElementById(element_id).value = c; try { document.getElementById(element_id).onchange(); } catch (ex) { // Try fire event, ignore errors } } }); }, openBrowser : function(element_id, type, option) { tinyMCEPopup.restoreSelection(); this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); }, close : function() { var t = this; // To avoid domain relaxing issue in Opera function close() { t.editor.windowManager.close(window); tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup }; if (tinymce.isOpera) t.getWin().setTimeout(close, 0); else close(); }, // Internal functions _restoreSelection : function() { var e = window.event.srcElement; if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) tinyMCEPopup.restoreSelection(); }, /* _restoreSelection : function() { var e = window.event.srcElement; // If user focus a non text input or textarea if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') tinyMCEPopup.restoreSelection(); },*/ _onDOMLoaded : function() { var t = this, ti = document.title, bm, h; // Translate page h = document.body.innerHTML; // Replace a=x with a="x" in IE if (tinymce.isIE) h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') document.dir = t.editor.getParam('directionality',''); document.body.innerHTML = t.editor.translate(h); document.title = ti = t.editor.translate(ti); document.body.style.display = ''; // Restore selection in IE when focus is placed on a non textarea or input element of the type text if (tinymce.isIE) document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); t.restoreSelection(); t.resizeToInnerSize(); // Set inline title if (!t.isWindow) t.editor.windowManager.setTitle(window, ti); else window.focus(); if (!tinymce.isIE && !t.isWindow) { tinymce.dom.Event._add(document, 'focus', function() { t.editor.windowManager.focus(t.id) }); } // Patch for accessibility tinymce.each(t.dom.select('select'), function(e) { e.onkeydown = tinyMCEPopup._accessHandler; }); // Call onInit // Init must be called before focus so the selection won't get lost by the focus call tinymce.each(t.listeners, function(o) { o.func.call(o.scope, t.editor); }); // Move focus to window if (t.getWindowArg('mce_auto_focus', true)) { window.focus(); // Focus element with mceFocus class tinymce.each(document.forms, function(f) { tinymce.each(f.elements, function(e) { if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) { e.focus(); return false; // Break loop } }); }); } document.onkeyup = tinyMCEPopup._closeWinKeyHandler; }, _accessHandler : function(e) { e = e || window.event; if (e.keyCode == 13 || e.keyCode == 32) { e = e.target || e.srcElement; if (e.onchange) e.onchange(); return tinymce.dom.Event.cancel(e); } }, _closeWinKeyHandler : function(e) { e = e || window.event; if (e.keyCode == 27) tinyMCEPopup.close(); }, _wait : function() { var t = this, ti; if (tinymce.isIE && document.location.protocol != 'https:') { // Fake DOMContentLoaded on IE document.write(' blogs/wp-includes/js/tinymce/plugins/paste/css/0000755000000000000000000000000011046077144020571 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/paste/css/blank.css0000644000000000000000000000061311077635520022374 0ustar rootroothtml, body {height:98%} body { background-color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; scrollbar-3dlight-color: #F0F0EE; scrollbar-arrow-color: #676662; scrollbar-base-color: #F0F0EE; scrollbar-darkshadow-color: #DDDDDD; scrollbar-face-color: #E0E0DD; scrollbar-highlight-color: #F0F0EE; scrollbar-shadow-color: #F0F0EE; scrollbar-track-color: #F5F5F5; } blogs/wp-includes/js/tinymce/plugins/paste/css/pasteword.css0000644000000000000000000000005611077635520023316 0ustar rootroot.sourceIframe { border: 1px solid #808080; } blogs/wp-includes/js/tinymce/plugins/paste/pastetext.htm0000644000000000000000000000251411077635520022540 0ustar rootroot {#paste.paste_text_desc}

    {#paste.paste_text_desc}

    {#paste_dlg.text_title}
    blogs/wp-includes/js/tinymce/plugins/paste/images/0000755000000000000000000000000011046077144021246 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/paste/images/selectall.gif0000644000000000000000000000031511046077144023704 0ustar rootrootGIF89a<;0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i {#paste.paste_word_desc}
    {#paste.paste_word_desc}
    {#paste_dlg.word_title}
    blogs/wp-includes/js/tinymce/plugins/spellchecker/0000755000000000000000000000000011046077144021331 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/config.php0000755000000000000000000000117511077635520023320 0ustar rootroot blogs/wp-includes/js/tinymce/plugins/spellchecker/includes/0000755000000000000000000000000011077323063023135 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php0000644000000000000000000000421411077635520025270 0ustar rootroot $value) $newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize); return $newarray; } return formatParam($_REQUEST[$name], $sanitize); } function &getLogger() { global $mcLogger, $man; if (isset($man)) $mcLogger = $man->getLogger(); if (!$mcLogger) { $mcLogger = new Moxiecode_Logger(); // Set logger options $mcLogger->setPath(dirname(__FILE__) . "/../logs"); $mcLogger->setMaxSize("100kb"); $mcLogger->setMaxFiles("10"); $mcLogger->setFormat("{time} - {message}"); } return $mcLogger; } function debug($msg) { $args = func_get_args(); $log = getLogger(); $log->debug(implode(', ', $args)); } function info($msg) { $args = func_get_args(); $log = getLogger(); $log->info(implode(', ', $args)); } function error($msg) { $args = func_get_args(); $log = getLogger(); $log->error(implode(', ', $args)); } function warn($msg) { $args = func_get_args(); $log = getLogger(); $log->warn(implode(', ', $args)); } function fatal($msg) { $args = func_get_args(); $log = getLogger(); $log->fatal(implode(', ', $args)); } ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/css/0000755000000000000000000000000011046077144022121 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/css/content.css0000755000000000000000000000014111077635520024306 0ustar rootroot.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} blogs/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css0000755000000000000000000000110411046077144025276 0ustar rootroot.mceMsgBox { border: 1px solid gray; padding: 8px; } .mceMsgBox span { vertical-align: top; color: #555555; } /* Misc */ .mceBlockBox { display: none; position: absolute; left: 0; top: 0; z-index: 100; filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60); -moz-opacity:0.6; opacity: 0.6; background-color: white; } .mceMsgBox { display: none; z-index: 101; position: absolute; left: 0; top: 0; font-family: Arial, Verdana, Tahoma, Helvetica; font-weight: bold; font-size: 11px; background-color: #FFF; } blogs/wp-includes/js/tinymce/plugins/spellchecker/images/0000755000000000000000000000000011046077144022576 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif0000755000000000000000000000111711046077144025734 0ustar rootrootGIF89aVNWHCMUPZb]g!"&fiu./38:Az|qu0HoݐůկѭCFN|ғOR[adm0P@`Pp`p]vxރjszՙŭݣɭZ^h0X7]@hPxHj`a}ߐѯհӺQpUdoqu@ACxy{@hQvp7ePVЖxmt| (0PX` CKNNVWppp000!`,`LEI!UKTJT[` \`6 Y`XZ ] @ `W `"HS-^Z  _M;4P:F2؃GRF׈CV<;݇3>,D`+OQA))*B.)$~('p%t丑 H܀aQЋ =:IP ;blogs/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif0000755000000000000000000000005611046077144024407 0ustar rootrootGIF89a**!,Df;blogs/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js0000755000000000000000000002027511077635520024546 0ustar rootroot/** * $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $ * * @author Moxiecode * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. */ (function() { var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM; tinymce.create('tinymce.plugins.SpellcheckerPlugin', { getInfo : function() { return { longname : 'Spellchecker', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', version : tinymce.majorVersion + "." + tinymce.minorVersion }; }, init : function(ed, url) { var t = this, cm; t.url = url; t.editor = ed; // Register commands ed.addCommand('mceSpellCheck', function() { if (!t.active) { ed.setProgressState(1); t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) { if (r.length > 0) { t.active = 1; t._markWords(r); ed.setProgressState(0); ed.nodeChanged(); } else { ed.setProgressState(0); ed.windowManager.alert('spellchecker.no_mpell'); } }); } else t._done(); }); ed.onInit.add(function() { if (ed.settings.content_css !== false) ed.dom.loadCSS(url + '/css/content.css'); }); ed.onClick.add(t._showMenu, t); ed.onContextMenu.add(t._showMenu, t); ed.onBeforeGetContent.add(function() { if (t.active) t._removeWords(); }); ed.onNodeChange.add(function(ed, cm) { cm.setActive('spellchecker', t.active); }); ed.onSetContent.add(function() { t._done(); }); ed.onBeforeGetContent.add(function() { t._done(); }); ed.onBeforeExecCommand.add(function(ed, cmd) { if (cmd == 'mceFullScreen') t._done(); }); // Find selected language t.languages = {}; each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) { if (k.indexOf('+') === 0) { k = k.substring(1); t.selectedLang = v; } t.languages[k] = v; }); }, createControl : function(n, cm) { var t = this, c, ed = t.editor; if (n == 'spellchecker') { c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t}); c.onRenderMenu.add(function(c, m) { m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1); each(t.languages, function(v, k) { var o = {icon : 1}, mi; o.onclick = function() { mi.setSelected(1); t.selectedItem.setSelected(0); t.selectedItem = mi; t.selectedLang = v; }; o.title = k; mi = m.add(o); mi.setSelected(v == t.selectedLang); if (v == t.selectedLang) t.selectedItem = mi; }) }); return c; } }, // Internal functions _walk : function(n, f) { var d = this.editor.getDoc(), w; if (d.createTreeWalker) { w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); while ((n = w.nextNode()) != null) f.call(this, n); } else tinymce.walk(n, f, 'childNodes'); }, _getSeparators : function() { var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}\u201d\u201c'); // Build word separator regexp for (i=0; i$1
    $2'); v = v.replace(r3, '$1$2'); dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n); } } }); se.moveToBookmark(b); }, _showMenu : function(ed, e) { var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()); if (!m) { p1 = DOM.getPos(ed.getContentAreaContainer()); //p2 = DOM.getPos(ed.getContainer()); m = ed.controlManager.createDropMenu('spellcheckermenu', { offset_x : p1.x, offset_y : p1.y, 'class' : 'mceNoIcons' }); t._menu = m; } if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) { m.removeAll(); m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1); t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) { m.removeAll(); if (r.length > 0) { m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); each(r, function(v) { m.add({title : v, onclick : function() { dom.replace(ed.getDoc().createTextNode(v), e.target); t._checkDone(); }}); }); m.addSeparator(); } else m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); m.add({ title : 'spellchecker.ignore_word', onclick : function() { dom.remove(e.target, 1); t._checkDone(); } }); m.add({ title : 'spellchecker.ignore_words', onclick : function() { t._removeWords(dom.decode(e.target.innerHTML)); t._checkDone(); } }); m.update(); }); ed.selection.select(e.target); p1 = dom.getPos(e.target); m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y); return tinymce.dom.Event.cancel(e); } else m.hideMenu(); }, _checkDone : function() { var t = this, ed = t.editor, dom = ed.dom, o; each(dom.select('span'), function(n) { if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) { o = true; return false; } }); if (!o) t._done(); }, _done : function() { var t = this, la = t.active; if (t.active) { t.active = 0; t._removeWords(); if (t._menu) t._menu.hideMenu(); if (la) t.editor.nodeChanged(); } }, _sendRPC : function(m, p, cb) { var t = this, url = t.editor.getParam("spellchecker_rpc_url", this.url+"/rpc.php"); if (url == '{backend}') { t.editor.setProgressState(0); alert('Please specify: spellchecker_rpc_url'); return; } JSONRequest.sendRPC({ url : url, method : m, params : p, success : cb, error : function(e, x) { t.editor.setProgressState(0); t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText)); } }); } }); // Register plugin tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin); })();blogs/wp-includes/js/tinymce/plugins/spellchecker/langs/0000755000000000000000000000000011046077144022435 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js0000755000000000000000000000065011046077144023401 0ustar rootroot// UK lang variables tinyMCE.addToLang('spellchecker',{ desc : 'Toggle spellchecker', menu : 'Spellchecker settings', ignore_word : 'Ignore word', ignore_words : 'Ignore all', langs : 'Languages', wait : 'Please wait...', swait : 'Spellchecking, please wait...', sug : 'Suggestions', no_sug : 'No suggestions', no_mpell : 'No misspellings found.', mpell_found : 'Found {$words} misspellings.' }); blogs/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php0000755000000000000000000001046211046077144024073 0ustar rootroot'; die; } // Basic config $defaultLanguage = $spellCheckerConfig['default.language']; $defaultMode = $spellCheckerConfig['default.mode']; // Normaly not required to configure $defaultSpelling = $spellCheckerConfig['default.spelling']; $defaultJargon = $spellCheckerConfig['default.jargon']; $defaultEncoding = $spellCheckerConfig['default.encoding']; $outputType = "xml"; // Do not change // Get input parameters. $check = urldecode(getRequestParam('check')); $cmd = sanitize(getRequestParam('cmd')); $lang = sanitize(getRequestParam('lang'), "strict"); $mode = sanitize(getRequestParam('mode'), "strict"); $spelling = sanitize(getRequestParam('spelling'), "strict"); $jargon = sanitize(getRequestParam('jargon'), "strict"); $encoding = sanitize(getRequestParam('encoding'), "strict"); $sg = sanitize(getRequestParam('sg'), "bool"); $words = array(); $validRequest = true; if (empty($check)) $validRequest = false; if (empty($lang)) $lang = $defaultLanguage; if (empty($mode)) $mode = $defaultMode; if (empty($spelling)) $spelling = $defaultSpelling; if (empty($jargon)) $jargon = $defaultJargon; if (empty($encoding)) $encoding = $defaultEncoding; function sanitize($str, $type="strict") { switch ($type) { case "strict": $str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str); break; case "loose": $str = preg_replace("//i", "<", $str); break; case "bool": if ($str == "true" || $str == true) $str = true; else $str = false; break; } return $str; } function getRequestParam($name, $default_value = false) { if (!isset($_REQUEST[$name])) return $default_value; if (!isset($_GLOBALS['magic_quotes_gpc'])) $_GLOBALS['magic_quotes_gpc'] = ini_get("magic_quotes_gpc"); if (isset($_GLOBALS['magic_quotes_gpc'])) { if (is_array($_REQUEST[$name])) { $newarray = array(); foreach($_REQUEST[$name] as $name => $value) $newarray[stripslashes($name)] = stripslashes($value); return $newarray; } return stripslashes($_REQUEST[$name]); } return $_REQUEST[$name]; } $result = array(); $tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding); if (count($tinyspell->errorMsg) == 0) { switch($cmd) { case "spell": // Space for non-exec version and \n for the exec version. $words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY); $result = $tinyspell->checkWords($words); break; case "suggest": $result = $tinyspell->getSuggestion($check); break; default: // Just use this for now. $tinyspell->errorMsg[] = "No command."; $outputType = $outputType . "error"; break; } } else $outputType = $outputType . "error"; if (!$result) $result = array(); // Output data switch($outputType) { case "xml": header('Content-type: text/xml; charset=utf-8'); $body = ''; $body .= "\n"; if (count($result) == 0) $body .= ''; else $body .= ''. urlencode(implode(" ", $result)) .''; echo $body; break; case "xmlerror"; header('Content-type: text/xml; charset=utf-8'); $body = ''; $body .= "\n"; $body .= 'errorMsg) .'" />'; echo $body; break; case "html": var_dump($result); break; case "htmlerror": echo "Error"; break; } ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/rpc.php0000644000000000000000000000372411077635520022636 0ustar rootrootdecode($raw); // Execute RPC if (isset($config['general.engine'])) { $spellchecker = new $config['general.engine']($config); $result = call_user_func_array(array($spellchecker, $input['method']), $input['params']); } else die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); // Request and response id should always be the same $output = array( "id" => $input->id, "result" => $result, "error" => null ); // Return JSON encoded string echo $json->encode($output); ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/0000755000000000000000000000000011046077144022766 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php0000644000000000000000000001000311077635520025707 0ustar rootroot_getMatches($lang, $wordstr); $words = array(); for ($i=0; $i_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8")); return $words; } /** * Returns suggestions of for a specific word. * * @param {String} $lang Language code like sv or en. * @param {String} $word Specific word to get suggestions for. * @return {Array} Array of suggestions for the specified word. */ function &getSuggestions($lang, $word) { $sug = array(); $osug = array(); $matches = $this->_getMatches($lang, $word); if (count($matches) > 0) $sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4]))); // Remove empty foreach ($sug as $item) { if ($item) $osug[] = $item; } return $osug; } function &_getMatches($lang, $str) { $server = "www.google.com"; $port = 443; $path = "/tbproxy/spell?lang=" . $lang . "&hl=en"; $host = "www.google.com"; $url = "https://" . $server; // Setup XML request $xml = '' . $str . ''; $header = "POST ".$path." HTTP/1.0 \r\n"; $header .= "MIME-Version: 1.0 \r\n"; $header .= "Content-type: application/PTI26 \r\n"; $header .= "Content-length: ".strlen($xml)." \r\n"; $header .= "Content-transfer-encoding: text \r\n"; $header .= "Request-number: 1 \r\n"; $header .= "Document-type: Request \r\n"; $header .= "Interface-Version: Test 1.4 \r\n"; $header .= "Connection: close \r\n\r\n"; $header .= $xml; // Use curl if it exists if (function_exists('curl_init')) { // Use curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $xml = curl_exec($ch); curl_close($ch); } else { // Use raw sockets $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30); if ($fp) { // Send request fwrite($fp, $header); // Read response $xml = ""; while (!feof($fp)) $xml .= fgets($fp, 128); fclose($fp); } else echo "Could not open SSL connection to google."; } // Grab and parse content $matches = array(); preg_match_all('/([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER); return $matches; } function _unhtmlentities($string) { $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string); $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } } // Patch in multibyte support if (!function_exists('mb_substr')) { function mb_substr($str, $start, $len = '', $encoding="UTF-8"){ $limit = strlen($str); for ($s = 0; $start > 0;--$start) {// found the real start if ($s >= $limit) break; if ($str[$s] <= "\x7F") ++$s; else { ++$s; // skip length while ($str[$s] >= "\x80" && $str[$s] <= "\xBF") ++$s; } } if ($len == '') return substr($str, $s); else for ($e = $s; $len > 0; --$len) {//found the real end if ($e >= $limit) break; if ($str[$e] <= "\x7F") ++$e; else { ++$e;//skip length while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit) ++$e; } } return substr($str, $s, $e - $s); } } ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php0000755000000000000000000002756311046077144026701 0ustar rootrootcookies array ready for the next request // Note: This currently ignores the cookie path (and time) completely. Time is not important, // but path could possibly lead to security problems. var $persist_referers = true; // For each request, sends path of last request as referer var $debug = false; var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found var $max_redirects = 5; var $headers_only = false; // If true, stops receiving once headers have been read. // Basic authorization variables var $username; var $password; // Response vars var $status; var $headers = array(); var $content = ''; var $errormsg; // Tracker variables var $redirect_count = 0; var $cookie_host = ''; function HttpClient($host, $port=80) { $this->host = $host; $this->port = $port; } function get($path, $data = false) { $this->path = $path; $this->method = 'GET'; if ($data) { $this->path .= '?'.$this->buildQueryString($data); } return $this->doRequest(); } function post($path, $data) { $this->path = $path; $this->method = 'POST'; $this->postdata = $this->buildQueryString($data); return $this->doRequest(); } function buildQueryString($data) { $querystring = ''; if (is_array($data)) { // Change data in to postable data foreach ($data as $key => $val) { if (is_array($val)) { foreach ($val as $val2) { $querystring .= urlencode($key).'='.urlencode($val2).'&'; } } else { $querystring .= urlencode($key).'='.urlencode($val).'&'; } } $querystring = substr($querystring, 0, -1); // Eliminate unnecessary & } else { $querystring = $data; } return $querystring; } function doRequest() { // Performs the actual HTTP request, returning true or false depending on outcome if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) { // Set error message switch($errno) { case -3: $this->errormsg = 'Socket creation failed (-3)'; case -4: $this->errormsg = 'DNS lookup failure (-4)'; case -5: $this->errormsg = 'Connection refused or timed out (-5)'; default: $this->errormsg = 'Connection failed ('.$errno.')'; $this->errormsg .= ' '.$errstr; $this->debug($this->errormsg); } return false; } socket_set_timeout($fp, $this->timeout); $request = $this->buildRequest(); $this->debug('Request', $request); fwrite($fp, $request); // Reset all the variables that should not persist between requests $this->headers = array(); $this->content = ''; $this->errormsg = ''; // Set a couple of flags $inHeaders = true; $atStart = true; // Now start reading back the response while (!feof($fp)) { $line = fgets($fp, 4096); if ($atStart) { // Deal with first line of returned data $atStart = false; if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) { $this->errormsg = "Status code line invalid: ".htmlentities($line); $this->debug($this->errormsg); return false; } $http_version = $m[1]; // not used $this->status = $m[2]; $status_string = $m[3]; // not used $this->debug(trim($line)); continue; } if ($inHeaders) { if (trim($line) == '') { $inHeaders = false; $this->debug('Received Headers', $this->headers); if ($this->headers_only) { break; // Skip the rest of the input } continue; } if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) { // Skip to the next header continue; } $key = strtolower(trim($m[1])); $val = trim($m[2]); // Deal with the possibility of multiple headers of same name if (isset($this->headers[$key])) { if (is_array($this->headers[$key])) { $this->headers[$key][] = $val; } else { $this->headers[$key] = array($this->headers[$key], $val); } } else { $this->headers[$key] = $val; } continue; } // We're not in the headers, so append the line to the contents $this->content .= $line; } fclose($fp); // If data is compressed, uncompress it if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') { $this->debug('Content is gzip encoded, unzipping it'); $this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php $this->content = gzinflate($this->content); } // If $persist_cookies, deal with any cookies if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) { $cookies = $this->headers['set-cookie']; if (!is_array($cookies)) { $cookies = array($cookies); } foreach ($cookies as $cookie) { if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) { $this->cookies[$m[1]] = $m[2]; } } // Record domain of cookies for security reasons $this->cookie_host = $this->host; } // If $persist_referers, set the referer ready for the next request if ($this->persist_referers) { $this->debug('Persisting referer: '.$this->getRequestURL()); $this->referer = $this->getRequestURL(); } // Finally, if handle_redirects and a redirect is sent, do that if ($this->handle_redirects) { if (++$this->redirect_count >= $this->max_redirects) { $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')'; $this->debug($this->errormsg); $this->redirect_count = 0; return false; } $location = isset($this->headers['location']) ? $this->headers['location'] : ''; $uri = isset($this->headers['uri']) ? $this->headers['uri'] : ''; if ($location || $uri) { $url = parse_url($location.$uri); // This will FAIL if redirect is to a different site return $this->get($url['path']); } } return true; } function buildRequest() { $headers = array(); $headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding $headers[] = "Host: {$this->host}"; $headers[] = "User-Agent: {$this->user_agent}"; $headers[] = "Accept: {$this->accept}"; if ($this->use_gzip) { $headers[] = "Accept-encoding: {$this->accept_encoding}"; } $headers[] = "Accept-language: {$this->accept_language}"; if ($this->referer) { $headers[] = "Referer: {$this->referer}"; } // Cookies if ($this->cookies) { $cookie = 'Cookie: '; foreach ($this->cookies as $key => $value) { $cookie .= "$key=$value; "; } $headers[] = $cookie; } // Basic authentication if ($this->username && $this->password) { $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password); } // If this is a POST, set the content type and length if ($this->postdata) { $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $headers[] = 'Content-Length: '.strlen($this->postdata); } $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata; return $request; } function getStatus() { return $this->status; } function getContent() { return $this->content; } function getHeaders() { return $this->headers; } function getHeader($header) { $header = strtolower($header); if (isset($this->headers[$header])) { return $this->headers[$header]; } else { return false; } } function getError() { return $this->errormsg; } function getCookies() { return $this->cookies; } function getRequestURL() { $url = 'http://'.$this->host; if ($this->port != 80) { $url .= ':'.$this->port; } $url .= $this->path; return $url; } // Setter methods function setUserAgent($string) { $this->user_agent = $string; } function setAuthorization($username, $password) { $this->username = $username; $this->password = $password; } function setCookies($array) { $this->cookies = $array; } // Option setting methods function useGzip($boolean) { $this->use_gzip = $boolean; } function setPersistCookies($boolean) { $this->persist_cookies = $boolean; } function setPersistReferers($boolean) { $this->persist_referers = $boolean; } function setHandleRedirects($boolean) { $this->handle_redirects = $boolean; } function setMaxRedirects($num) { $this->max_redirects = $num; } function setHeadersOnly($boolean) { $this->headers_only = $boolean; } function setDebug($boolean) { $this->debug = $boolean; } // "Quick" static methods function quickGet($url) { $bits = parse_url($url); $host = $bits['host']; $port = isset($bits['port']) ? $bits['port'] : 80; $path = isset($bits['path']) ? $bits['path'] : '/'; if (isset($bits['query'])) { $path .= '?'.$bits['query']; } $client = new HttpClient($host, $port); if (!$client->get($path)) { return false; } else { return $client->getContent(); } } function quickPost($url, $data) { $bits = parse_url($url); $host = $bits['host']; $port = isset($bits['port']) ? $bits['port'] : 80; $path = isset($bits['path']) ? $bits['path'] : '/'; $client = new HttpClient($host, $port); if (!$client->post($path, $data)) { return false; } else { return $client->getContent(); } } function debug($msg, $object = false) { if ($this->debug) { print '
    HttpClient Debug: '.$msg; if ($object) { ob_start(); print_r($object); $content = htmlentities(ob_get_contents()); ob_end_clean(); print '
    '.$content.'
    '; } print '
    '; } } } ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php0000755000000000000000000000263711046077144026721 0ustar rootrootlang = $lang; $this->mode = $mode; $this->plink = false; $this->errorMsg = array(); if (!function_exists("pspell_new")) { $this->errorMsg[] = "PSpell not found."; return; } $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode); } // Returns array with bad words or false if failed. function checkWords($wordArray) { if (!$this->plink) { $this->errorMsg[] = "No PSpell link found for checkWords."; return array(); } $wordError = array(); foreach($wordArray as $word) { if(!pspell_check($this->plink, trim($word))) $wordError[] = $word; } return $wordError; } // Returns array with suggestions or false if failed. function getSuggestion($word) { if (!$this->plink) { $this->errorMsg[] = "No PSpell link found for getSuggestion."; return array(); } return pspell_suggest($this->plink, $word); } } // Setup classname, should be the same as the name of the spellchecker class $spellCheckerConfig['class'] = "TinyPspell"; ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/0000755000000000000000000000000011077323063024124 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php0000644000000000000000000001253111077635520026062 0ustar rootroot_path = ""; $this->_filename = "{level}.log"; $this->setMaxSize("100k"); $this->_maxFiles = 10; $this->_level = MC_LOGGER_DEBUG; $this->_format = "[{time}] [{level}] {message}"; } /** * Sets the current log level, use the MC_LOGGER constants. * * @param int $level Log level instance for example MC_LOGGER_DEBUG. */ function setLevel($level) { if (is_string($level)) { switch (strtolower($level)) { case "debug": $level = MC_LOGGER_DEBUG; break; case "info": $level = MC_LOGGER_INFO; break; case "warn": case "warning": $level = MC_LOGGER_WARN; break; case "error": $level = MC_LOGGER_ERROR; break; case "fatal": $level = MC_LOGGER_FATAL; break; default: $level = MC_LOGGER_FATAL; } } $this->_level = $level; } /** * Returns the current log level for example MC_LOGGER_DEBUG. * * @return int Current log level for example MC_LOGGER_DEBUG. */ function getLevel() { return $this->_level; } function setPath($path) { $this->_path = $path; } function getPath() { return $this->_path; } function setFileName($file_name) { $this->_filename = $file_name; } function getFileName() { return $this->_filename; } function setFormat($format) { $this->_format = $format; } function getFormat() { return $this->_format; } function setMaxSize($size) { // Fix log max size $logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size)); // Is KB if (strpos((strtolower($size)), "k") > 0) $logMaxSizeBytes *= 1024; // Is MB if (strpos((strtolower($size)), "m") > 0) $logMaxSizeBytes *= (1024 * 1024); $this->_maxSizeBytes = $logMaxSizeBytes; $this->_maxSize = $size; } function getMaxSize() { return $this->_maxSize; } function setMaxFiles($max_files) { $this->_maxFiles = $max_files; } function getMaxFiles() { return $this->_maxFiles; } function debug($msg) { $args = func_get_args(); $this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args)); } function info($msg) { $args = func_get_args(); $this->_logMsg(MC_LOGGER_INFO, implode(', ', $args)); } function warn($msg) { $args = func_get_args(); $this->_logMsg(MC_LOGGER_WARN, implode(', ', $args)); } function error($msg) { $args = func_get_args(); $this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args)); } function fatal($msg) { $args = func_get_args(); $this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args)); } function isDebugEnabled() { return $this->_level >= MC_LOGGER_DEBUG; } function isInfoEnabled() { return $this->_level >= MC_LOGGER_INFO; } function isWarnEnabled() { return $this->_level >= MC_LOGGER_WARN; } function isErrorEnabled() { return $this->_level >= MC_LOGGER_ERROR; } function isFatalEnabled() { return $this->_level >= MC_LOGGER_FATAL; } function _logMsg($level, $message) { $roll = false; if ($level < $this->_level) return; $logFile = $this->toOSPath($this->_path . "/" . $this->_filename); switch ($level) { case MC_LOGGER_DEBUG: $levelName = "DEBUG"; break; case MC_LOGGER_INFO: $levelName = "INFO"; break; case MC_LOGGER_WARN: $levelName = "WARN"; break; case MC_LOGGER_ERROR: $levelName = "ERROR"; break; case MC_LOGGER_FATAL: $levelName = "FATAL"; break; } $logFile = str_replace('{level}', strtolower($levelName), $logFile); $text = $this->_format; $text = str_replace('{time}', date("Y-m-d H:i:s"), $text); $text = str_replace('{level}', strtolower($levelName), $text); $text = str_replace('{message}', $message, $text); $message = $text . "\r\n"; // Check filesize if (file_exists($logFile)) { $size = @filesize($logFile); if ($size + strlen($message) > $this->_maxSizeBytes) $roll = true; } // Roll if the size is right if ($roll) { for ($i=$this->_maxFiles-1; $i>=1; $i--) { $rfile = $this->toOSPath($logFile . "." . $i); $nfile = $this->toOSPath($logFile . "." . ($i+1)); if (@file_exists($rfile)) @rename($rfile, $nfile); } @rename($logFile, $this->toOSPath($logFile . ".1")); // Delete last logfile $delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1)); if (@file_exists($delfile)) @unlink($delfile); } // Append log line if (($fp = @fopen($logFile, "a")) != null) { @fputs($fp, $message); @fflush($fp); @fclose($fp); } } /** * Converts a Unix path to OS specific path. * * @param String $path Unix path to convert. */ function toOSPath($path) { return str_replace("/", DIRECTORY_SEPARATOR, $path); } } ?>blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php0000644000000000000000000002714511077635520025423 0ustar rootroot_data = $data; $this->_len = strlen($data); $this->_pos = -1; $this->_location = JSON_IN_BETWEEN; $this->_lastLocations = array(); $this->_needProp = false; } function getToken() { return $this->_token; } function getLocation() { return $this->_location; } function getTokenName() { switch ($this->_token) { case JSON_BOOL: return 'JSON_BOOL'; case JSON_INT: return 'JSON_INT'; case JSON_STR: return 'JSON_STR'; case JSON_FLOAT: return 'JSON_FLOAT'; case JSON_NULL: return 'JSON_NULL'; case JSON_START_OBJ: return 'JSON_START_OBJ'; case JSON_END_OBJ: return 'JSON_END_OBJ'; case JSON_START_ARRAY: return 'JSON_START_ARRAY'; case JSON_END_ARRAY: return 'JSON_END_ARRAY'; case JSON_KEY: return 'JSON_KEY'; } return 'UNKNOWN'; } function getValue() { return $this->_value; } function readToken() { $chr = $this->read(); if ($chr != null) { switch ($chr) { case '[': $this->_lastLocation[] = $this->_location; $this->_location = JSON_IN_ARRAY; $this->_token = JSON_START_ARRAY; $this->_value = null; $this->readAway(); return true; case ']': $this->_location = array_pop($this->_lastLocation); $this->_token = JSON_END_ARRAY; $this->_value = null; $this->readAway(); if ($this->_location == JSON_IN_OBJECT) $this->_needProp = true; return true; case '{': $this->_lastLocation[] = $this->_location; $this->_location = JSON_IN_OBJECT; $this->_needProp = true; $this->_token = JSON_START_OBJ; $this->_value = null; $this->readAway(); return true; case '}': $this->_location = array_pop($this->_lastLocation); $this->_token = JSON_END_OBJ; $this->_value = null; $this->readAway(); if ($this->_location == JSON_IN_OBJECT) $this->_needProp = true; return true; // String case '"': case '\'': return $this->_readString($chr); // Null case 'n': return $this->_readNull(); // Bool case 't': case 'f': return $this->_readBool($chr); default: // Is number if (is_numeric($chr) || $chr == '-' || $chr == '.') return $this->_readNumber($chr); return true; } } return false; } function _readBool($chr) { $this->_token = JSON_BOOL; $this->_value = $chr == 't'; if ($chr == 't') $this->skip(3); // rue else $this->skip(4); // alse $this->readAway(); if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) $this->_needProp = true; return true; } function _readNull() { $this->_token = JSON_NULL; $this->_value = null; $this->skip(3); // ull $this->readAway(); if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) $this->_needProp = true; return true; } function _readString($quote) { $output = ""; $this->_token = JSON_STR; $endString = false; while (($chr = $this->peek()) != -1) { switch ($chr) { case '\\': // Read away slash $this->read(); // Read escape code $chr = $this->read(); switch ($chr) { case 't': $output .= "\t"; break; case 'b': $output .= "\b"; break; case 'f': $output .= "\f"; break; case 'r': $output .= "\r"; break; case 'n': $output .= "\n"; break; case 'u': $output .= $this->_int2utf8(hexdec($this->read(4))); break; default: $output .= $chr; break; } break; case '\'': case '"': if ($chr == $quote) $endString = true; $chr = $this->read(); if ($chr != -1 && $chr != $quote) $output .= $chr; break; default: $output .= $this->read(); } // String terminated if ($endString) break; } $this->readAway(); $this->_value = $output; // Needed a property if ($this->_needProp) { $this->_token = JSON_KEY; $this->_needProp = false; return true; } if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) $this->_needProp = true; return true; } function _int2utf8($int) { $int = intval($int); switch ($int) { case 0: return chr(0); case ($int & 0x7F): return chr($int); case ($int & 0x7FF): return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F)); case ($int & 0xFFFF): return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F)); case ($int & 0x1FFFFF): return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F)); } } function _readNumber($start) { $value = ""; $isFloat = false; $this->_token = JSON_INT; $value .= $start; while (($chr = $this->peek()) != -1) { if (is_numeric($chr) || $chr == '-' || $chr == '.') { if ($chr == '.') $isFloat = true; $value .= $this->read(); } else break; } $this->readAway(); if ($isFloat) { $this->_token = JSON_FLOAT; $this->_value = floatval($value); } else $this->_value = intval($value); if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) $this->_needProp = true; return true; } function readAway() { while (($chr = $this->peek()) != null) { if ($chr != ':' && $chr != ',' && $chr != ' ') return; $this->read(); } } function read($len = 1) { if ($this->_pos < $this->_len) { if ($len > 1) { $str = substr($this->_data, $this->_pos + 1, $len); $this->_pos += $len; return $str; } else return $this->_data[++$this->_pos]; } return null; } function skip($len) { $this->_pos += $len; } function peek() { if ($this->_pos < $this->_len) return $this->_data[$this->_pos + 1]; return null; } } /** * This class handles JSON stuff. * * @package MCManager.utils */ class Moxiecode_JSON { function Moxiecode_JSON() { } function decode($input) { $reader = new Moxiecode_JSONReader($input); return $this->readValue($reader); } function readValue(&$reader) { $this->data = array(); $this->parents = array(); $this->cur =& $this->data; $key = null; $loc = JSON_IN_ARRAY; while ($reader->readToken()) { switch ($reader->getToken()) { case JSON_STR: case JSON_INT: case JSON_BOOL: case JSON_FLOAT: case JSON_NULL: switch ($reader->getLocation()) { case JSON_IN_OBJECT: $this->cur[$key] = $reader->getValue(); break; case JSON_IN_ARRAY: $this->cur[] = $reader->getValue(); break; default: return $reader->getValue(); } break; case JSON_KEY: $key = $reader->getValue(); break; case JSON_START_OBJ: case JSON_START_ARRAY: if ($loc == JSON_IN_OBJECT) $this->addArray($key); else $this->addArray(null); $cur =& $obj; $loc = $reader->getLocation(); break; case JSON_END_OBJ: case JSON_END_ARRAY: $loc = $reader->getLocation(); if (count($this->parents) > 0) { $this->cur =& $this->parents[count($this->parents) - 1]; array_pop($this->parents); } break; } } return $this->data[0]; } // This method was needed since PHP is crapy and doesn't have pointers/references function addArray($key) { $this->parents[] =& $this->cur; $ar = array(); if ($key) $this->cur[$key] =& $ar; else $this->cur[] =& $ar; $this->cur =& $ar; } function getDelim($index, &$reader) { switch ($reader->getLocation()) { case JSON_IN_ARRAY: case JSON_IN_OBJECT: if ($index > 0) return ","; break; } return ""; } function encode($input) { switch (gettype($input)) { case 'boolean': return $input ? 'true' : 'false'; case 'integer': return (int) $input; case 'float': case 'double': return (float) $input; case 'NULL': return 'null'; case 'string': return $this->encodeString($input); case 'array': return $this->_encodeArray($input); case 'object': return $this->_encodeArray(get_object_vars($input)); } return ''; } function encodeString($input) { // Needs to be escaped if (preg_match('/[^a-zA-Z0-9]/', $input)) { $output = ''; for ($i=0; $i_utf82utf16($char))); } if (($byte & 0xF0) == 0xE0) { $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2])); $i += 2; $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); } if (($byte & 0xF8) == 0xF0) { $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]))); $i += 3; $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); } if (($byte & 0xFC) == 0xF8) { $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]))); $i += 4; $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); } if (($byte & 0xFE) == 0xFC) { $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]))); $i += 5; $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); } else if ($byte < 128) $output .= $input[$i]; } } return '"' . $output . '"'; } return '"' . $input . '"'; } function _utf82utf16($utf8) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); switch (strlen($utf8)) { case 1: return $utf8; case 2: return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1]))); case 3: return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2]))); } return ''; } function _encodeArray($input) { $output = ''; $isIndexed = true; $keys = array_keys($input); for ($i=0; $iencodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]); $isIndexed = false; } else $output .= $this->encode($input[$keys[$i]]); if ($i != count($keys) - 1) $output .= ','; } return $isIndexed ? '[' . $output . ']' : '{' . $output . '}'; } } ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php0000755000000000000000000000704411046077144027673 0ustar rootrootlang = $lang; } // Returns array with bad words or false if failed. function checkWords($word_array) { $words = array(); $wordstr = implode(' ', $word_array); $matches = $this->_getMatches($wordstr); for ($i=0; $iunhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8")); return $words; } function unhtmlentities($string) { $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string); $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } // Returns array with suggestions or false if failed. function getSuggestion($word) { $sug = array(); $matches = $this->_getMatches($word); if (count($matches) > 0) $sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4]))); return $sug; } function _xmlChars($string) { $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES); foreach ($trans as $k => $v) $trans[$k] = "&#".ord($k).";"; return strtr($string, $trans); } function _getMatches($word_list) { $server = "www.google.com"; $port = 443; $path = "/tbproxy/spell?lang=" . $this->lang . "&hl=en"; $host = "www.google.com"; $url = "https://" . $server; // Setup XML request $xml = '' . $word_list . ''; $header = "POST ".$path." HTTP/1.0 \r\n"; $header .= "MIME-Version: 1.0 \r\n"; $header .= "Content-type: application/PTI26 \r\n"; $header .= "Content-length: ".strlen($xml)." \r\n"; $header .= "Content-transfer-encoding: text \r\n"; $header .= "Request-number: 1 \r\n"; $header .= "Document-type: Request \r\n"; $header .= "Interface-Version: Test 1.4 \r\n"; $header .= "Connection: close \r\n\r\n"; $header .= $xml; //$this->_debugData($xml); // Use curl if it exists if (function_exists('curl_init')) { // Use curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $xml = curl_exec($ch); curl_close($ch); } else { // Use raw sockets $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30); if ($fp) { // Send request fwrite($fp, $header); // Read response $xml = ""; while (!feof($fp)) $xml .= fgets($fp, 128); fclose($fp); } else echo "Could not open SSL connection to google."; } //$this->_debugData($xml); // Grab and parse content preg_match_all('/([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER); return $matches; } function _debugData($data) { $fh = @fopen("debug.log", 'a+'); @fwrite($fh, $data); @fclose($fh); } } // Setup classname, should be the same as the name of the spellchecker class $spellCheckerConfig['class'] = "TinyGoogleSpell"; ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php0000755000000000000000000000563111046077144027706 0ustar rootrootlang = $lang; $this->mode = $mode; $this->error = false; $this->errorMsg = array(); $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell"); if(preg_match("#win#i",php_uname())) $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1"; else $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang; } // Returns array with bad words or false if failed. function checkWords($wordArray) { if ($fh = fopen($this->tmpfile, "w")) { fwrite($fh, "!\n"); foreach($wordArray as $key => $value) fwrite($fh, "^" . $value . "\n"); fclose($fh); } else { $this->errorMsg[] = "PSpell not found."; return array(); } $data = shell_exec($this->cmd); @unlink($this->tmpfile); $returnData = array(); $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); foreach($dataArr as $dstr) { $matches = array(); // Skip this line. if (strpos($dstr, "@") === 0) continue; preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches); if (!empty($matches[1])) $returnData[] = $matches[1]; } return $returnData; } // Returns array with suggestions or false if failed. function getSuggestion($word) { if (function_exists("mb_convert_encoding")) $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8")); else $word = utf8_encode($word); if ($fh = fopen($this->tmpfile, "w")) { fwrite($fh, "!\n"); fwrite($fh, "^$word\n"); fclose($fh); } else die("Error opening tmp file."); $data = shell_exec($this->cmd); @unlink($this->tmpfile); $returnData = array(); $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); foreach($dataArr as $dstr) { $matches = array(); // Skip this line. if (strpos($dstr, "@") === 0) continue; preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches); if (!empty($matches[1])) { // For some reason, the exec version seems to add commas? $returnData[] = str_replace(",", "", $matches[1]); } } return $returnData; } function _debugData($data) { $fh = @fopen("debug.log", 'a+'); @fwrite($fh, $data); @fclose($fh); } } // Setup classname, should be the same as the name of the spellchecker class $spellCheckerConfig['class'] = "TinyPspellShell"; ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php0000644000000000000000000000355411077635520024707 0ustar rootroot_getPLink($lang); $outWords = array(); foreach ($words as $word) { if (!pspell_check($plink, trim($word))) $outWords[] = utf8_encode($word); } return $outWords; } /** * Returns suggestions of for a specific word. * * @param {String} $lang Language code like sv or en. * @param {String} $word Specific word to get suggestions for. * @return {Array} Array of suggestions for the specified word. */ function &getSuggestions($lang, $word) { $words = pspell_suggest($this->_getPLink($lang), $word); for ($i=0; $ithrowError("PSpell support not found in PHP installation."); // Setup PSpell link $plink = pspell_new( $lang, $this->_config['PSpell.spelling'], $this->_config['PSpell.jargon'], $this->_config['PSpell.encoding'], $this->_config['PSpell.mode'] ); // Setup PSpell link /* if (!$plink) { $pspellConfig = pspell_config_create( $lang, $this->_config['PSpell.spelling'], $this->_config['PSpell.jargon'], $this->_config['PSpell.encoding'] ); $plink = pspell_new_config($pspell_config); }*/ if (!$plink) $this->throwError("No PSpell link found opened."); return $plink; } } ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php0000644000000000000000000000271611077635520026053 0ustar rootroot_config = $config; } /** * Simple loopback function everything that gets in will be send back. * * @param $args.. Arguments. * @return {Array} Array of all input arguments. */ function &loopback(/* args.. */) { return func_get_args(); } /** * Spellchecks an array of words. * * @param {String} $lang Language code like sv or en. * @param {Array} $words Array of words to spellcheck. * @return {Array} Array of misspelled words. */ function &checkWords($lang, $words) { return $words; } /** * Returns suggestions of for a specific word. * * @param {String} $lang Language code like sv or en. * @param {String} $word Specific word to get suggestions for. * @return {Array} Array of suggestions for the specified word. */ function &getSuggestions($lang, $word) { return array(); } /** * Throws an error message back to the user. This will stop all execution. * * @param {String} $str Message to send back to user. */ function throwError($str) { die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); } } ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php0000644000000000000000000000537211077635520025677 0ustar rootroot_getCMD($lang); if ($fh = fopen($this->_tmpfile, "w")) { fwrite($fh, "!\n"); foreach($words as $key => $value) fwrite($fh, "^" . $value . "\n"); fclose($fh); } else $this->throwError("PSpell support was not found."); $data = shell_exec($cmd); @unlink($this->_tmpfile); $returnData = array(); $dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY); foreach ($dataArr as $dstr) { $matches = array(); // Skip this line. if (strpos($dstr, "@") === 0) continue; preg_match("/\& ([^ ]+) .*/i", $dstr, $matches); if (!empty($matches[1])) $returnData[] = utf8_encode(trim($matches[1])); } return $returnData; } /** * Returns suggestions of for a specific word. * * @param {String} $lang Language code like sv or en. * @param {String} $word Specific word to get suggestions for. * @return {Array} Array of suggestions for the specified word. */ function &getSuggestions($lang, $word) { $cmd = $this->_getCMD($lang); if (function_exists("mb_convert_encoding")) $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8")); else $word = utf8_encode($word); if ($fh = fopen($this->_tmpfile, "w")) { fwrite($fh, "!\n"); fwrite($fh, "^$word\n"); fclose($fh); } else $this->throwError("Error opening tmp file."); $data = shell_exec($cmd); @unlink($this->_tmpfile); $returnData = array(); $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); foreach($dataArr as $dstr) { $matches = array(); // Skip this line. if (strpos($dstr, "@") === 0) continue; preg_match("/\&[^:]+:(.*)/i", $dstr, $matches); if (!empty($matches[1])) { $words = array_slice(explode(',', $matches[1]), 0, 10); for ($i=0; $i_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell"); if(preg_match("#win#i", php_uname())) return $this->_config['PSpellShell.aspell'] . " -a --lang=". $lang . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1"; return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". $lang; } } ?> blogs/wp-includes/js/tinymce/plugins/spellchecker/img/0000755000000000000000000000000011077323063022103 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif0000644000000000000000000000005611077635520023715 0ustar rootrootGIF89a**!,Df;blogs/wp-includes/js/tinymce/plugins/wphelp/0000755000000000000000000000000011046077144020164 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/wphelp/images/0000755000000000000000000000000011046077144021431 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/wphelp/images/help.gif0000644000000000000000000000044711046077144023055 0ustar rootrootGIF89aO^u"Zr9ZBzrýP5nSVMp_ܑ̰"X"g!,'dihHY_fUNTFfD"TX$b1pLJ%px$G“a It%qH d8&bmz^~%u & & ' }( Q* 44!;blogs/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js0000644000000000000000000000707711046077144023401 0ustar rootroot/* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('wphelp', ''); function TinyMCE_wphelp_getControlHTML(control_name) { switch (control_name) { case "wphelp": var titleHelp = tinyMCE.getLang('lang_help_button_title'); var buttons = ''; var hiddenControls = '
    ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
    '; return buttons+hiddenControls; } return ""; } function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) { // Handle commands switch (command) { case "mceWordPressHelp": var template = new Array(); template['file'] = tinyMCE.baseURL + '/wp-mce-help.php'; template['width'] = 480; template['height'] = 380; args = { resizable : 'yes', scrollbars : 'yes' }; tinyMCE.openWindow(template, args); return true; } // Pass to next handler in chain return false; } blogs/wp-includes/js/tinymce/plugins/wphelp/langs/0000755000000000000000000000000011046077144021270 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/wphelp/langs/en.js0000644000000000000000000000013111046077144022223 0ustar rootroot// EN lang variables tinyMCE.addToLang('',{ help_button_title : 'Help (Alt+h)' }); blogs/wp-includes/js/tinymce/plugins/media/0000755000000000000000000000000011077323063017742 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/media/css/0000755000000000000000000000000011077323063020532 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/media/css/content.css0000644000000000000000000000101411077635520022716 0ustar rootroot.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;} .mceItemShockWave {background-image: url(../img/shockwave.gif);} .mceItemFlash {background-image:url(../img/flash.gif);} .mceItemQuickTime {background-image:url(../img/quicktime.gif);} .mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);} .mceItemRealMedia {background-image:url(../img/realmedia.gif);} blogs/wp-includes/js/tinymce/plugins/media/css/media.css0000644000000000000000000000234711077635520022335 0ustar rootroot#id, #name, #hspace, #vspace, #class_name, #align { width: 100px } #hspace, #vspace { width: 50px } #flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px } #flash_base, #flash_flashvars { width: 240px } #width, #height { width: 40px } #src, #media_type { width: 250px } #class { width: 120px } #prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto } .panel_wrapper div.current { height: 390px; overflow: auto } #flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none } .mceAddSelectValue { background-color: #DDDDDD } #qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px } #wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px } #rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px } #shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px } #qt_qtsrc { width: 200px } blogs/wp-includes/js/tinymce/plugins/media/js/0000755000000000000000000000000011077323063020356 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/media/js/embed.js0000644000000000000000000000351111077635520021774 0ustar rootroot/** * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. */ function writeFlash(p) { writeEmbed( 'D27CDB6E-AE6D-11cf-96B8-444553540000', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'application/x-shockwave-flash', p ); } function writeShockWave(p) { writeEmbed( '166B1BCA-3F9C-11CF-8075-444553540000', 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', 'application/x-director', p ); } function writeQuickTime(p) { writeEmbed( '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', 'video/quicktime', p ); } function writeRealMedia(p) { writeEmbed( 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'audio/x-pn-realaudio-plugin', p ); } function writeWindowsMedia(p) { p.url = p.src; writeEmbed( '6BF52A52-394A-11D3-B153-00C04F79FAA6', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', 'application/x-mplayer2', p ); } function writeEmbed(cls, cb, mt, p) { var h = '', n; h += ''; h += ''); function init() { var pl = "", f, val; var type = "flash", fe, i; ed = tinyMCEPopup.editor; tinyMCEPopup.resizeToInnerSize(); f = document.forms[0] fe = ed.selection.getNode(); if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { pl = fe.title; switch (ed.dom.getAttrib(fe, 'class')) { case 'mceItemFlash': type = 'flash'; break; case 'mceItemFlashVideo': type = 'flv'; break; case 'mceItemShockWave': type = 'shockwave'; break; case 'mceItemWindowsMedia': type = 'wmp'; break; case 'mceItemQuickTime': type = 'qt'; break; case 'mceItemRealMedia': type = 'rmp'; break; } document.forms[0].insert.value = ed.getLang('update', 'Insert', true); } document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); var html = getMediaListHTML('medialist','src','media','media'); if (html == "") document.getElementById("linklistrow").style.display = 'none'; else document.getElementById("linklistcontainer").innerHTML = html; // Resize some elements if (isVisible('filebrowser')) document.getElementById('src').style.width = '230px'; // Setup form if (pl != "") { pl = tinyMCEPopup.editor.plugins.media._parse(pl); switch (type) { case "flash": setBool(pl, 'flash', 'play'); setBool(pl, 'flash', 'loop'); setBool(pl, 'flash', 'menu'); setBool(pl, 'flash', 'swliveconnect'); setStr(pl, 'flash', 'quality'); setStr(pl, 'flash', 'scale'); setStr(pl, 'flash', 'salign'); setStr(pl, 'flash', 'wmode'); setStr(pl, 'flash', 'base'); setStr(pl, 'flash', 'flashvars'); break; case "qt": setBool(pl, 'qt', 'loop'); setBool(pl, 'qt', 'autoplay'); setBool(pl, 'qt', 'cache'); setBool(pl, 'qt', 'controller'); setBool(pl, 'qt', 'correction'); setBool(pl, 'qt', 'enablejavascript'); setBool(pl, 'qt', 'kioskmode'); setBool(pl, 'qt', 'autohref'); setBool(pl, 'qt', 'playeveryframe'); setBool(pl, 'qt', 'tarsetcache'); setStr(pl, 'qt', 'scale'); setStr(pl, 'qt', 'starttime'); setStr(pl, 'qt', 'endtime'); setStr(pl, 'qt', 'tarset'); setStr(pl, 'qt', 'qtsrcchokespeed'); setStr(pl, 'qt', 'volume'); setStr(pl, 'qt', 'qtsrc'); break; case "shockwave": setBool(pl, 'shockwave', 'sound'); setBool(pl, 'shockwave', 'progress'); setBool(pl, 'shockwave', 'autostart'); setBool(pl, 'shockwave', 'swliveconnect'); setStr(pl, 'shockwave', 'swvolume'); setStr(pl, 'shockwave', 'swstretchstyle'); setStr(pl, 'shockwave', 'swstretchhalign'); setStr(pl, 'shockwave', 'swstretchvalign'); break; case "wmp": setBool(pl, 'wmp', 'autostart'); setBool(pl, 'wmp', 'enabled'); setBool(pl, 'wmp', 'enablecontextmenu'); setBool(pl, 'wmp', 'fullscreen'); setBool(pl, 'wmp', 'invokeurls'); setBool(pl, 'wmp', 'mute'); setBool(pl, 'wmp', 'stretchtofit'); setBool(pl, 'wmp', 'windowlessvideo'); setStr(pl, 'wmp', 'balance'); setStr(pl, 'wmp', 'baseurl'); setStr(pl, 'wmp', 'captioningid'); setStr(pl, 'wmp', 'currentmarker'); setStr(pl, 'wmp', 'currentposition'); setStr(pl, 'wmp', 'defaultframe'); setStr(pl, 'wmp', 'playcount'); setStr(pl, 'wmp', 'rate'); setStr(pl, 'wmp', 'uimode'); setStr(pl, 'wmp', 'volume'); break; case "rmp": setBool(pl, 'rmp', 'autostart'); setBool(pl, 'rmp', 'loop'); setBool(pl, 'rmp', 'autogotourl'); setBool(pl, 'rmp', 'center'); setBool(pl, 'rmp', 'imagestatus'); setBool(pl, 'rmp', 'maintainaspect'); setBool(pl, 'rmp', 'nojava'); setBool(pl, 'rmp', 'prefetch'); setBool(pl, 'rmp', 'shuffle'); setStr(pl, 'rmp', 'console'); setStr(pl, 'rmp', 'controls'); setStr(pl, 'rmp', 'numloop'); setStr(pl, 'rmp', 'scriptcallbacks'); break; } setStr(pl, null, 'src'); setStr(pl, null, 'id'); setStr(pl, null, 'name'); setStr(pl, null, 'vspace'); setStr(pl, null, 'hspace'); setStr(pl, null, 'bgcolor'); setStr(pl, null, 'align'); setStr(pl, null, 'width'); setStr(pl, null, 'height'); if ((val = ed.dom.getAttrib(fe, "width")) != "") pl.width = f.width.value = val; if ((val = ed.dom.getAttrib(fe, "height")) != "") pl.height = f.height.value = val; oldWidth = pl.width ? parseInt(pl.width) : 0; oldHeight = pl.height ? parseInt(pl.height) : 0; } else oldWidth = oldHeight = 0; selectByValue(f, 'media_type', type); changedType(type); updateColor('bgcolor_pick', 'bgcolor'); TinyMCE_EditableSelects.init(); generatePreview(); } function insertMedia() { var fe, f = document.forms[0], h; tinyMCEPopup.restoreSelection(); if (!AutoValidator.validate(f)) { alert(ed.getLang('invalid_data')); return false; } f.width.value = f.width.value == "" ? 100 : f.width.value; f.height.value = f.height.value == "" ? 100 : f.height.value; fe = ed.selection.getNode(); if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { switch (f.media_type.options[f.media_type.selectedIndex].value) { case "flash": fe.className = "mceItemFlash"; break; case "flv": fe.className = "mceItemFlashVideo"; break; case "shockwave": fe.className = "mceItemShockWave"; break; case "qt": fe.className = "mceItemQuickTime"; break; case "wmp": fe.className = "mceItemWindowsMedia"; break; case "rmp": fe.className = "mceItemRealMedia"; break; } if (fe.width != f.width.value || fe.height != f.height.height) ed.execCommand('mceRepaint'); fe.title = serializeParameters(); fe.width = f.width.value; fe.height = f.height.value; fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); fe.align = f.align.options[f.align.selectedIndex].value; } else { h = ' 0) { var html = ""; html += ''; return html; } return ""; } function getType(v) { var fo, i, c, el, x, f = document.forms[0]; fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); // YouTube if (v.match(/watch\?v=(.+)(.*)/)) { f.width.value = '425'; f.height.value = '350'; f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; return 'flash'; } // Google video if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { f.width.value = '425'; f.height.value = '326'; f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; return 'flash'; } for (i=0; i 0 ? s.substring(0, s.length - 1) : s; return s; } function setBool(pl, p, n) { if (typeof(pl[n]) == "undefined") return; document.forms[0].elements[p + "_" + n].checked = pl[n]; } function setStr(pl, p, n) { var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; if (typeof(pl[n]) == "undefined") return; if (e.type == "text") e.value = pl[n]; else selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); } function getBool(p, n, d, tv, fv) { var v = document.forms[0].elements[p + "_" + n].checked; tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); } function getStr(p, n, d) { var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; if (n == 'src') v = tinyMCEPopup.editor.convertURL(v, 'src', null); return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); } function getInt(p, n, d) { var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); } function jsEncode(s) { s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); s = s.replace(new RegExp('"', 'g'), '\\"'); s = s.replace(new RegExp("'", 'g'), "\\'"); return s; } function generatePreview(c) { var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; p.innerHTML = ''; nw = parseInt(f.width.value); nh = parseInt(f.height.value); if (f.width.value != "" && f.height.value != "") { if (f.constrain.checked) { if (c == 'width' && oldWidth != 0) { wp = nw / oldWidth; nh = Math.round(wp * nh); f.height.value = nh; } else if (c == 'height' && oldHeight != 0) { hp = nh / oldHeight; nw = Math.round(hp * nw); f.width.value = nw; } } } if (f.width.value != "") oldWidth = nw; if (f.height.value != "") oldHeight = nh; // After constrain pl = serializeParameters(); switch (f.media_type.options[f.media_type.selectedIndex].value) { case "flash": cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; type = 'application/x-shockwave-flash'; break; case "shockwave": cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; type = 'application/x-director'; break; case "qt": cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; type = 'video/quicktime'; break; case "wmp": cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; type = 'application/x-mplayer2'; break; case "rmp": cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; type = 'audio/x-pn-realaudio-plugin'; break; } if (pl == '') { p.innerHTML = ''; return; } pl = tinyMCEPopup.editor.plugins.media._parse(pl); if (!pl.src) { p.innerHTML = ''; return; } pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); pl.width = !pl.width ? 100 : pl.width; pl.height = !pl.height ? 100 : pl.height; pl.id = !pl.id ? 'obj' : pl.id; pl.name = !pl.name ? 'eobj' : pl.name; pl.align = !pl.align ? '' : pl.align; // Avoid annoying warning about insecure items if (!tinymce.isIE || document.location.protocol != 'https:') { h += ''; for (n in pl) { h += ''; // Add extra url parameter if it's an absolute URL if (n == 'src' && pl[n].indexOf('://') != -1) h += ''; } } h += ']*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/?>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object)([^>]*)>/gi,'');h=h.replace(/<\/embed>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();blogs/wp-includes/js/tinymce/plugins/media/img/0000755000000000000000000000000011077323063020516 5ustar rootrootblogs/wp-includes/js/tinymce/plugins/media/img/trans.gif0000644000000000000000000000005311077635520022336 0ustar rootrootGIF89a!,D;blogs/wp-includes/js/tinymce/plugins/media/img/flash.gif0000644000000000000000000000036111077635520022306 0ustar rootrootGIF89a (JnVjz\䂏8Zj}!,I8?Bh4NQ0Za EǼԄ0B@H$ p0әpHÌr\ ڙ^5Us Nam4CQva*- s U  %a 9. MO 8)H;blogs/wp-includes/js/tinymce/plugins/media/img/flv_player.swf0000644000000000000000000002662411077635520023420 0ustar rootrootCWSax| \S$pr/EO΀ ѐEUEzZj[jjjkov?xowfvvfvf`KsBj)@=%hjjJe 6( UH |F5PT! (5y$DxLB[ 4SH e>aJPBIB.&䫴>$)sIC=؇ޓ!g}o^ӣzT G)!;tQTPPƏ-Z>C=>A×迨֡ 幻GJ?쑱"Ӫھ{SVes¶ŋe^cKqy? 5~E^LhQD5޿ˬ<+O߅i8jοMN6,?D~#5d([T;nJ = DAqfy9 ^)jrp@/o ɰ&6ٸT+Tɠj؎A:;0)Yp<\<0B k*ۥO2FD G0cۥB_HXޕA!A$B,D`(it Z[J~ЬَW+ EH.,225S*H+*QZTi (_֠RBoư(EYԐZf0贤h07JQPBcե< dXQkU(L"J02JP΀M WҖ 22>>U0BS~ 4H]{>Coұ~PeH`P R0#,ẠP~O(ӱ¥X4'ҫ*%'vI)zbҨ |:6K>K'iU*" oPFQjЁ:S(eĚ_4egVm}3L+Yc@Q1`|e%^b{: nn| r06m> tZ*("DHa0(hO Tz@*y#[aI{+ 4VQ(׫K qDu?aZ YP4mO~*,Jl76F1FG✔Jbcj$HA@TUU?L @#NX D tUZFU(JB@EA=;Fuѱ[TNTKgPdfFir̅JT1(oo(Y+,UU"uŝQ~YAW R خ5~ZZTb-. a0)0L@-QjthEѮ54!Ƞ *uQoH8Q&2V_*(?@o=Д)@cVAgT -F2iG)P%3j3*$ӫ2ʊ .2ء,+"QPyN:uh αZQiqqªVBgV\:g~c6^0 He<_b-n>QBj`^?!8sjRBjvؖ*.. AxFzP2 2p5 nټ3o,V/6~JhD%v~+ B H)a+rZZ xXXM!peI 9'# @ C12;d^ #$e.H"# Iyqv&e/\)@= I"D|HlLZ$7|IԑCDI٦L<4Tˎe'q!5\ сmvV_t/sB7,21")!ǽ 2Me-h]+""`7tycMǶ@m<W}9!FPMc46- dZa_ <aZ7Yѳ#T0 '<[ӏB,ZX';2 I5e0DU:1k|97L%jc!gociأ6l|`1wcۃp4ޒ5SN8F9߃ j'n3ds((LIw%㥙ԟ0@;A I9|SiEpY4W0QBr["7a%HH1B4+ΈY:2dytw;@E<S\Z0&$9z\X9ɷd\_RI3&*y%#BjjEF\NBu+"=>x:1پ}@q6c4 8Tm}2"<<$rod/Y_">l+ snAQ>> DdDwVD?"_N/|hKqH c)7aV$>#}?5y8NfDXD`Vj&T#nad!aoWP.,,K: d;dnv.H]XL=eSmk/+5L ԌxC;+/֝0 D_[8qZ81=5a4VihwDHz"OA)XBbm 9a'>x[yZ+umH&Ҩ/)Lދ:бZM?1<;.CrOYt2ӓ>G#2\e!DjN`5[V' (XefZ4eSWji\kS p ti$D _;8 m(q|Nvc&x#\LV mZHݖ3, (WS^.9ܡ2fOQ!I`R-h&nRZ;4Wk3Auo7czW0 'Li$B$MeNצɠ=tF$6f5kTBҥG mMmDdB ŒQ[۬FīY!fRj6M&`#\ 隓 Cvt*|EDPM'ɗ=Po)ePҜ/ΉM$j%dGEl@G`i\ xl}k6ペJFe 9@ǥ3i ;7e#0femw\7g>FlX&o|UH_!aQ)/+{:5[6zζ^DaLCb$s'L[8^`o*pqi\!!jvߡE35^R=59ྋ"^ n" İ$1S* 좽!hɛVUev}}=rwր?IoF  (n<p'JjѬ΅>rU_: ˳jNV \t|ɪK:מ+wꮮbu0Og9rJ$}%W5-p܅T8mf4tDW17_id 3Ƣ¦5]\]uQ>kWYwhvRؑK]B {{F5c$SX}pn9E%\\r{nN9 6ɢu$c\.a?y5]l<$35Ҩaӂ8=8qgmD#dO *1 wY9~5@#eHA QכkF8} [cQYKHɒ&Mg@cZB >kwPq B)mAScN"a;K`+dO|eT~,`3ݾ  ge ?iC6@ nPs^UT,$nN]+B{mn@ R-MÍJlBL@L0Y4i*.ܮrww#A0lN.q0LNkw=VŮNPs1d!,4rb>z1C1L#wPweXJD$;8 0;wH%*.m[x",[6խ6%㾌.ʹf>9''N{9lO}gYw]O6'V[3׺ʼ^ ]_YkFFM5#{O*.NPt}-r6c{_~<4Y\RTD_MCkq [[̅9g~vz~"犤;o"@ޠ+]op"꽶ፄQ{ v2ySڝin>]mSz|? >~own5=須VPHW礤)W(<^޶^, ^)?_=eOWZy5˥߿zUoZvw{%MGw҃KoG; g¦W=+䚝~[ώkl^9u|Q[QcRVgSV?,C[Ӻ!nG9>i?tZ25W߻ρ·.KSK+ccOUXPW6sꮑ&]y;OK{XlwxɃwGflc6qBỮsyCcؑ+?y. ԨsC.!k/dйYg ]ffjp׏7?&D"ܽq|+iN٭lnދUuOg(c6=pf_π}kԭx%]/W3 I=-r^BѰ=;< uI5R~vLWɹNwxV_k=2|ِ;w<~7.U)Vʛ+&NN[7hkNdCo 9ÉCZwҸ_ȟ\l7|0j×Nd!oGݴ}y;ܚ:s{#NOoV$>&gːSxqpț{y留'ľ_1v)uG`g݉{ϡU].ȍ1qF꥞%k\n޻W~I#9~~SuMaњXg8V^Լ}cc[Ԙ0'w GFnx¸={L~÷.3{7HPgE§ILWݿ+yyٛroonK?.pOq+;n1ו%ΏJ %Ÿt96緝㤮>YY`ەR]^Qk_^w*tUmO q{ޥ?nzXz9s5p5c*8"p8b-XFGe sAVŚ}s-]Zw ֿtKtǠeuukJg-|KϽ { oJLslcw:(,oh=Od'O'ްU믟ͨ>#n;uvb0˫٩Q_1~1[fV#!T5~Y~]xڔ'φ|t蓛n虻}fV Nh$^_hg}ͱ7&]<)Go-Yjʸ#~#cW h?>gT;?z>om/ԍܔrxm 燷%hy[k|MgVnT%2ڧႺ=WMיV_?8Wr^|/jt*kv׆fhԜGʏv4vFh$_b$tt&3xk=  rX3!iAkQ4N ՁiA+|k% "! 1o/-W֋1\z2+VŁʙr8$-Ä`Wxr/;e[@GOS־~=ۓ{4z9,]lPrYl7y}n a+Uf:LW2dAHΤHOwP.ш"ey׶V:|Vݩaƭ욲dk[W]F5`\t5`GtwqL1DbtC{xvi\E14xdLtafˠxBL]˴B+"#*˼Žh5H}<Dz#I=շ %7gvN1|ϻGnyB <4)~[\|gӓTWW7/'է}}}c*ޞ57Bn%N{pvo}ĉr̷:ooZ{r\I8l}㌇n]sĂG?,G }dMЍ\W[/ F\1Ž$%pC2V?3|K"#$7ؒD{;(~SQ{[1(^UA@5u@G|P̠FSh^H@^_mtf_Y\gz)0" $.r/qDЧv-DzD{H.Bw2p>ڵkESSq\ze%e 9g xnBCL:ݹA],FϹk# DkVB8mb#))'=., ? ., B 2%3cB(  ~;blogs/wp-includes/js/tinymce/plugins/media/img/quicktime.gif0000644000000000000000000000045711077635520023212 0ustar rootrootGIF89a7M6nX brt |)t !,'Ga1_g<[m\ E`, 22!@4CY(>iLD8ntYuD#ux z"  #7S ,V ". ;*?5;" <_ ,\" !;blogs/wp-includes/js/tinymce/plugins/media/media.htm0000644000000000000000000007662311077635520021555 0ustar rootroot {#media_dlg.title}
    {#media_dlg.general}
     
     
    x   
    {#media_dlg.preview}
    {#media_dlg.advanced}
     
    {#media_dlg.flash_options}